-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathArkanoidWindow.cpp
More file actions
38 lines (28 loc) · 878 Bytes
/
ArkanoidWindow.cpp
File metadata and controls
38 lines (28 loc) · 878 Bytes
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 "ArkanoidWindow.h"
#include "Graph_lib/Window.h"
#include "Settings.h"
using namespace Graph_lib;
ArkanoidWindow::ArkanoidWindow(Point xy, int w, int h, const std::string &title) :
Window{xy, w, h, title} {
startScreen = new StartScreen{0, 0, w, h, *this};
add(startScreen);
init();
startScreen->show();
}
void ArkanoidWindow::openGameScreen() {
gameScreen = new GameScreen{0, 0, windowWidth, windowHeight, this};
add(gameScreen);
gameScreen->show();
startScreen->hide();
Fl::add_timeout(0.016, [](void* userdata) -> void {
GameScreen* screen = static_cast<GameScreen*>(userdata);
screen->updateFrame(userdata);
}, gameScreen);
}
void ArkanoidWindow::openStartScreen() {
gameScreen->hide();
remove(gameScreen);
delete gameScreen;
gameScreen = nullptr;
startScreen->show();
}