Class LevelJson
java.lang.Object
com.codename1.gaming.platformer.LevelJson
A small JSON reader and writer for level files, shared by the app and the server.
Parsing is com.codename1.io.JSONParser's, with one difference: numbers are
read from their text straight into fixed point (Fx#parse) as Integers,
never through double, so "speed": 1.5 means exactly the same thing on
every runtime -- the server replays a run with these values and must reach
the hash the device did. Objects become Map (in document order), arrays
List, and true, false and null what one would expect.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intA number field as fixed point.static intA number field as a whole number (the fixed-point value floored).An array field.An object field.static ObjectParses JSON text.static voidquote(StringBuilder sb, String s) Writes a JSON string literal.static StringA string field.
-
Method Details
-
parse
-
quote
Writes a JSON string literal.
Parameters
sb: the outputs: the string
-
fx
-
integer
-
str
-
obj
-
list
-