-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
59 lines (47 loc) · 1.32 KB
/
main.cpp
File metadata and controls
59 lines (47 loc) · 1.32 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
#include <string>
#include <iview.hpp>
#include "window.hpp"
#include "gamemodel.hpp"
#include "menuview.hpp"
class Game : public stf::Window
{
GameModel mGameModel;
MenuView mView = MenuView(&mGameModel);
stf::smv::IView *mCurrentView = &mView;
public:
Game()
{
// enableLog();
// stf::Renderer::log.setX(0);
// stf::Renderer::log.setY(14);
// stf::Renderer::log.setHeight(14);
}
~Game()
{
// delete mModel;
}
bool onUpdate(const float dt) override
{
mCurrentView = mCurrentView->update(dt);
mCurrentView->show(renderer);
return mCurrentView->isContinue();
}
void keyEvents(const int key) override
{
mCurrentView = mCurrentView->keyEventsHandler(key);
}
void mouseEvents(const stf::MouseRecord &mr) override
{
}
};
int main()
{
// srand(clock());
int result = Game().run();
printf("Empty NEW/DEL : [%lld] [%lld]\n", Cell::mECellNewCount, Cell::mECellDelCount);
printf("Cell NEW/DEL : [%lld] [%lld]\n", Cell::mCellNewCount, Cell::mCellDelCount);
printf("Neighbor NEW/DEL : [%lld] [%lld]\n", Cell::mNCellNewCount, Cell::mNCellDelCount);
printf("Bomb NEW/DEL : [%lld] [%lld]\n", Cell::mBCellNewCount, Cell::mBCellDelCount);
return result;
}