On l'a eu!
This commit is contained in:
parent
b712c950c6
commit
a054a7bff1
@ -20,8 +20,8 @@
|
|||||||
#define SRV_ADDR "127.0.0.1"
|
#define SRV_ADDR "127.0.0.1"
|
||||||
#define COUNTDOWN 300
|
#define COUNTDOWN 300
|
||||||
|
|
||||||
#define BASE_WIDTH 1920
|
#define BASE_WIDTH 640
|
||||||
#define BASE_HEIGHT 1080
|
#define BASE_HEIGHT 480
|
||||||
|
|
||||||
#define TEXTURE_PATH "./media/textures/"
|
#define TEXTURE_PATH "./media/textures/"
|
||||||
#define SHADER_PATH "./media/shaders/"
|
#define SHADER_PATH "./media/shaders/"
|
||||||
|
@ -34,10 +34,10 @@ void Engine::DrawMenu()
|
|||||||
static const int sButton = 225;
|
static const int sButton = 225;
|
||||||
|
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDisable(GL_STENCIL_TEST);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
@ -58,6 +58,9 @@ void Engine::DrawMenu()
|
|||||||
glVertex2i(0, 600);
|
glVertex2i(0, 600);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
if (m_gamestate != GameState::OPTIONS)
|
if (m_gamestate != GameState::OPTIONS)
|
||||||
{
|
{
|
||||||
@ -209,7 +212,7 @@ void Engine::DrawMenu()
|
|||||||
glEnd();*/
|
glEnd();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable(GL_LIGHTING);
|
//glEnable(GL_LIGHTING);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
@ -220,7 +223,6 @@ void Engine::DrawMenu()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Engine::Init() {
|
void Engine::Init() {
|
||||||
m_gamestate = GameState::MAIN_MENU;
|
|
||||||
GLenum glewErr = glewInit();
|
GLenum glewErr = glewInit();
|
||||||
if (glewErr != GLEW_OK) {
|
if (glewErr != GLEW_OK) {
|
||||||
std::cerr << " ERREUR GLEW : " << glewGetErrorString(glewErr) << std::endl;
|
std::cerr << " ERREUR GLEW : " << glewGetErrorString(glewErr) << std::endl;
|
||||||
@ -245,6 +247,7 @@ void Engine::Init() {
|
|||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glBlendEquation(GL_FUNC_SUBTRACT);
|
glBlendEquation(GL_FUNC_SUBTRACT);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Objet de skybox avec sa propre texture et son propre shader!
|
// Objet de skybox avec sa propre texture et son propre shader!
|
||||||
m_skybox.Init(0.2f);
|
m_skybox.Init(0.2f);
|
||||||
@ -287,7 +290,7 @@ 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", false);
|
LoadTexture(m_textureGun, TEXTURE_PATH "gun01.png", true);
|
||||||
|
|
||||||
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");
|
||||||
@ -385,8 +388,6 @@ void Engine::ProcessNotificationQueue() {
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PrintText(xOffset, y, scale, it->message);
|
PrintText(xOffset, y, scale, it->message);
|
||||||
|
|
||||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
||||||
@ -433,6 +434,7 @@ void Engine::DisplayCrosshair() {
|
|||||||
void Engine::DisplayCurrentItem() {
|
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();
|
||||||
@ -487,7 +489,7 @@ void Engine::DisplayHud(int timer) {
|
|||||||
glTexCoord2f(1, 1); glVertex2i(0, itemHeight);
|
glTexCoord2f(1, 1); glVertex2i(0, itemHeight);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
//glDisable(GL_BLEND);
|
||||||
|
|
||||||
// Username
|
// Username
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
@ -549,6 +551,7 @@ void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
|||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
glBlendEquation(GL_FUNC_ADD);
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
@ -644,6 +647,7 @@ void Engine::Render(float elapsedTime) {
|
|||||||
|
|
||||||
if (m_gamestate == GameState::PLAY)
|
if (m_gamestate == GameState::PLAY)
|
||||||
{
|
{
|
||||||
|
HideCursor();
|
||||||
CenterMouse(); //D<>placement de centermouse dans l'action de jouer
|
CenterMouse(); //D<>placement de centermouse dans l'action de jouer
|
||||||
|
|
||||||
//static float gameTime = elapsedTime;
|
//static float gameTime = elapsedTime;
|
||||||
@ -752,6 +756,13 @@ void Engine::Render(float elapsedTime) {
|
|||||||
fell = false;
|
fell = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS)
|
||||||
|
{
|
||||||
|
DrawMenu();
|
||||||
|
}
|
||||||
|
else if (m_gamestate == GameState::QUIT)
|
||||||
|
Stop();
|
||||||
|
}
|
||||||
|
|
||||||
void Engine::KeyPressEvent(unsigned char key) {
|
void Engine::KeyPressEvent(unsigned char key) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
@ -776,7 +787,8 @@ void Engine::KeyPressEvent(unsigned char key) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 36: // ESC - Quitter
|
case 36: // ESC - Quitter
|
||||||
Stop();
|
m_gamestate = GameState::MAIN_MENU;
|
||||||
|
//Stop();
|
||||||
break;
|
break;
|
||||||
case 57: // Space - Sauter
|
case 57: // Space - Sauter
|
||||||
if (!m_keySpace) {
|
if (!m_keySpace) {
|
||||||
|
@ -80,7 +80,7 @@ private:
|
|||||||
|
|
||||||
//Menu
|
//Menu
|
||||||
enum class GameState { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY };
|
enum class GameState { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY };
|
||||||
GameState m_gamestate;
|
GameState m_gamestate = GameState::MAIN_MENU;
|
||||||
Texture MenuTitleTexture;
|
Texture MenuTitleTexture;
|
||||||
Texture MenuBGTexture;
|
Texture MenuBGTexture;
|
||||||
Texture MenuStartTexture;
|
Texture MenuStartTexture;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user