afegides les normes de les guidelines jailerianes

This commit is contained in:
2025-04-07 12:42:24 +02:00
parent 0e2dff6647
commit 502ba7297a
6 changed files with 146 additions and 38 deletions
+16 -8
View File
@@ -4,26 +4,31 @@
#include "mouse.h"
#include "surface.h"
#include "s_sprite.h"
#include "global_inputs.h"
Logo::Logo()
{
init();
init();
}
Logo::~Logo()
{
close();
close();
}
void Logo::init()
{
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
SDL_SetLogPriority(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR);
Screen::get()->init();
logo_surface = std::make_shared<Surface>("jailgames.gif");
logo_surface->scale(5);
logo_sprite = std::make_unique<SSprite>(logo_surface);
logo_sprite->setPosition(
(options.game.width - logo_sprite->getWidth()) / 2,
(options.game.height- logo_sprite->getHeight()) / 2);
(options.logo.width - logo_sprite->getWidth()) / 2,
(options.logo.height - logo_sprite->getHeight()) / 2);
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Logo start");
}
@@ -44,19 +49,22 @@ void Logo::checkEvents()
switch (event.type)
{
case SDL_EVENT_QUIT:
running = false;
options.logo.running = false;
return;
}
globalInputs::check(event);
Mouse::handleEvent(event);
}
}
void Logo::update()
{
if (SDL_GetTicks() - ticks > options.game.speed)
if (SDL_GetTicks() - ticks > options.logo.speed)
{
ticks = SDL_GetTicks();
Screen::get()->update();
}
}
@@ -69,11 +77,11 @@ void Logo::render()
int Logo::run()
{
while (running)
while (options.logo.running)
{
update();
checkEvents();
render();
}
return 0;
return 0;
}