Tile Engine Wrapper Help

new topic     » topic index » view thread      » older message » newer message

Hello all,

I was using Greg's FFI library to try and wrap Tile Engine. So far the wrapper itself appears to run without error when running it through eui.exe However when I went to make a test example, I got the following error. I feel the error has something to do with dealing with an opaque struct.

ffi.e: 908 attempt to subscript an atom (reading from it) in assignment to 'fn' 

Tile engine.h file 
TLNAPI TLN_Engine TLN_Init (int hres, int vres, int numlayers, int numsprites, int numanimations); 

Wrapper code

include std/machine.e 
include std/math.e 
include std/ffi.e 
 
public constant TLN_SpriteState = define_c_type({ 
	C_INT, --x --screen pos x 
	C_INT, --y --screen pos y 
	C_INT, --w --actual width of screen after scaling 
	C_INT, --h --actual height of screen after scaling 
	C_UINT, --flags --flags 
	C_POINTER, --assigned palette 
	C_POINTER, --spriteset 
	C_INT, --index 
	C_BOOL, --enabled 
	C_BOOL --collision 
}) 
 
public constant TLN_Engine = define_c_type({ 
	C_POINTER 
}) 
 
--The TLN_Engine is an opaque struct 
 
export constant te = open_dll("Tilengine.dll"), 
		--defgroup setup 
		--Basic setup and management 
		xTLN_Init = define_c_func(te,"+TLN_Init",{C_INT,C_INT,C_INT,C_INT,C_INT},TLN_Engine), 
		xTLN_Deinit = define_c_proc(te,"+TLN_Deinit",{}), 
$ 

Example

include tileengine.e 
 
procedure main() 
 
	sequence foreground = {} 
	 
	TLN_Init(400,240,1,0,0) 
	 
	foreground = TLN_LoadTilemap("Sonic_md_fg1.tmx",0) 
	TLN_SetLayerTilemap(0,foreground) 
	 
	TLN_CreateWindow("Example",0) 
	 
	while TLN_ProcessWindow() do 
		TLN_DrawFrame(0) 
	end while 
	 
 	TLN_DeleteTilemap(foreground) 
 	TLN_Deinit() 
	 
end procedure 
 
main() 
 

Let me know if you need more code or the ex.err file. If anyone can help.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu