TileEngine Wrapper Issue
- Posted by Icy_Viking Mar 23, 2021
- 840 views
Hello all,
I was currently writing a wrapper of TileEngine for Euphoria. Everything was going smoothly until I noticed I'd need to make a shim for it due to the way its functions are handled. Some work without shims, but its the structs.
C Code struct Tilemap { DEFINE_OBJECT; int rows; /* rows*/ int cols; /* columns */ int maxindex; /* highest tile index */ int bgcolor; /* background color */ int id; /* id property */ bool visible; /* visible property */ struct Tileset* tileset; /* attached tileset (if any) */ Tile tiles[]; };From here https://github.com/megamarc/Tilengine/blob/master/src/Tilemap.h
Tileengine.h file TLNAPI TLN_Tilemap TLN_LoadTilemap (const char* filename, const char* layername);
--What I have currently public constant xTLN_LoadTilemap = define_c_func(tile,"+TLN_LoadTilemap",{C_POINTER,C_POINTER},C_POINTER) public function TLN_LoadTilemap(sequence filename,sequence layername) atom str = allocate_string(filename,1) atom str2 = allocate_string(layername,1) return c_func(xTLN_LoadTilemap,{str,str2}) end function
--shim idea enum ROWS, COLS, MAXINDEX, BGCOLOR, ID, VISIBLE
Maybe I should just switch to Phix since has simple struct support. -slight sarcarsm