#include "logo.h" #include "screen.h" #include "mouse.h" #include "surface.h" #include "s_sprite.h" Logo::Logo() { init(); } Logo::~Logo() { close(); } void Logo::init() { Screen::get()->init(); logo_surface = std::make_shared("jailgames.gif"); logo_sprite = std::make_unique(logo_surface); logo_sprite->setPosition( (options.game.width - logo_sprite->getWidth()) / 2, (options.game.height- logo_sprite->getHeight()) / 2); SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Logo start"); } void Logo::close() { Screen::get()->destroy(); SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\nBye!"); SDL_Quit(); } void Logo::checkEvents() { SDL_Event event; while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_EVENT_QUIT: running = false; return; } Mouse::handleEvent(event); } } void Logo::update() { if (SDL_GetTicks() - ticks > options.game.speed) { ticks = SDL_GetTicks(); } } void Logo::render() { Screen::get()->start(); logo_sprite->render(); Screen::get()->render(); } int Logo::run() { while (running) { update(); checkEvents(); render(); } return 0; }