-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_screen.h
More file actions
88 lines (67 loc) · 1.46 KB
/
start_screen.h
File metadata and controls
88 lines (67 loc) · 1.46 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef START_SCREEN_H
#define START_SCREEN_H
#include "background.h"
#include "board_view.h"
#include "view.h"
#include "icon.h"
class start_screen final : public view {
public:
start_screen(
application * app,
std::shared_ptr<background_renderer> bg);
void
resize(std::size_t width, std::size_t height) override;
void
redraw() override;
void
timer_tick() override;
void
notify_activate() override;
void
notify_deactivate() override;
void
handle_button_press(
int button,
int x, int y,
int button_state) override;
void
handle_button_release(
int button,
int x, int y,
int button_state) override;
void
handle_pointer_motion(
int x, int y,
int button_state) override;
void
handle_key_press(
int key_code,
const keyboard_state & state,
const char * chars);
void
set_start_level_handler(
std::function<void(std::size_t)> start_level_handler);
void
set_unlocked_levels(std::size_t unlocked_levels);
private:
enum class highlight_t {
none,
hover,
pressed
};
std::pair<bool, std::size_t>
get_index(double x, double y) const;
std::shared_ptr<background_renderer> bg_;
std::vector<std::unique_ptr<board_view>> puzzles_;
std::size_t unlocked_levels_;
std::size_t num_columns_;
std::size_t col_width_;
std::size_t col_offset_;
std::size_t row_offset_;
std::size_t row_height_;
highlight_t highlight_;
std::size_t highlight_index_;
std::function<void(std::size_t)> start_level_handler_;
icon exit_icon_;
};
#endif