-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
42 lines (36 loc) · 863 Bytes
/
main.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
39
40
41
42
#include <window.hpp>
#include <iostream>
#include <gameview.hpp>
#include "iview.hpp"
#include "gamemodel.hpp"
#include "menuview.hpp"
class Game : public stf::Window
{
public:
GameModel gameModel = GameModel();
MenuView menuView = MenuView(&gameModel);
stf::smv::IView *currentView = &menuView;
Game()
{
enableLog();
stf::Renderer::log.setHeight(20);
stf::Renderer::log.setX(renderer.Size.x - 15);
}
bool onUpdate(const float) final
{
currentView->show(renderer);
return currentView->isContinue();
}
void keyEvents(const int key) final
{
currentView = currentView->keyEventsHandler(key);
}
void mouseEvents(const stf::MouseRecord& mr) final
{
currentView = currentView->mouseEventsHandler(mr);
}
};
int main()
{
return Game().run();
}