-
Notifications
You must be signed in to change notification settings - Fork 1
/
GlobalSettings.cpp
46 lines (38 loc) · 999 Bytes
/
GlobalSettings.cpp
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
#include "GlobalSettings.h"
#include "barleybreak.h"
#include "TilesGame.h"
GlobalSettings* GlobalSettings::GlobalSettingsInstance = NULL;
GlobalSettings::GlobalSettings() :
QObject()
{
GAME_BOARD_SIZE = DEFAULT_GAME_BOARD_SIZE;
}
GlobalSettings* GlobalSettings::Instance()
{
if(!GlobalSettingsInstance)
GlobalSettingsInstance = new GlobalSettings();
return GlobalSettingsInstance;
}
TilesGame* GlobalSettings::getGameLogicObject(int gameBoardSize)
{
return dynamic_cast<TilesGame*>(new BarleyBreak(gameBoardSize));
}
void GlobalSettings::setTimePlay(QString stringTime)
{
timeplay = stringTime;
}
void GlobalSettings::setGameBoardSize(int newValue)
{
if(GAME_BOARD_SIZE != newValue){
GAME_BOARD_SIZE = newValue;
emit gameBoardSizeValueChanged();
}
}
int GlobalSettings::getGameBoardSize()
{
return GAME_BOARD_SIZE;
}
QString GlobalSettings::getLastTimePlay()
{
return timeplay;
}