Compare commits
10 Commits
L-CSplash
...
SQC_21_Men
Author | SHA1 | Date | |
---|---|---|---|
|
9dd2e1b821 | ||
|
eed8f5f04a | ||
|
e2fa4fea7c | ||
|
fc4a22e844 | ||
|
102153a093 | ||
|
c7271f6217 | ||
|
8ebe7b95fc | ||
|
5e29c9be54 | ||
|
df5b7960b2 | ||
|
db0a39f64a |
@@ -5,8 +5,6 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Define a structure to represent notifications
|
// Define a structure to represent notifications
|
||||||
struct Notification {
|
struct Notification {
|
||||||
std::string message;
|
std::string message;
|
||||||
@@ -74,6 +72,8 @@ void Engine::DrawSplachScreen()
|
|||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
m_gamestate = GameState::OPTIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -346,7 +346,13 @@ void Engine::LoadResource() {
|
|||||||
LoadTexture(m_skybox.GetTexture(), TEXTURE_PATH "skybox.png", true);
|
LoadTexture(m_skybox.GetTexture(), TEXTURE_PATH "skybox.png", true);
|
||||||
LoadTexture(m_textureCrosshair, TEXTURE_PATH "cross.bmp", true);
|
LoadTexture(m_textureCrosshair, TEXTURE_PATH "cross.bmp", true);
|
||||||
LoadTexture(m_textureFont, TEXTURE_PATH "font.bmp", true);
|
LoadTexture(m_textureFont, TEXTURE_PATH "font.bmp", true);
|
||||||
LoadTexture(m_textureGun, TEXTURE_PATH "gun01.png", true);
|
LoadTexture(m_textureGun, TEXTURE_PATH "gun01.png", false);
|
||||||
|
LoadTexture(m_texturePovGun, TEXTURE_PATH "GUN.png", false);
|
||||||
|
LoadTexture(m_textureSoloMultiMenu, TEXTURE_PATH "single_multi.png", false);
|
||||||
|
LoadTexture(m_textureSoloText, TEXTURE_PATH "single_player.png", false);
|
||||||
|
LoadTexture(m_textureMultiText, TEXTURE_PATH "multi_player.png", false);
|
||||||
|
LoadTexture(m_textureSoloMultiMenu, TEXTURE_PATH "single_multi.png", false);
|
||||||
|
LoadTexture(m_textureTitle, TEXTURE_PATH "title.png", false);
|
||||||
|
|
||||||
LoadTexture(MenuTitleTexture, MENU_ITEM_PATH "test.png");
|
LoadTexture(MenuTitleTexture, MENU_ITEM_PATH "test.png");
|
||||||
LoadTexture(MenuBGTexture, MENU_ITEM_PATH "test.png");
|
LoadTexture(MenuBGTexture, MENU_ITEM_PATH "test.png");
|
||||||
@@ -403,7 +409,6 @@ void Engine::KillNotification(Player killer, Player killed) {
|
|||||||
DisplayNotification(message);
|
DisplayNotification(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Engine::DisplayNotification(std::string message) {
|
void Engine::DisplayNotification(std::string message) {
|
||||||
|
|
||||||
if (message.length() > 45) {
|
if (message.length() > 45) {
|
||||||
@@ -419,17 +424,19 @@ void Engine::DisplayNotification(std::string message) {
|
|||||||
|
|
||||||
// Add a method to process the notification queue
|
// Add a method to process the notification queue
|
||||||
void Engine::ProcessNotificationQueue() {
|
void Engine::ProcessNotificationQueue() {
|
||||||
m_textureFont.Bind();
|
//PrintText(fPosX, fUsernamePosY, ss.str(), 1.5f);
|
||||||
float scale = GetScale();
|
//float fPosX = (Width() / 100.0f) * scaleX;
|
||||||
unsigned int xOffset = Width() - Width() * 0.26;
|
//float fPosY = Height() - (Height() * 0.05) * scaleY;
|
||||||
unsigned int yOffset = Height() - (Height() / 2.2);
|
|
||||||
|
m_textureFont.Bind();
|
||||||
|
float xOffset = Width() * 0.66f;
|
||||||
|
float yOffset = Height() * 0.83f;
|
||||||
|
|
||||||
// Iterate through the notifications and display them
|
|
||||||
for (auto it = notifications.begin(); it != notifications.end(); ) {
|
for (auto it = notifications.begin(); it != notifications.end(); ) {
|
||||||
float timeSinceDisplay = m_time - it->displayStartTime;
|
float timeSinceDisplay = m_time - it->displayStartTime;
|
||||||
|
|
||||||
// Display the notification message with vertical offset
|
float y = yOffset - (20.0f * (it - notifications.begin()));
|
||||||
unsigned int y = yOffset - (static_cast<unsigned int>(scale * 20) * (it - notifications.begin()));
|
|
||||||
glDisable(GL_STENCIL_TEST);
|
glDisable(GL_STENCIL_TEST);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
@@ -445,7 +452,7 @@ void Engine::ProcessNotificationQueue() {
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
PrintText(xOffset, y, scale, it->message);
|
PrintText(xOffset, y, it->message);
|
||||||
|
|
||||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
||||||
glBlendEquation(GL_FUNC_SUBTRACT);
|
glBlendEquation(GL_FUNC_SUBTRACT);
|
||||||
@@ -455,39 +462,87 @@ void Engine::ProcessNotificationQueue() {
|
|||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
// Check if it's time to remove the notification (display for 2 seconds)
|
|
||||||
if (timeSinceDisplay >= 4.0f) {
|
if (timeSinceDisplay >= 4.0f) {
|
||||||
it = notifications.erase(it); // Remove the notification
|
it = notifications.erase(it);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Engine::DisplayCrosshair() {
|
void Engine::DisplayCrosshair() {
|
||||||
m_textureCrosshair.Bind();
|
m_textureCrosshair.Bind();
|
||||||
static const int crossSize = 32;
|
static const int crossSize = 32;
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glTranslated(Width() / 2 - crossSize / 2, Height() / 2 - crossSize / 2, 0);
|
glTranslated(Width() / 2 - crossSize / 2, Height() / 2 - crossSize / 2, 0);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(0, 0);
|
glTexCoord2f(0, 0);
|
||||||
glVertex2i(0, 0);
|
glVertex2i(0, 0);
|
||||||
glTexCoord2f(1, 0);
|
glTexCoord2f(1, 0);
|
||||||
glVertex2i(crossSize, 0);
|
glVertex2i(crossSize, 0);
|
||||||
glTexCoord2f(1, 1);
|
glTexCoord2f(1, 1);
|
||||||
glVertex2i(crossSize, crossSize);
|
glVertex2i(crossSize, crossSize);
|
||||||
glTexCoord2f(0, 1);
|
glTexCoord2f(0, 1);
|
||||||
glVertex2i(0, crossSize);
|
glVertex2i(0, crossSize);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Engine::DisplayPovGun() {
|
||||||
|
// Setter le blend function, tout ce qui sera noir sera transparent
|
||||||
|
glDisable(GL_STENCIL_TEST);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
|
||||||
|
glLoadIdentity();
|
||||||
|
glOrtho(0, Width(), 0, Height(), -1, 1);
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
|
||||||
|
float baseXOffsetPercentage = 0.4958;
|
||||||
|
float baseWidthPercentage = 0.4688;
|
||||||
|
float baseHeightPercentage = 0.5787;
|
||||||
|
|
||||||
|
float xTranslation = baseXOffsetPercentage * Width();
|
||||||
|
float quadWidth = baseWidthPercentage * Width();
|
||||||
|
float quadHeight = baseHeightPercentage * Height();
|
||||||
|
|
||||||
|
m_texturePovGun.Bind();
|
||||||
|
glLoadIdentity();
|
||||||
|
glTranslated(xTranslation, 0, 0);
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
|
glVertex2i(0, 0);
|
||||||
|
glTexCoord2f(1, 0);
|
||||||
|
glVertex2i(quadWidth, 0);
|
||||||
|
glTexCoord2f(1, 1);
|
||||||
|
glVertex2i(quadWidth, quadHeight);
|
||||||
|
glTexCoord2f(0, 1);
|
||||||
|
glVertex2i(0, quadHeight);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
// Reset du blend function
|
||||||
|
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
||||||
|
glBlendEquation(GL_FUNC_SUBTRACT);
|
||||||
|
|
||||||
|
glEnable(GL_STENCIL_TEST);
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPopMatrix();
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
void Engine::DisplayCurrentItem() {
|
void Engine::DisplayCurrentItem() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -495,110 +550,276 @@ void Engine::DisplayCurrentItem() {
|
|||||||
void Engine::DisplayHud(int timer) {
|
void Engine::DisplayHud(int timer) {
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glDisable(GL_BLEND);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
// Barre HP
|
float itemBackgroundWidthProportion = 0.25f;
|
||||||
float fBarWidth = Width() / 4;
|
float itemBackgroundHeightProportion = 0.175f;
|
||||||
float fBarHeight = Height() / 25;
|
float itemBackgroundWidth = Width() * itemBackgroundWidthProportion;
|
||||||
float fPosX = Width() / 20;
|
float itemBackgroundHeight = Height() * itemBackgroundHeightProportion;
|
||||||
float fPosY = Height() - (Height() - (fBarHeight * 4));
|
float itemBackgroundXOffset = Width() * 0.05f;
|
||||||
|
float itemBackgroundYOffset = Height() * 0.6f;
|
||||||
|
float itemBackgroundXPos = itemBackgroundXOffset;
|
||||||
|
float itemBackgroundYPos = Height() - itemBackgroundHeight - itemBackgroundYOffset;
|
||||||
|
|
||||||
|
// Selected item background
|
||||||
|
glColor4f(1.0f, 1.0f, 1.0f, 0.2f);
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glVertex2f(itemBackgroundXPos, itemBackgroundYPos);
|
||||||
|
glVertex2f(itemBackgroundXPos + itemBackgroundWidth, itemBackgroundYPos);
|
||||||
|
glVertex2f(itemBackgroundXPos + itemBackgroundWidth, itemBackgroundYPos + itemBackgroundHeight);
|
||||||
|
glVertex2f(itemBackgroundXPos, itemBackgroundYPos + itemBackgroundHeight);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
// HP Bar
|
||||||
float playerHp = m_player.GetHP();
|
float playerHp = m_player.GetHP();
|
||||||
float facteurOmbrage = m_displayInfo ? 0.5f : 1.0f;
|
float facteurOmbrage = m_displayInfo ? 0.5f : 1.0f;
|
||||||
|
|
||||||
// Arri<72>re-plan (Barre HP)
|
float hpBarWidthProportion = 0.25f;
|
||||||
|
float hpBarHeightProportion = 0.045f;
|
||||||
|
float hpBarWidth = Width() * hpBarWidthProportion;
|
||||||
|
float hpBarHeight = Height() * hpBarHeightProportion;
|
||||||
|
float hpBarXOffset = Width() * 0.05f;
|
||||||
|
float hpBarYOffset = Height() * 0.7f;
|
||||||
|
float hpBarYPos = Height() - hpBarHeight - hpBarYOffset;
|
||||||
|
|
||||||
|
// HP Bar Background
|
||||||
glColor3f(1.0f * facteurOmbrage, 1.0f * facteurOmbrage, 1.0f * facteurOmbrage);
|
glColor3f(1.0f * facteurOmbrage, 1.0f * facteurOmbrage, 1.0f * facteurOmbrage);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glVertex2f(fPosX, fPosY - fBarHeight); // Bas-Gauche
|
glVertex2f(itemBackgroundXPos, hpBarYPos - hpBarHeight);
|
||||||
glVertex2f(fPosX + fBarWidth, fPosY - fBarHeight); // Bas-Droite
|
glVertex2f(itemBackgroundXPos + itemBackgroundWidth, hpBarYPos - hpBarHeight);
|
||||||
glVertex2f(fPosX + fBarWidth, fPosY); // Haut-Droite
|
glVertex2f(itemBackgroundXPos + itemBackgroundWidth, hpBarYPos);
|
||||||
glVertex2f(fPosX, fPosY); // Haut-Gauche
|
glVertex2f(itemBackgroundXPos, hpBarYPos);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
//TODO: Associer avec m<>chanique de vie du joueur
|
// Current HP
|
||||||
|
|
||||||
// Barre HP
|
|
||||||
glColor3f(0.0f * facteurOmbrage, 1.0f * facteurOmbrage, 0.0f * facteurOmbrage);
|
glColor3f(0.0f * facteurOmbrage, 1.0f * facteurOmbrage, 0.0f * facteurOmbrage);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glVertex2f(fPosX, fPosY - fBarHeight); // Bas-Gauche
|
glVertex2f(itemBackgroundXPos, hpBarYPos - hpBarHeight);
|
||||||
glVertex2f(fPosX + fBarWidth * playerHp, fPosY - fBarHeight); // Bas-Droite
|
glVertex2f(itemBackgroundXPos + itemBackgroundWidth * playerHp, hpBarYPos - hpBarHeight);
|
||||||
glVertex2f(fPosX + fBarWidth * playerHp, fPosY); // Haut-Droite
|
glVertex2f(itemBackgroundXPos + itemBackgroundWidth * playerHp, hpBarYPos);
|
||||||
glVertex2f(fPosX, fPosY); // Haut-Gauche
|
glVertex2f(itemBackgroundXPos, hpBarYPos);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
// Barre <20>quip
|
// Equip Bar
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glColor3f(1.0f * facteurOmbrage, 1.0f * facteurOmbrage, 1.0f * facteurOmbrage);
|
glColor3f(1.0f * facteurOmbrage, 1.0f * facteurOmbrage, 1.0f * facteurOmbrage);
|
||||||
|
|
||||||
|
float equipWidthProportion = 0.8f;
|
||||||
|
float equipHeightProportion = 0.7f;
|
||||||
|
float equipWidth = itemBackgroundWidth * equipWidthProportion;
|
||||||
|
float equipHeight = itemBackgroundHeight * equipHeightProportion;
|
||||||
|
float equipXOffset = itemBackgroundXPos + (itemBackgroundWidth - equipWidth) * 0.1f;
|
||||||
|
float equipYOffset = itemBackgroundYPos + (itemBackgroundHeight - equipHeight) * 0.75f;
|
||||||
|
|
||||||
|
glTranslatef(equipXOffset, equipYOffset, 0);
|
||||||
|
|
||||||
m_textureGun.Bind();
|
m_textureGun.Bind();
|
||||||
|
|
||||||
float margin = Width() * 0.05;
|
|
||||||
float itemWidth = Width() * 0.33;
|
|
||||||
float itemHeight = itemWidth / 2.208;
|
|
||||||
float startX = Width() - itemWidth - margin;
|
|
||||||
float startY = margin;
|
|
||||||
|
|
||||||
glTranslated(startX, startY, 0);
|
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(1, 0); glVertex2i(0, 0);
|
glTexCoord2f(0, 0); glVertex2f(0, 0);
|
||||||
glTexCoord2f(0, 0); glVertex2i(itemWidth, 0);
|
glTexCoord2f(1, 0); glVertex2f(equipWidth, 0);
|
||||||
glTexCoord2f(0, 1); glVertex2i(itemWidth, itemHeight);
|
glTexCoord2f(1, 1); glVertex2f(equipWidth, equipHeight);
|
||||||
glTexCoord2f(1, 1); glVertex2i(0, itemHeight);
|
glTexCoord2f(0, 1); glVertex2f(0, equipHeight);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
//glDisable(GL_BLEND);
|
|
||||||
|
|
||||||
// Username
|
// Username
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
|
|
||||||
glColor3f(1.0f, 1.0f, 1.0f);
|
glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
float scale = GetScale();
|
|
||||||
m_textureFont.Bind();
|
m_textureFont.Bind();
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << m_player.GetUsername();
|
float fUsernamePosY = hpBarYPos - (hpBarHeight * 2);
|
||||||
PrintText(fPosX, fPosY, scale, ss.str());
|
|
||||||
|
|
||||||
//Countdown
|
ss.str("");
|
||||||
|
ss << m_player.GetUsername();
|
||||||
|
PrintText(itemBackgroundXPos, fUsernamePosY, ss.str(), 1.5f);
|
||||||
|
|
||||||
|
ss.str("");
|
||||||
|
ss << m_player.GetHP() * 100 << "%";
|
||||||
|
PrintText(itemBackgroundXPos * 5.25f, fUsernamePosY, ss.str(), 1.5f);
|
||||||
|
|
||||||
|
float countdownXOffset = Width() * 0.2f;
|
||||||
|
float countdownYOffset = Height() * 0.1f;
|
||||||
|
float countdownXPos = Width() - countdownXOffset;
|
||||||
|
float countdownYPos = Height() - countdownYOffset;
|
||||||
|
|
||||||
|
// Countdown
|
||||||
ss.str("");
|
ss.str("");
|
||||||
ss << "Time: " << (int)(timer / 60) << ":" << std::setw(2) << std::setfill('0') << timer % 60;
|
ss << "Time: " << (int)(timer / 60) << ":" << std::setw(2) << std::setfill('0') << timer % 60;
|
||||||
PrintText(Width() - Width() * 0.15, Height() - (Height() / 19.2), scale, ss.str());
|
PrintText(countdownXPos, countdownYPos, ss.str(), 2.0f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::DisplayInfo(float elapsedTime, BlockType bloc) {
|
void Engine::DisplayInfo(float elapsedTime, BlockType bloc) {
|
||||||
// Bind de la texture pour le font
|
|
||||||
m_textureFont.Bind();
|
m_textureFont.Bind();
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
|
|
||||||
float scale = GetScale();
|
float marginX = Width() * 0.01;
|
||||||
unsigned int x = Width() / 25;
|
float marginY = Height() * 0.05;
|
||||||
|
|
||||||
|
float fPosX = marginX;
|
||||||
|
float fPosY = Height() - marginY;
|
||||||
|
|
||||||
|
float charSize = 20 + (24 - 20) * (Width() - 1600) / (1920 - 1600);
|
||||||
|
|
||||||
ss << " Fps : " << GetFps(elapsedTime);
|
ss << " Fps : " << GetFps(elapsedTime);
|
||||||
PrintText(x, Height() - (Height() / 19.2), scale, ss.str());
|
PrintText(fPosX, fPosY, ss.str());
|
||||||
ss.str("");
|
ss.str("");
|
||||||
|
fPosY -= charSize;
|
||||||
|
|
||||||
ss << " Rendered Chunks : " << m_renderCount;
|
ss << " Rendered Chunks : " << m_renderCount;
|
||||||
PrintText(x, Height() - (Height() / 13.7), scale, ss.str());
|
PrintText(fPosX, fPosY, ss.str());
|
||||||
ss.str("");
|
ss.str("");
|
||||||
|
fPosY -= charSize;
|
||||||
|
|
||||||
ss << " To-Be-Deleted Chunks : " << m_world.GettbDeleted();
|
ss << " To-Be-Deleted Chunks : " << m_world.GettbDeleted();
|
||||||
PrintText(x, Height() - (Height() / 10.7), scale, ss.str());
|
PrintText(fPosX, fPosY, ss.str());
|
||||||
ss.str("");
|
ss.str("");
|
||||||
ss << " Velocity : " << m_player.GetVelocity(); // IMPORTANT : on utilise l <20> operateur << pour afficher la position
|
fPosY -= charSize;
|
||||||
PrintText(x, Height() / 48, scale, ss.str());
|
|
||||||
|
float fPosYJump = Height() * 0.09;
|
||||||
|
fPosY = fPosYJump;
|
||||||
|
fPosY -= charSize;
|
||||||
|
|
||||||
|
ss << " Velocity : " << m_player.GetVelocity();
|
||||||
|
PrintText(fPosX, fPosY, ss.str());
|
||||||
ss.str("");
|
ss.str("");
|
||||||
|
fPosY -= charSize;
|
||||||
|
|
||||||
ss << " Direction : " << m_player.GetDirection();
|
ss << " Direction : " << m_player.GetDirection();
|
||||||
PrintText(x, Height() / 24, scale, ss.str());
|
PrintText(fPosX, fPosY, ss.str());
|
||||||
ss.str("");
|
ss.str("");
|
||||||
|
fPosY -= charSize;
|
||||||
|
|
||||||
ss << " Position : " << m_player.GetPosition();
|
ss << " Position : " << m_player.GetPosition();
|
||||||
PrintText(x, Height() / 16, scale, ss.str());
|
PrintText(fPosX, fPosY, ss.str());
|
||||||
ss.str("");
|
ss.str("");
|
||||||
|
fPosY -= charSize;
|
||||||
|
|
||||||
ss << " Block : ";
|
ss << " Block : ";
|
||||||
|
|
||||||
if (bloc == BTYPE_LAST)
|
if (bloc == BTYPE_LAST)
|
||||||
ss << "Weapon.";
|
ss << "Weapon";
|
||||||
else ss << (int)bloc;
|
else
|
||||||
|
ss << (int)bloc;
|
||||||
|
PrintText(fPosX, fPosYJump, ss.str());
|
||||||
|
}
|
||||||
|
|
||||||
PrintText(x, Height() / 12, scale, ss.str());
|
void Engine::DisplaySingleOrMultiplayerMenu() {
|
||||||
|
GLint viewport[4];
|
||||||
|
glGetIntegerv(GL_VIEWPORT, viewport);
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
|
|
||||||
|
glDisable(GL_STENCIL_TEST);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
|
||||||
|
glLoadIdentity();
|
||||||
|
glOrtho(0, Width(), 0, Height(), -1, 1);
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
|
||||||
|
// Background
|
||||||
|
m_textureSoloMultiMenu.Bind();
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, 0.0f);
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex2f(Width(), 0.0f);
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex2f(Width(), Height());
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex2f(0.0f, Height());
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
// Title
|
||||||
|
float titleWidthProportion = 0.4f;
|
||||||
|
float titleHeightProportion = 0.4f;
|
||||||
|
float titleWidth = titleWidthProportion * Width();
|
||||||
|
float titleHeight = titleHeightProportion * Height();
|
||||||
|
float offsetTitleXFactor = 0.05f;
|
||||||
|
float offsetTitleYFactor = 0.05f;
|
||||||
|
m_titleX = (Width() - titleWidth) - (offsetTitleXFactor * Width());
|
||||||
|
m_titleY = (Height() - titleHeight) - (offsetTitleYFactor * Height());
|
||||||
|
|
||||||
|
m_textureTitle.Bind();
|
||||||
|
glColor4f(1.0f, 0.5f, 0.0f, 1.0f);
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex2f(m_titleX, m_titleY);
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex2f(m_titleX + titleWidth, m_titleY);
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex2f(m_titleX + titleWidth, m_titleY + titleHeight);
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex2f(m_titleX, m_titleY + titleHeight);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
|
// Single Player and Multiplayer button background quads
|
||||||
|
float buttonWidthProportion = 0.4f;
|
||||||
|
float buttonHeightProportion = 0.075f;
|
||||||
|
float buttonWidth = buttonWidthProportion * Width();
|
||||||
|
float buttonHeight = buttonHeightProportion * Height();
|
||||||
|
float offsetSingleButtonXFactor = 0.075f;
|
||||||
|
float offsetSingleButtonYFactor = 0.05f;
|
||||||
|
|
||||||
|
float buttonPosX = m_titleX;
|
||||||
|
float buttonSinglePosY = m_titleY - buttonHeight - (offsetSingleButtonYFactor * Height());
|
||||||
|
float buttonMultiPosY = (buttonSinglePosY * 0.75);
|
||||||
|
|
||||||
|
// Single Player background
|
||||||
|
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex2f(buttonPosX, buttonSinglePosY);
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex2f(buttonPosX + buttonWidth, buttonSinglePosY);
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex2f(buttonPosX + buttonWidth, buttonSinglePosY + buttonHeight);
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex2f(buttonPosX, buttonSinglePosY + buttonHeight);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
// Single Player text
|
||||||
|
m_textureSoloText.Bind();
|
||||||
|
glColor4f(0.75f, 0.05f, 0.0f, 1.0f);
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex2f(buttonPosX, buttonSinglePosY);
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex2f(buttonPosX + buttonWidth, buttonSinglePosY);
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex2f(buttonPosX + buttonWidth, buttonSinglePosY + buttonHeight);
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex2f(buttonPosX, buttonSinglePosY + buttonHeight);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
// Multi Player background
|
||||||
|
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex2f(buttonPosX, buttonMultiPosY);
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex2f(buttonPosX + buttonWidth, buttonMultiPosY);
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex2f(buttonPosX + buttonWidth, buttonMultiPosY + buttonHeight);
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex2f(buttonPosX, buttonMultiPosY + buttonHeight);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
// Multi Player text
|
||||||
|
m_textureMultiText.Bind();
|
||||||
|
glColor4f(0.75f, 0.05f, 0.0f, 1.0f);
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex2f(buttonPosX, buttonMultiPosY);
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex2f(buttonPosX + buttonWidth, buttonMultiPosY);
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex2f(buttonPosX + buttonWidth, buttonMultiPosY + buttonHeight);
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex2f(buttonPosX, buttonMultiPosY + buttonHeight);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
|
// Reset the state
|
||||||
|
glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
|
||||||
|
|
||||||
|
glEnable(GL_STENCIL_TEST);
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
|
ShowCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
||||||
@@ -621,7 +842,6 @@ void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
|||||||
|
|
||||||
int timer = GetCountdown(elapsedTime);
|
int timer = GetCountdown(elapsedTime);
|
||||||
|
|
||||||
// Appel de la fonction pour l'affichage de notifications
|
|
||||||
if (m_keyK) {
|
if (m_keyK) {
|
||||||
SystemNotification(m_messageNotification);
|
SystemNotification(m_messageNotification);
|
||||||
m_keyK = false;
|
m_keyK = false;
|
||||||
@@ -644,7 +864,6 @@ void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
|||||||
DisplayCrosshair();
|
DisplayCrosshair();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset du blend function
|
|
||||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
||||||
glBlendEquation(GL_FUNC_SUBTRACT);
|
glBlendEquation(GL_FUNC_SUBTRACT);
|
||||||
|
|
||||||
@@ -658,33 +877,35 @@ void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
|||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::PrintText(float x, float y, float scale, const std::string& t) {
|
void Engine::PrintText(float x, float y, const std::string& t, float charSizeMultiplier) {
|
||||||
|
float windowWidth = static_cast<float>(Width());
|
||||||
|
float windowHeight = static_cast<float>(Height());
|
||||||
|
|
||||||
|
float posX = x * windowWidth;
|
||||||
|
float posY = y * windowHeight;
|
||||||
|
|
||||||
|
float baseCharSize = 20 + (24 - 20) * (windowWidth - 1600) / (1920 - 1600);
|
||||||
|
float charSize = baseCharSize * charSizeMultiplier;
|
||||||
|
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glTranslated(x, y, 0);
|
glTranslated(x, y, 0);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < t.length(); ++i) {
|
for (unsigned int i = 0; i < t.length(); ++i) {
|
||||||
float left = (float)((t[i] - 32) % 16) / 16.f;
|
float left = (float)((t[i] - 32) % 16) / 16.f;
|
||||||
float top = (float)((t[i] - 32) / 16) / 16.f;
|
float top = (float)((t[i] - 32) / 16) / 16.f;
|
||||||
top += .5f;
|
top += 0.5f;
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(left, 1.f - top - .0625f); glVertex2f(0, 0);
|
glTexCoord2f(left, 1.f - top - .0625f); glVertex2f(0, 0);
|
||||||
glTexCoord2f(left + .0625f, 1.f - top - .0625f); glVertex2f(12 * scale, 0);
|
glTexCoord2f(left + .0625f, 1.f - top - .0625f); glVertex2f(charSize, 0);
|
||||||
glTexCoord2f(left + .0625f, 1.f - top); glVertex2f(12 * scale, 12 * scale);
|
glTexCoord2f(left + .0625f, 1.f - top); glVertex2f(charSize, charSize);
|
||||||
glTexCoord2f(left, 1.f - top); glVertex2f(0, 12 * scale);
|
glTexCoord2f(left, 1.f - top); glVertex2f(0, charSize);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glTranslated(8 * scale, 0, 0);
|
glTranslated(0.5555f * charSize, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float Engine::GetScale() const {
|
|
||||||
float widthRatio = Width() / BASE_WIDTH;
|
|
||||||
float heightRatio = Height() / BASE_HEIGHT;
|
|
||||||
|
|
||||||
return (widthRatio + heightRatio) / 2.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Engine::GetFps(float elapsedTime) const { return 1 / elapsedTime; }
|
int Engine::GetFps(float elapsedTime) const { return 1 / elapsedTime; }
|
||||||
int Engine::GetCountdown(float elapsedTime) {
|
int Engine::GetCountdown(float elapsedTime) {
|
||||||
if (m_resetcountdown)
|
if (m_resetcountdown)
|
||||||
@@ -694,7 +915,7 @@ int Engine::GetCountdown(float elapsedTime) {
|
|||||||
}
|
}
|
||||||
if (m_countdown < m_time)
|
if (m_countdown < m_time)
|
||||||
Stop();
|
Stop();
|
||||||
if(!m_stopcountdown)
|
if (!m_stopcountdown)
|
||||||
m_time += elapsedTime;
|
m_time += elapsedTime;
|
||||||
return m_countdown - (int)m_time;
|
return m_countdown - (int)m_time;
|
||||||
}
|
}
|
||||||
@@ -703,8 +924,9 @@ void Engine::Render(float elapsedTime) {
|
|||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
|
|
||||||
m_time_SplashScreen += elapsedTime;
|
m_time_SplashScreen += elapsedTime;
|
||||||
if(m_time_SplashScreen < 2)
|
if (m_time_SplashScreen < 2) {
|
||||||
DrawSplachScreen();
|
DrawSplachScreen();
|
||||||
|
}
|
||||||
else if (m_gamestate == GameState::PLAY)
|
else if (m_gamestate == GameState::PLAY)
|
||||||
{
|
{
|
||||||
HideCursor();
|
HideCursor();
|
||||||
@@ -806,8 +1028,9 @@ void Engine::Render(float elapsedTime) {
|
|||||||
|
|
||||||
if (m_isSkybox) m_skybox.Render(skybox);
|
if (m_isSkybox) m_skybox.Render(skybox);
|
||||||
|
|
||||||
ProcessNotificationQueue();
|
|
||||||
DrawHud(elapsedTime, bloc);
|
DrawHud(elapsedTime, bloc);
|
||||||
|
DisplayPovGun();
|
||||||
|
ProcessNotificationQueue();
|
||||||
|
|
||||||
static bool fell = false;
|
static bool fell = false;
|
||||||
if (m_player.GetPosition().y < 1.7f && !fell) {
|
if (m_player.GetPosition().y < 1.7f && !fell) {
|
||||||
@@ -822,7 +1045,12 @@ void Engine::Render(float elapsedTime) {
|
|||||||
}
|
}
|
||||||
else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS)
|
else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS)
|
||||||
{
|
{
|
||||||
DrawMenu();
|
if (!m_soloMultiChoiceMade) {
|
||||||
|
DisplaySingleOrMultiplayerMenu();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DrawMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (m_gamestate == GameState::QUIT)
|
else if (m_gamestate == GameState::QUIT)
|
||||||
Stop();
|
Stop();
|
||||||
@@ -1016,6 +1244,37 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
|
|||||||
if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 300 && m_mousemy <= 400))
|
if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 300 && m_mousemy <= 400))
|
||||||
m_gamestate = GameState::QUIT;
|
m_gamestate = GameState::QUIT;
|
||||||
}
|
}
|
||||||
|
else if (m_gamestate == GameState::OPTIONS)
|
||||||
|
{
|
||||||
|
float buttonWidthProportion = 0.4f;
|
||||||
|
float buttonHeightProportion = 0.075f;
|
||||||
|
float buttonWidth = buttonWidthProportion * Width();
|
||||||
|
float buttonHeight = buttonHeightProportion * Height();
|
||||||
|
float offsetSingleButtonXFactor = 0.075f;
|
||||||
|
float offsetSingleButtonYFactor = 0.05f;
|
||||||
|
|
||||||
|
float buttonPosX = m_titleX;
|
||||||
|
float buttonSinglePosY = m_titleY - buttonHeight - (offsetSingleButtonYFactor * Height());
|
||||||
|
float buttonMultiPosY = buttonSinglePosY * 0.75;
|
||||||
|
float adjustedMouseY = Height() - m_mousemy;
|
||||||
|
|
||||||
|
// Single Player
|
||||||
|
if (m_mousemx >= buttonPosX && m_mousemx <= (buttonPosX + buttonWidth) &&
|
||||||
|
adjustedMouseY >= buttonSinglePosY && adjustedMouseY <= (buttonSinglePosY + buttonHeight))
|
||||||
|
{
|
||||||
|
std::cout << "Single Player button clicked" << std::endl;
|
||||||
|
m_soloMultiChoiceMade = true;
|
||||||
|
m_gamestate = GameState::PLAY;
|
||||||
|
}
|
||||||
|
// Multiplayer
|
||||||
|
else if (m_mousemx >= buttonPosX && m_mousemx <= (buttonPosX + buttonWidth) &&
|
||||||
|
adjustedMouseY >= buttonMultiPosY && adjustedMouseY <= (buttonMultiPosY + buttonHeight))
|
||||||
|
{
|
||||||
|
std::cout << "Multiplayer button clicked" << std::endl;
|
||||||
|
m_soloMultiChoiceMade = true;
|
||||||
|
m_gamestate = GameState::PLAY;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::MouseReleaseEvent(const MOUSE_BUTTON& button, int x, int y) {
|
void Engine::MouseReleaseEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||||
|
@@ -38,8 +38,6 @@ public:
|
|||||||
virtual void MouseReleaseEvent(const MOUSE_BUTTON &button, int x, int y);
|
virtual void MouseReleaseEvent(const MOUSE_BUTTON &button, int x, int y);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float GetScale() const;
|
|
||||||
|
|
||||||
int GetFps(float elapsedTime) const;
|
int GetFps(float elapsedTime) const;
|
||||||
int GetCountdown(float elapsedTime);
|
int GetCountdown(float elapsedTime);
|
||||||
|
|
||||||
@@ -50,11 +48,13 @@ private:
|
|||||||
void DisplayNotification(std::string message);
|
void DisplayNotification(std::string message);
|
||||||
void ProcessNotificationQueue();
|
void ProcessNotificationQueue();
|
||||||
void DisplayCrosshair();
|
void DisplayCrosshair();
|
||||||
|
void DisplayPovGun();
|
||||||
void DisplayCurrentItem();
|
void DisplayCurrentItem();
|
||||||
void DisplayHud(int timer);
|
void DisplayHud(int timer);
|
||||||
void DisplayInfo(float elapsedTime, BlockType bloc);
|
void DisplayInfo(float elapsedTime, BlockType bloc);
|
||||||
|
void DisplaySingleOrMultiplayerMenu();
|
||||||
void DrawHud(float elapsedTime, BlockType bloc);
|
void DrawHud(float elapsedTime, BlockType bloc);
|
||||||
void PrintText(float x, float y, float scale, const std::string& t);
|
void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f);
|
||||||
|
|
||||||
Connector m_conn;
|
Connector m_conn;
|
||||||
Shader m_shader01;
|
Shader m_shader01;
|
||||||
@@ -64,10 +64,15 @@ private:
|
|||||||
World m_world = World();
|
World m_world = World();
|
||||||
WorldRenderer m_wrenderer = WorldRenderer();
|
WorldRenderer m_wrenderer = WorldRenderer();
|
||||||
|
|
||||||
Texture m_textureSkybox;
|
|
||||||
Texture m_textureFont;
|
|
||||||
Texture m_textureCrosshair;
|
Texture m_textureCrosshair;
|
||||||
|
Texture m_textureFont;
|
||||||
Texture m_textureGun;
|
Texture m_textureGun;
|
||||||
|
Texture m_texturePovGun;
|
||||||
|
Texture m_textureSkybox;
|
||||||
|
Texture m_textureSoloMultiMenu;
|
||||||
|
Texture m_textureSoloText;
|
||||||
|
Texture m_textureMultiText;
|
||||||
|
Texture m_textureTitle;
|
||||||
|
|
||||||
Skybox m_skybox;
|
Skybox m_skybox;
|
||||||
Audio m_audio = Audio(AUDIO_PATH "start.wav");
|
Audio m_audio = Audio(AUDIO_PATH "start.wav");
|
||||||
@@ -93,6 +98,8 @@ private:
|
|||||||
float m_scale;
|
float m_scale;
|
||||||
float m_time = 0;
|
float m_time = 0;
|
||||||
float m_time_SplashScreen = 0;
|
float m_time_SplashScreen = 0;
|
||||||
|
float m_titleX = 0;
|
||||||
|
float m_titleY = 0;
|
||||||
float m_Width = 0;
|
float m_Width = 0;
|
||||||
float m_Height = 0;
|
float m_Height = 0;
|
||||||
|
|
||||||
@@ -107,6 +114,7 @@ private:
|
|||||||
bool m_displayHud = true;
|
bool m_displayHud = true;
|
||||||
bool m_displayInfo = false;
|
bool m_displayInfo = false;
|
||||||
bool m_resetcountdown = false;
|
bool m_resetcountdown = false;
|
||||||
|
bool m_soloMultiChoiceMade = false;
|
||||||
bool m_stopcountdown = false;
|
bool m_stopcountdown = false;
|
||||||
|
|
||||||
bool m_keyK = false;
|
bool m_keyK = false;
|
||||||
|
BIN
SQCSim2021/media/textures/BrouillonbackgroundMenu.png
Normal file
BIN
SQCSim2021/media/textures/BrouillonbackgroundMenu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 MiB |
BIN
SQCSim2021/media/textures/multi_player.png
Normal file
BIN
SQCSim2021/media/textures/multi_player.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
SQCSim2021/media/textures/single_multi.png
Normal file
BIN
SQCSim2021/media/textures/single_multi.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
BIN
SQCSim2021/media/textures/single_player.png
Normal file
BIN
SQCSim2021/media/textures/single_player.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
SQCSim2021/media/textures/skybox2.png
Normal file
BIN
SQCSim2021/media/textures/skybox2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 MiB |
BIN
SQCSim2021/media/textures/title.png
Normal file
BIN
SQCSim2021/media/textures/title.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
@@ -9,7 +9,7 @@ Mesh::~Mesh() {
|
|||||||
void Mesh::FlushMeshToVBO() {
|
void Mesh::FlushMeshToVBO() {
|
||||||
m_vertexBuffer.SetMeshData(m_vd, m_vcount);
|
m_vertexBuffer.SetMeshData(m_vd, m_vcount);
|
||||||
m_vcount = 0;
|
m_vcount = 0;
|
||||||
delete[] m_vd;
|
//delete[] m_vd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::FlushVBO() {
|
void Mesh::FlushVBO() {
|
||||||
|
@@ -8,30 +8,30 @@ void Skybox::Init(float size){
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
VertexBuffer::VertexData* vd = new VertexBuffer::VertexData[24];
|
VertexBuffer::VertexData* vd = new VertexBuffer::VertexData[24];
|
||||||
|
|
||||||
vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, 0.f, .5f);
|
|
||||||
vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .25f, .5f);
|
vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .25f, .5f);
|
||||||
vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f);
|
vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f);
|
||||||
vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, 0.f, .75f);
|
vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, 0.f, .75f);
|
||||||
|
vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, 0.f, .5f);
|
||||||
|
|
||||||
vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .25f, .5f);
|
|
||||||
vd[count++] = VertexBuffer::VertexData(-size, -size, -size, 1.f, 1.f, 1.f, .5f, .5f);
|
vd[count++] = VertexBuffer::VertexData(-size, -size, -size, 1.f, 1.f, 1.f, .5f, .5f);
|
||||||
vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f);
|
vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f);
|
||||||
vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f);
|
vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f);
|
||||||
|
vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .25f, .5f);
|
||||||
|
|
||||||
vd[count++] = VertexBuffer::VertexData(-size, -size, -size, 1.f, 1.f, 1.f, .5f, .5f);
|
|
||||||
vd[count++] = VertexBuffer::VertexData(size, -size, -size, 1.f, 1.f, 1.f, .75f, .5f);
|
vd[count++] = VertexBuffer::VertexData(size, -size, -size, 1.f, 1.f, 1.f, .75f, .5f);
|
||||||
vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .75f, .75f);
|
vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .75f, .75f);
|
||||||
vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f);
|
vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f);
|
||||||
|
vd[count++] = VertexBuffer::VertexData(-size, -size, -size, 1.f, 1.f, 1.f, .5f, .5f);
|
||||||
|
|
||||||
vd[count++] = VertexBuffer::VertexData(size, -size, -size, 1.f, 1.f, 1.f, .75f, .5f);
|
|
||||||
vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, 1.f, .5f);
|
vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, 1.f, .5f);
|
||||||
vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, 1.f, .75f);
|
vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, 1.f, .75f);
|
||||||
vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .75f, .75f);
|
vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .75f, .75f);
|
||||||
|
vd[count++] = VertexBuffer::VertexData(size, -size, -size, 1.f, 1.f, 1.f, .75f, .5f);
|
||||||
|
|
||||||
vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .25f, 1.f);
|
vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, .25f, 1.f);
|
||||||
vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, .5f, 1.f);
|
vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f);
|
||||||
vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .5f, .75f);
|
vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f);
|
||||||
vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .25f, .75f);
|
vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .5f, 1.f);
|
||||||
|
|
||||||
vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .5f, .25f);
|
vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .5f, .25f);
|
||||||
vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, .75f, .25f);
|
vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, .75f, .25f);
|
||||||
|
Reference in New Issue
Block a user