afegides les normes de les guidelines jailerianes
This commit is contained in:
+16
-8
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user