MiscUtils.h
2.05 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
//
// MiscUtils.h
// SteveMaggieCpp
//
// Created by Katarzyna Kalinowska-Górska on 17.05.2017.
//
//
#ifndef MiscUtils_h
#define MiscUtils_h
#include "PlainSprite.h"
class MiscUtils
{
public:
enum class ExtendDirectionX {
BOTH = 0,
LEFT = 1,
RIGHT = 2
};
enum class ExtendDirectionY {
BOTH = 0,
UP = 1,
DOWN = 2,
};
enum class Level {
CHILD = 0,
TEEN = 1,
ADULT = 2
};
static const char* levelToString(Level level) {
if(level == Level::CHILD){
return "CHILD";
} else if(level == Level::TEEN){
return "TEEN";
} else return "ADULT";
}
static float StandardAnimationTime;
static float QuickAnimationTime;
static const std::string WHICH_LEVEL_UD_KEY;
static const std::string TOS_ACCEPTED_UD_KEY;
static void saveTOSAccepted();
static bool wasTOSAccepted();
static void saveLastLevel(Level level);
static void saveLastLevel(int level);
static Level lastLevel();
static int nextLevel();
static std::string clockMinSecTimeString(int seconds);
static void showView(cocos2d::Node*, bool animated, float toAlpha = 255);
static void hideView(cocos2d::Node*, bool animated);
static void hideAndRemoveView(cocos2d::Node*, bool animated);
static cocos2d::Rect getExtendedActiveArea(cocos2d::Node* object, float extendPercentValueX = 0, float extendPercentValueY = 0, ExtendDirectionX extendDirX = ExtendDirectionX::BOTH, ExtendDirectionY extendDirY = ExtendDirectionY::BOTH);
static bool isNodeVisible(cocos2d::Node* node);
static void changeAnchorPoint(cocos2d::Node* p_node, cocos2d::Point p_newAnchorPoint);
static std::string boolToString(bool value);
//#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
static void showAppCloseConfirmDialog(std::function<void()> onCancelCallback);
static bool closeAppCloseConfirmDialogIfNecessary();
//#endif
};
#endif /* MiscUtils_h */