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

57 lines
1.2 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-05-07 20:50:29 +08:00
bool isLanscape();
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;
rapidjson::Document _docRootjson;
2014-05-05 21:04:04 +08:00
};
#endif // __CONFIG_PARSER_H__