Changement dans le splachscreen
This commit is contained in:
@@ -28,6 +28,56 @@ Engine::~Engine() {
|
||||
m_world.GetChunks().Get(x, y)->~Chunk();
|
||||
}
|
||||
|
||||
void Engine::DrawSplachScreen()
|
||||
{
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
|
||||
// Définir la matrice de projection en mode orthographique
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(-Width() / 2, Width() / 2, -Height() / 2, Height() / 2, -1, 1);
|
||||
|
||||
// Définir la matrice de modèle-vue
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
// L'image sera centrée autour de l'origine (0, 0, 0)
|
||||
int imageWidth = Width(); // Remplacez par la largeur de votre image
|
||||
int imageHeight = Height(); // Remplacez par la hauteur de votre image
|
||||
|
||||
// Texture
|
||||
SplachScreenTexture.Bind();
|
||||
|
||||
// Dessiner un quadrilatère centré
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(-imageWidth / 2, -imageHeight / 2);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2i(imageWidth / 2, -imageHeight / 2);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2i(imageWidth / 2, imageHeight / 2);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2i(-imageWidth / 2, imageHeight / 2);
|
||||
glEnd();
|
||||
|
||||
// Activer la transparence
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
// Restaurer les matrices précédentes
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Engine::DrawMenu()
|
||||
{
|
||||
static const int sTitle = 400;
|
||||
@@ -223,6 +273,8 @@ void Engine::DrawMenu()
|
||||
}
|
||||
|
||||
void Engine::Init() {
|
||||
|
||||
|
||||
GLenum glewErr = glewInit();
|
||||
if (glewErr != GLEW_OK) {
|
||||
std::cerr << " ERREUR GLEW : " << glewGetErrorString(glewErr) << std::endl;
|
||||
@@ -298,6 +350,7 @@ void Engine::LoadResource() {
|
||||
|
||||
LoadTexture(MenuTitleTexture, MENU_ITEM_PATH "test.png");
|
||||
LoadTexture(MenuBGTexture, MENU_ITEM_PATH "test.png");
|
||||
LoadTexture(SplachScreenTexture, TEXTURE_PATH "sc2.png");
|
||||
LoadTexture(MenuQuitTexture, MENU_ITEM_PATH "BasicQuit.png");
|
||||
LoadTexture(MenuOptionsTexture, MENU_ITEM_PATH "test.png");
|
||||
LoadTexture(MenuStartTexture, MENU_ITEM_PATH "BasicPlay.png");
|
||||
@@ -649,7 +702,10 @@ int Engine::GetCountdown(float elapsedTime) {
|
||||
void Engine::Render(float elapsedTime) {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
if (m_gamestate == GameState::PLAY)
|
||||
m_time_SplashScreen += elapsedTime;
|
||||
if(m_time_SplashScreen < 2)
|
||||
DrawSplachScreen();
|
||||
else if (m_gamestate == GameState::PLAY)
|
||||
{
|
||||
HideCursor();
|
||||
CenterMouse(); //D<>placement de centermouse dans l'action de jouer
|
||||
|
Reference in New Issue
Block a user