public RichImageLayer_Texture(JSONTable template, ContentManager content) { texture = content.Load <Texture2D>(template.getString("texture", "white")); color = template.getString("color", "FFFFFF").toColor(); drawMode = drawModesByName[template.getString("draw", "default")]; padding = template.getInt("padding", 0); JSONArray offsetArray = template.getArray("offset", null); if (offsetArray == null) { offset = new Vector2(0, 0); } else { offset = offsetArray.toVector2(); } rotation = template.getRotation("rotation", Rotation90.None); modifiesRect = (padding != 0 || offset.X != 0 || offset.Y != 0); }
public static Rotation90 getRotation(this JSONTable table, string name, Rotation90 defaultValue) { int angle = table.getInt(name, defaultValue.toInt()); return((Rotation90)(angle / 90)); }