-
Notifications
You must be signed in to change notification settings - Fork 0
/
Title.cpp
38 lines (34 loc) · 838 Bytes
/
Title.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <string>
#include <SDL.h>
#include "Api.hpp"
#include "Event.hpp"
#include "Object.hpp"
#include "Keyboard.hpp"
#include "Title.hpp"
#include "Dnscript.hpp"
Title::Title(){
Api::create();
api = Api::instance();
keyboard = Keyboard::instance();
obj_back = new Object();
std::string filename("img/title.png");
api->LoadGraphic(obj_back,filename);
api->SetTexture(obj_back,filename);
SDL_Surface* image = obj_back->get_image();
api->SetGraphicRect(obj_back,0,0,image->w,image->h);
}
Title::~Title(){
Api::destroy();
delete obj_back;
}
void Title::update(Dnscript *parent){
if(keyboard->is_keyon(SDLK_SPACE)){
keyboard->keytoggle(SDLK_SPACE);
parent->moveTo(Dnscript::SEQ_STAGE_SELECT);
}
}
void Title::draw(){
api->RenderClear();
api->DrawGraphic(obj_back,0,0);
api->RenderPresent();
}