Re: sdl2 and ffi

new topic     » goto parent     » topic index » view thread      » older message » newer message
ChrisB said...

FAO Andy

Hi

You've defined SDL_surface in SDL_surface.e as a define_c_type, and then

export constant xSDL_GetWindowSurface = define_c_func(sdl,"+SDL_GetWindowSurface",{C_POINTER},SDL_Surface) 
 
public function SDL_GetWindowSurface(atom win) 
	return c_func(xSDL_GetWindowSurface,{win}) 
end function 

the function SDL_GetWindowSurface returns a pointer to the SDL_surface, not the actual structure itself, so eu is throwing type errors.

atom surf = SDL_GetWindowSurface(win) 

D:\EuProgramming\Euphoria4_1\SDL2Wrapper\Examples\WinImage.exw:28 
type_check failure, surf is {7195552,{36'$',{1952061344,{298874067,2684419766,...  

So, am I missing a step somewhere?

Cheers

Chris

I've changed it from SDL_Surface to C_POINTER. I've uploaded the change to github. I also like the allocate_mem feature that could be added to the FFI wrapper/library.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu