Skip to content

Instantly share code, notes, and snippets.

@Twinklebear
Created August 9, 2012 20:50
Show Gist options
  • Select an option

  • Save Twinklebear/3307934 to your computer and use it in GitHub Desktop.

Select an option

Save Twinklebear/3307934 to your computer and use it in GitHub Desktop.
/*
* Save the box's properties to a Json::Value and return it
* @return Json::Value containing the box's properties
*/
Json::Value Save(){
Json::Value val;
val["x"] = pos.x;
val["y"] = pos.y;
val["w"] = w;
val["h"] = h;
return val;
}
/*
* Load the box's properties from a Json::Value
* @param val The Json::Value containing the properties to load
*/
void Load(Json::Value val){
Set(val["x"].asInt(), val["y"].asInt(),
val["w"].asInt(), val["h"].asInt());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment