1. Bleeding Edge SDL3?

Hi all,

I have been working a wrapper for SDL3. SDL3 is still in active development and as it has been updating, I have been keeping up with it for the most part. The wrapper wraps SDL3 of course and the new functions and the re-worked API. It is mostly similar to SDL2, with some differences here and there. Keep in mind this would be a bleeding edge version and would be updated a lot and some things may not work or break. If not, I can just wait until a stable release of SDL3 is released. The wrapper of course uses Greg's Euphoria version of the FFI library. This helps greatly with wrapping structs.

--Sample of Wrapper code 
 
 
--From SDL_Init.e 
public enum type SDL_InitFlags 
	SDL_INIT_TIMER = 0x00000001, 
	SDL_INIT_AUDIO = 0x00000010, 
	SDL_INIT_VIDEO = 0x00000020, 
	SDL_INIT_JOYSTICK = 0x00000200, 
	SDL_INIT_HAPTIC = 0x00001000, 
	SDL_INIT_GAMEPAD = 0x00002000, 
	SDL_INIT_EVENTS = 0x00004000, 
	SDL_INIT_SENSOR = 0x00008000 
end type 
 
public constant SDL_INIT_EVERYTHING = or_all({SDL_INIT_TIMER,SDL_INIT_AUDIO,SDL_INIT_VIDEO,SDL_INIT_EVENTS, 
											  SDL_INIT_JOYSTICK,SDL_INIT_HAPTIC,SDL_INIT_GAMEPAD,SDL_INIT_SENSOR}) 
											   
public constant xSDL_Init = define_c_func(sdl,"+SDL_Init",{C_UINT32},C_INT) 
 
public function SDL_Init(atom flags) 
	return c_func(xSDL_Init,{flags}) 
end function 
 
--------------------------------------------------------------------------------------------------------------- 
 
--From SDL_video.e 
public constant SDL_DisplayMode = define_c_struct({ 
	C_UINT32, --displayID 
	C_UINT32, --format 
	C_INT, --w 
	C_INT, --h 
	C_FLOAT, --pixel_density 
	C_FLOAT, --refresh_rate 
	C_POINTER --driverdata 
}) 
 
export constant xSDL_CreateWindow = define_c_func(sdl,"+SDL_CreateWindow",{C_STRING,C_INT,C_INT,C_UINT32},C_POINTER) 
 
public function SDL_CreateWindow(sequence title,atom w,atom h,atom flags) 
	return c_func(xSDL_CreateWindow,{title,w,h,flags}) 
end function 
--simple demo program 
include SDL3.e 
 
atom w = 800 
atom h = 600 
atom flags = SDL_WINDOW_RESIZABLE 
 
if SDL_Init(SDL_INIT_VIDEO) = -1 then 
	puts(1,"Failed to init SDL!\n") 
	abort(0) 
end if 
 
sequence title = "Simple Window - Stays open for 3 seconds" 
 
atom win = SDL_CreateWindow(title,w,h,flags) 
 
SDL_Delay(3000) 
 
SDL_DestroyWindow(win) 
 
SDL_Quit() 
 
new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu