Changement dans le splachscreen

This commit is contained in:
Louis-Charles Gaumond
2023-10-23 16:57:19 -04:00
parent f4d4f1eca0
commit f8680a318a
4 changed files with 62 additions and 50 deletions

View File

@@ -9,43 +9,12 @@ OpenglContext::~OpenglContext()
{
}
void OpenglContext::RenderSplashScreen()
{
m_textureSplash.Load(TEXTURE_PATH "sc2.png", true);
if (!m_textureSplash.IsValid()) {
std::cerr << "Unable to load texture sc2.png" << std::endl;
}
m_textureSplash.Bind();
glMatrixMode(GL_PROJECTION);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Utilisez une fonction de m<>lange appropri<72>e
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2i(0, 0);
glTexCoord2f(1, 0);
glVertex2i(BASE_WIDTH, 0);
glTexCoord2f(1, 1);
glVertex2i(BASE_WIDTH, BASE_HEIGHT);
glTexCoord2f(0, 1);
glVertex2i(0, BASE_HEIGHT);
glEnd();
}
bool OpenglContext::Start(const std::string& title, int width, int height, bool fullscreen)
{
m_title = title;
m_fullscreen = fullscreen;
InitWindow(width, height);
bool showSplashScreen = true;
sf::Clock splashClock;
Init();
LoadResource();
@@ -54,21 +23,6 @@ bool OpenglContext::Start(const std::string& title, int width, int height, bool
while (m_app.isOpen())
{
if (showSplashScreen)
{
m_app.setActive();
Render(m_lastFrameTime);
m_app.display();
RenderSplashScreen();
if (splashClock.getElapsedTime().asSeconds() >= 3)
{
showSplashScreen = false;
}
}
else
{
clock.restart();
@@ -122,7 +76,6 @@ bool OpenglContext::Start(const std::string& title, int width, int height, bool
m_lastFrameTime = clock.getElapsedTime().asSeconds();
}
}
}
UnloadResource();