forked from HaikuArchives/Haiku2048
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WindowBoard.h
90 lines (74 loc) · 1.75 KB
/
WindowBoard.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
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
89
90
/*
* Copyright (c) 2015 Markus Himmel
* Copyright 2022, Harshit Sharma <[email protected]>
* This file is distributed under the terms of the MIT license
*/
#ifndef WINDOW_BOARD_H
#define WINDOW_BOARD_H
#include "GameBoard.h"
#include <Window.h>
#include <Bitmap.h>
class Game;
class BButton;
class NumberView;
class WindowBoard;
class BStringView;
class BGridLayout;
class BTextControl;
enum
{
H2048_WINDOW_SHOW = '48WS',
H2048_SET_NAME = '48SN'
};
/*
* This is split up into two classes in order to prevent multiple inheritance
* and more specifically diamond inheritance on BLooper
*/
class GameWindow : public BWindow
{
public:
GameWindow(WindowBoard *master);
~GameWindow();
float prevWidth;
float prevHeight;
float defaultWidth;
float defaultHeight;
bool QuitRequested();
void FrameResized(float width, float height);
void MessageReceived(BMessage *message);
private:
void showBoard(bool canUndo);
BBitmap* initIcon(const char* iconName);
private:
NumberView ** fViews;
WindowBoard * fMaster;
BStringView * fScore;
BStringView * fScore_Highest;
BStringView * fHighscoreName;
BTextControl* fInputBox;
BGridLayout * fBoard;
BBitmap * fIconNew;
BBitmap * fIconUndo;
// we have to control the state of it
// (enabled / disabled)
BButton * undoButton;
int32 fPreviousHighscore;
const char * fPreviousUsername;
};
class WindowBoard : public GameBoard
{
friend class GameWindow;
public:
WindowBoard(Game *target);
~WindowBoard();
protected:
void gameStarted();
void gameEnded();
void nameRequest();
void boardChanged(bool canUndo);
void setFrame(BRect frame);
private:
bool fSending;
GameWindow * fWindow;
};
#endif // WINDOW_BOARD_H