RGFW Wrapper and Partial OpenGL Wrapper
- Posted by Icy_Viking 1 week ago
- 297 views
Hi all,
Yesterday I started work on a wrapper for RGFW.
[https://github.com/ColleagueRiley/RGFW] - An alternative to GLFW
In order to make the example work I had to wrap some of OpenGL. I haven't completed the openGL wrapper, but a handful of functions are wrapped. The RGFW wrapper is finished. If anyone is interested let me know and I can post it.
--Sample clipping from wrapper public constant RGFW_monitor = define_c_struct({ C_INT32, --x C_INT32, --y {C_CHAR,128}, --name[128] C_FLOAT, --scaleX C_FLOAT, --scaleY C_FLOAT, --physW C_FLOAT, --physH RGFW_monitorMode --mode }) public constant xRGFW_getMonitors = define_c_func(rgfw,"+RGFW_getMonitors",{C_POINTER},C_POINTER) public function RGFW_getMonitors(atom len) atom plen = allocate_data(sizeof(C_SIZE_T)) if c_func(xRGFW_getMonitors,{plen}) then len = peek_type(plen,C_SIZE_T) end if free(plen) return {len} end function public constant xRGFW_createWindow = define_c_func(rgfw,"+RGFW_createWindow",{C_STRING,RGFW_rect,C_INT},C_POINTER) public function RGFW_createWindow(sequence name,sequence rect,atom flags) return c_func(xRGFW_createWindow,{name,rect,flags}) end function
include std/ffi.e include std/machine.e include rgfw.e include opengl.e --RGFW_setClassName("Example") atom win = RGFW_createWindow("Test Win",{100,100,640,480},RGFW_windowCenter) while not RGFW_window_shouldClose(win) do while RGFW_window_checkEvent(win) do if win = RGFW_quit then exit end if if RGFW_isPressed(win,RGFW_escape) then exit end if end while glClearColor(0.1,0.1,0.1,1.0) glClear(GL_COLOR_BUFFER_BIT) glBegin(GL_TRIANGLES) glColor3f(1.0,0.0,0.0) glVertex2f(-0.6,-0.75) glColor3f(0.0,1.0,0.0) glVertex2f(0.6,-0.75) glColor3f(0.0,0.0,1.0) glVertex2f(0.0,0.75) glEnd() RGFW_window_swapBuffers(win) end while RGFW_window_close(win)