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 COUNTDOWN 300
|
||||
|
||||
#define BASE_WIDTH 1920
|
||||
#define BASE_HEIGHT 1080
|
||||
#define BASE_WIDTH 640
|
||||
#define BASE_HEIGHT 480
|
||||
|
||||
#define TEXTURE_PATH "./media/textures/"
|
||||
#define SHADER_PATH "./media/shaders/"
|
||||
|
@ -34,10 +34,10 @@ void Engine::DrawMenu()
|
||||
static const int sButton = 225;
|
||||
|
||||
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_STENCIL_TEST);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
@ -58,6 +58,9 @@ void Engine::DrawMenu()
|
||||
glVertex2i(0, 600);
|
||||
glEnd();
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
if (m_gamestate != GameState::OPTIONS)
|
||||
{
|
||||
@ -209,7 +212,7 @@ void Engine::DrawMenu()
|
||||
glEnd();*/
|
||||
}
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
//glEnable(GL_LIGHTING);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
@ -220,7 +223,6 @@ void Engine::DrawMenu()
|
||||
}
|
||||
|
||||
void Engine::Init() {
|
||||
m_gamestate = GameState::MAIN_MENU;
|
||||
GLenum glewErr = glewInit();
|
||||
if (glewErr != GLEW_OK) {
|
||||
std::cerr << " ERREUR GLEW : " << glewGetErrorString(glewErr) << std::endl;
|
||||
@ -245,6 +247,7 @@ void Engine::Init() {
|
||||
glDisable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendEquation(GL_FUNC_SUBTRACT);
|
||||
|
||||
//
|
||||
// Objet de skybox avec sa propre texture et son propre shader!
|
||||
m_skybox.Init(0.2f);
|
||||
@ -287,7 +290,7 @@ void Engine::LoadResource() {
|
||||
LoadTexture(m_skybox.GetTexture(), TEXTURE_PATH "skybox.png", true);
|
||||
LoadTexture(m_textureCrosshair, TEXTURE_PATH "cross.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(MenuBGTexture, MENU_ITEM_PATH "test.png");
|
||||
@ -385,8 +388,6 @@ void Engine::ProcessNotificationQueue() {
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
|
||||
|
||||
|
||||
PrintText(xOffset, y, scale, it->message);
|
||||
|
||||
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
|
||||
@ -433,6 +434,7 @@ void Engine::DisplayCrosshair() {
|
||||
void Engine::DisplayCurrentItem() {
|
||||
}
|
||||
|
||||
|
||||
void Engine::DisplayHud(int timer) {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glLoadIdentity();
|
||||
@ -487,7 +489,7 @@ void Engine::DisplayHud(int timer) {
|
||||
glTexCoord2f(1, 1); glVertex2i(0, itemHeight);
|
||||
glEnd();
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
//glDisable(GL_BLEND);
|
||||
|
||||
// Username
|
||||
glEnable(GL_BLEND);
|
||||
@ -549,6 +551,7 @@ void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
@ -644,6 +647,7 @@ void Engine::Render(float elapsedTime) {
|
||||
|
||||
if (m_gamestate == GameState::PLAY)
|
||||
{
|
||||
HideCursor();
|
||||
CenterMouse(); //D<>placement de centermouse dans l'action de jouer
|
||||
|
||||
//static float gameTime = elapsedTime;
|
||||
@ -751,6 +755,13 @@ void Engine::Render(float elapsedTime) {
|
||||
m_player = Player(Vector3f(.5f, CHUNK_SIZE_Y + 1.8f, .5f)); // Respawn si le bonho- joueur tombe en bas du monde.
|
||||
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) {
|
||||
@ -776,7 +787,8 @@ void Engine::KeyPressEvent(unsigned char key) {
|
||||
}
|
||||
break;
|
||||
case 36: // ESC - Quitter
|
||||
Stop();
|
||||
m_gamestate = GameState::MAIN_MENU;
|
||||
//Stop();
|
||||
break;
|
||||
case 57: // Space - Sauter
|
||||
if (!m_keySpace) {
|
||||
|
@ -80,7 +80,7 @@ private:
|
||||
|
||||
//Menu
|
||||
enum class GameState { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY };
|
||||
GameState m_gamestate;
|
||||
GameState m_gamestate = GameState::MAIN_MENU;
|
||||
Texture MenuTitleTexture;
|
||||
Texture MenuBGTexture;
|
||||
Texture MenuStartTexture;
|
||||
|
Loading…
x
Reference in New Issue
Block a user