axmol/templates/lua-template-runtime/frameworks/runtime-src/Classes/ConfigParser.h

63 lines
1.3 KiB
C
Raw Normal View History

2014-05-05 21:04:04 +08:00
#ifndef __CONFIG_PARSER_H__
#define __CONFIG_PARSER_H__
#include <string>
#include <vector>
#include "cocos2d.h"
2014-05-07 20:50:29 +08:00
#include "json/document.h"
2014-05-05 21:04:04 +08:00
using namespace std;
USING_NS_CC;
// ConfigParser
typedef struct _SimulatorScreenSize {
string title;
int width;
int height;
_SimulatorScreenSize(const string title_, int width_, int height_)
{
title = title_;
width = width_;
height = height_;
}
} SimulatorScreenSize;
typedef vector<SimulatorScreenSize> ScreenSizeArray;
class ConfigParser
{
public:
static ConfigParser *getInstance(void);
void readConfig();
// predefined screen size
int getScreenSizeCount(void);
cocos2d::Size getInitViewSize();
string getInitViewName();
2014-05-09 14:06:20 +08:00
string getEntryFile();
2014-05-07 20:50:29 +08:00
rapidjson::Document& getConfigJsonRoot();
2014-05-05 21:04:04 +08:00
const SimulatorScreenSize getScreenSize(int index);
2014-07-16 20:19:19 +08:00
int getConsolePort();
2014-08-29 15:05:55 +08:00
int getUploadPort();
2014-05-07 20:50:29 +08:00
bool isLanscape();
2014-07-24 10:30:39 +08:00
bool isWindowTop();
2014-05-07 20:50:29 +08:00
bool isInit();
2014-05-05 21:04:04 +08:00
private:
ConfigParser(void);
static ConfigParser *s_sharedInstance;
ScreenSizeArray _screenSizeArray;
cocos2d::Size _initViewSize;
string _viewName;
2014-05-09 14:06:20 +08:00
string _entryfile;
2014-05-07 20:50:29 +08:00
bool _isLandscape;
bool _isInit;
2014-07-24 10:30:39 +08:00
bool _isWindowTop;
2014-07-16 20:19:19 +08:00
int _consolePort;
2014-08-29 15:05:55 +08:00
int _uploadPort;
2014-05-07 20:50:29 +08:00
rapidjson::Document _docRootjson;
2014-05-05 21:04:04 +08:00
};
#endif // __CONFIG_PARSER_H__