// static flag
private void buildConstant(JSONObject obj, Map<String, PhaserType> typeMap) {
		if (obj.getString("kind").equals("constant")) {
			String name = obj.getString("name");
			String desc = obj.optString("description", "");
			Object defaultValue = obj.opt("defaultvalue");
			String[] types;
			if (obj.has("type")) {
				JSONArray jsonTypes = obj.getJSONObject("type").getJSONArray("names");
				types = getStringArray(jsonTypes);
			} else {
				// FIXME: this is the case of blendModes and scaleModes
				types = new String[] { "Object" };
			}
			PhaserConstant cons = new PhaserConstant();
			{
				// static flag
				String scope = obj.optString("scope", "");
				if (scope.equals("static")) {
					cons.setStatic(true);
				}
			}
			cons.setName(name);
			cons.setHelp(desc);
			cons.setTypes(types);
			cons.setDefaultValue(defaultValue);
			String memberof = obj.optString("memberof", null);
			if (memberof == null) {
				// global constant
				buildMeta(cons, obj);
				// FIXME: only add those Phaser.js constants
				if (cons.getFile().getFileName().toString().equals("Phaser.js")) {
					_globalConstants.add(cons);
				} else {
					out.println(obj.toString(2));
					throw new IllegalArgumentException("All global constants should come from Phaser.js and not from "
							+ cons.getFile().getFileName() + "#" + cons.getName());
				}
			} else {
				PhaserType type = typeMap.get(memberof);
				if (!type.getMemberMap().containsKey(name)) {
					type.getMemberMap().put(name, cons);
					cons.setDeclType(type);
					buildMeta(cons, obj);
				}
			}
		}
	}
PhaserConstant cons = new PhaserConstant();
{
// static flag
String scope = obj.optString("scope", "");
if (scope.equals("static")) {
String[] types;
if (obj.has("type")) {
JSONArray jsonTypes = obj.getJSONObject("type").getJSONArray("names");
types = getStringArray(jsonTypes);
} else {
// FIXME: this is the case of blendModes and scaleModes
types = new String[] { "Object" };
}
PhaserConstant cons = new PhaserConstant();
{
// static flag
String scope = obj.optString("scope", "");
if (scope.equals("static")) {
cons.setStatic(true);
}
}
cons.setName(name);
cons.setHelp(desc);
cons.setTypes(types);
cons.setDefaultValue(defaultValue);
String memberof = obj.optString("memberof", null);
private void buildConstant(JSONObject obj, Map<String, PhaserType> typeMap) {
if (obj.getString("kind").equals("constant")) {
String name = obj.getString("name");
String desc = obj.optString("description", "");
Object defaultValue = obj.opt("defaultvalue");
String[] types;
if (obj.has("type")) {
JSONArray jsonTypes = obj.getJSONObject("type").getJSONArray("names");
types = getStringArray(jsonTypes);
} else {
// FIXME: this is the case of blendModes and scaleModes
types = new String[] { "Object" };
}
PhaserConstant cons = new PhaserConstant();
{
// static flag
String scope = obj.optString("scope", "");
if (scope.equals("static")) {
cons.setStatic(true);
}
}
cons.setName(name);
cons.setHelp(desc);
cons.setTypes(types);
cons.setDefaultValue(defaultValue);
String memberof = obj.optString("memberof", null);
if (memberof == null) {
// global constant
buildMeta(cons, obj);
// FIXME: only add those Phaser.js constants
if (cons.getFile().getFileName().toString().equals("Phaser.js")) {
_globalConstants.add(cons);
} else {
out.println(obj.toString(2));
throw new IllegalArgumentException("All global constants should come from Phaser.js and not from "
+ cons.getFile().getFileName() + "#" + cons.getName());