-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgui_state_select_number.h
47 lines (39 loc) · 1.37 KB
/
gui_state_select_number.h
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
#ifndef GUI_STATE_SELECT_NUMBER_H
#define GUI_STATE_SELECT_NUMBER_H
#include <vector>
#include <gui_state.h>
#include <gui_label.h>
#include <gui_button.h>
#include <gui_triangle.h>
#include "graphics.h"
class GUI_State_Select_Number : public GUI_State {
public:
GUI_State_Select_Number(Graphics *gfx, GUI *gui, Touch *touch);
virtual void update() override;
virtual void reset() override;
virtual void draw() override;
virtual void on_state_enter() override;
virtual void on_state_exit() override;
void set_number(long long number);
long long get_number();
void set_on_number_selected_callback(std::function <void(long long)> callback) { on_number_selected_callback = callback; }
const static int font_size = 3;
private:
GUI_Label* label_polarity;
GUI_Label* label_0;
GUI_Label* label_x;
std::vector<char> digits;
std::vector<GUI_Label*> labels;
std::function <void(long long)> on_number_selected_callback;
GUI_Button* btn_ok;
std::vector<GUI_Triangle*> triangles_up;
std::vector<GUI_Triangle*> triangles_down;
GUI_Triangle *triangle_up_polarity;
GUI_Triangle *triangle_down_polarity;
void digit_up(int index);
void digit_down(int index);
void toggle_polarity();
void update_label_colour(int index);
void update_labels_colour();
};
#endif