java - LibGDX bytecode reader/writer -


i working on mapeditor game. , need way save map. i'm working libgdx. , use android , desktop backends.

the maps 2d , should contain:

  • shape / body data (vertices/radius/type...) box2d.

  • texture/particle pos/filepath.

questions:

  1. how read/write bytecode in libgdx.

  2. how make example format .map? ( hills.map )

all want files in libgdx can achieve using filehandle libgdx mechanism. it's simple:

    filehandle file = gdx.files.local("file.txt"); 

this code creates handle file (whatever existed or not - created new) can use make operations on file. writing , reading bytes can achieved using:

void writebytes(byte[] bytes, boolean append) byte[] readbytes() 

then in situation should like

    filehandle filehandle = gdx.files.local("mymap.map");     filehandle.writebytes(yummybites, false); 

you can read file handling (and ...local() means) here:

https://github.com/libgdx/libgdx/wiki/file-handling

i'm not sure mean saying 'format' .map. if mean 'file extension .map' it's simple - create , read file .map extension. remember extensions nothin till define how deal them can 'create' extensions want.

although if asking how format these shapes, filepaths etc should read xml or json parsing or this.

on top of - i'm not sure try achieve building own map editor - don't know project - maybe interested in existing map editors? best 1 in opinion tiled supported libgdx.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -