Re: Blank Window (Tile Engine)
- Posted by Icy_Viking Apr 24, 2023
- 676 views
OK I changed the wrapper code to objects and the example code to objects. Still the background image does not appear. Everything else appears to work fine.
Wrapper
public atom tile = 0 ifdef WINDOWS then tile = open_dll("Tilengine.dll") elsifdef LINUX or FREEBSD then tile = open_dll("libTilengine.so") end ifdef export constant xTLN_Init = define_c_func(tile,"+TLN_Init",{C_INT,C_INT,C_INT,C_INT,C_INT},C_POINTER) public function TLN_Init(atom hres,atom vres,atom numlayers,atom numsprites,atom numani) return c_func(xTLN_Init,{hres,vres,numlayers,numsprites,numani}) end function export constant xTLN_Deinit = define_c_proc(tile,"+TLN_Deinit",{}) public procedure TLN_Deinit() c_proc(xTLN_Deinit,{}) end procedure export constant xTLN_CreateWindow = define_c_func(tile,"+TLN_CreateWindow",{C_STRING,C_INT},C_BOOL) public function TLN_CreateWindow(object overlay,atom flags) return c_func(xTLN_CreateWindow,{overlay,flags}) end function export constant xTLN_LoadTilemap = define_c_func(tile,"+TLN_LoadTilemap",{C_STRING,C_STRING},C_POINTER) public function TLN_LoadTilemap(sequence fname,object lname) return c_func(xTLN_LoadTilemap,{fname,lname}) end function export constant xTLN_SetLayerTilemap = define_c_func(tile,"+TLN_SetLayerTilemap",{C_INT,C_POINTER},C_BOOL) public function TLN_SetLayerTilemap(atom l,object tm) return c_func(xTLN_SetLayerTilemap,{l,tm}) end function
Example
without warning without type_check include std/ffi.e include tilengine.e TLN_Init(400,240,1,0,0) object fg = TLN_LoadTilemap("Sonic_md_fg1.tmx",NULL) ? fg TLN_SetLayerTilemap(0,fg) TLN_CreateWindow(NULL,0) while TLN_ProcessWindow() do TLN_DrawFrame(0) end while TLN_DeleteTilemap(fg) TLN_DeleteWindow() TLN_Deinit()