Help wrapping SDL2.0

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

Hi I am new to this forum, but I have been using EU4.0 for a while. I want to wrap SDL 2.0 and am using Mark Akita's SDL_wrap.ew as a backbone. I think I have the hang of most of the wraps, but I do not think I understand some of the dll wrappings. The file I am working on is the SDL Hints. I don't think I need it, but it is worth learning. The header file shows the following code

#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON  "SDL_HINT_WINRT_HANDLE_BACK_BUTTON" 
--And many other definitions 
 
extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, 
                                             const char *value); 

I think that the wrap for this is something like:

global constant SDL_HINT_WINRT_HANDLE_BACK_BUTTON  = "SDL_HINT_WINRT_HANDLE_BACK_BUTTON" 
 
--I have already opened the SDL in another header so I have this 
 
constant 
xSDL_SetHint = define_c_func( sdl, "SDL_SetHint", {C_POINTER, C_POINTER}, C_BOOL) 
 
global function SDL_SetHint(sequence name, sequence value) 
	hint = allocate_string(length(name)) 
	val = allocate_string(length(value)) 
	 
	hint = poke_string(hint, length(name), {name}) 
	val = poke_string(val, length(value), {value}) 
	 
	ret = c_func(xSDL_SetHint, {hint, val}) 
	 
	return ret         
end function 

Is this the way to go about this?

The call would look something like this:

atom junk

junk = SDL_SetHint("SDL_HINT_NEW_HINT", "1")

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

Search



Quick Links

User menu

Not signed in.

Misc Menu