RGFW
A multi-platform single-header very simple-to-use framework library for creating GUI Libraries or simple GUI programs.
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
RGFW.h File Reference
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  RGFW_point
 
struct  RGFW_rect
 
struct  RGFW_area
 
struct  RGFW_monitorMode
 
struct  RGFW_monitor
 
struct  RGFW_event
 
struct  RGFW_window
 
struct  RGFW_debugContext
 
struct  RGFW_info
 

Macros

#define RGFW_USERPTR   NULL
 
#define RGFW_UNUSED(x)   (void)(x)
 
#define RGFW_ROUND(x)   (i32)((x) >= 0 ? (x) + 0.5f : (x) - 0.5f)
 
#define RGFW_ALLOC   malloc
 
#define RGFW_FREE   free
 
#define RGFW_ASSERT   assert
 
#define RGFW_MEMSET(ptr, value, num)   memset(ptr, value, num)
 
#define RGFW_MEMCPY(dist, src, len)   memcpy(dist, src, len)
 
#define RGFW_STRNCMP(s1, s2, max)   strncmp(s1, s2, max)
 
#define RGFW_STRNCPY(dist, src, len)   strncpy(dist, src, len)
 
#define RGFW_STRSTR(str, substr)   strstr(str, substr)
 
#define RGFW_STRTOL(str, endptr, base)   strtol(str, endptr, base)
 
#define RGFW_ATOF(num)   atof(num)
 
#define RGFWDEF   inline
 
#define RGFW_ENUM(type, name)   type name; enum
 
#define RGFW_HEADER
 
#define RGFW_INT_DEFINED
 
#define RGFW_BOOL_DEFINED
 
#define RGFW_BOOL(x)   (RGFW_bool)((x) ? RGFW_TRUE : RGFW_FALSE) /* force an value to be 0 or 1 */
 
#define RGFW_TRUE   (RGFW_bool)1
 
#define RGFW_FALSE   (RGFW_bool)0
 
#define RGFW_OPENGL
 
#define RGFW_COCOA_FRAME_NAME   NULL
 
#define RGFW_key   u8
 
#define RGFW_MAX_PATH   260 /* max length of a path (for dnd) */
 
#define RGFW_MAX_DROPS   260 /* max items you can drop at once */
 
#define RGFW_BIT(x)   (1 << x)
 
#define RGFW_POINT(x, y)   (RGFW_point){(i32)(x), (i32)(y)}
 
#define RGFW_RECT(x, y, w, h)   (RGFW_rect){(i32)(x), (i32)(y), (i32)(w), (i32)(h)}
 
#define RGFW_AREA(w, h)   (RGFW_area){(u32)(w), (u32)(h)}
 
#define RGFW_DEBUG_CTX(win, err)   (RGFW_debugContext){win, NULL, err}
 
#define RGFW_DEBUG_CTX_MON(monitor)   (RGFW_debugContext){_RGFW->root, &monitor, 0}
 
#define RGFW_MAX_EVENTS   32
 
#define RGFW_eventQueuePushEx(eventInit)   { RGFW_event e; eventInit; RGFW_eventQueuePush(e); }
 

Typedefs

typedef uint8_t u8
 
typedef int8_t i8
 
typedef uint16_t u16
 
typedef int16_t i16
 
typedef uint32_t u32
 
typedef int32_t i32
 
typedef uint64_t u64
 
typedef int64_t i64
 
typedef u8 RGFW_bool
 
typedef struct RGFW_point RGFW_point
 
typedef struct RGFW_rect RGFW_rect
 
typedef struct RGFW_area RGFW_area
 
typedef struct RGFW_monitorMode RGFW_monitorMode
 
typedef struct RGFW_monitor RGFW_monitor
 
typedef void RGFW_mouse
 
typedef struct RGFW_event RGFW_event
 
typedef struct RGFW_window RGFW_window
 
typedef ptrdiff_t RGFW_ssize_t
 
typedef struct RGFW_debugContext RGFW_debugContext
 
typedef void(* RGFW_debugfunc) (RGFW_debugType type, RGFW_errorCode err, RGFW_debugContext ctx, const char *msg)
 
typedef void(* RGFW_windowMovedfunc) (RGFW_window *win, RGFW_rect r)
 
typedef void(* RGFW_windowResizedfunc) (RGFW_window *win, RGFW_rect r)
 
typedef void(* RGFW_windowRestoredfunc) (RGFW_window *win, RGFW_rect r)
 
typedef void(* RGFW_windowMaximizedfunc) (RGFW_window *win, RGFW_rect r)
 
typedef void(* RGFW_windowMinimizedfunc) (RGFW_window *win, RGFW_rect r)
 
typedef void(* RGFW_windowQuitfunc) (RGFW_window *win)
 
typedef void(* RGFW_focusfunc) (RGFW_window *win, RGFW_bool inFocus)
 
typedef void(* RGFW_mouseNotifyfunc) (RGFW_window *win, RGFW_point point, RGFW_bool status)
 
typedef void(* RGFW_mousePosfunc) (RGFW_window *win, RGFW_point point, RGFW_point vector)
 
typedef void(* RGFW_dndInitfunc) (RGFW_window *win, RGFW_point point)
 
typedef void(* RGFW_windowRefreshfunc) (RGFW_window *win)
 
typedef void(* RGFW_keyfunc) (RGFW_window *win, u8 key, u8 keyChar, RGFW_keymod keyMod, RGFW_bool pressed)
 
typedef void(* RGFW_mouseButtonfunc) (RGFW_window *win, RGFW_mouseButton button, double scroll, RGFW_bool pressed)
 
typedef void(* RGFW_gamepadButtonfunc) (RGFW_window *win, u16 gamepad, u8 button, RGFW_bool pressed)
 
typedef void(* RGFW_gamepadAxisfunc) (RGFW_window *win, u16 gamepad, RGFW_point axis[2], u8 axisesCount, u8 whichAxis)
 
typedef void(* RGFW_gamepadfunc) (RGFW_window *win, u16 gamepad, RGFW_bool connected)
 
typedef void(* RGFW_dndfunc) (RGFW_window *win, char **droppedFiles, size_t droppedFilesCount)
 
typedef void(* RGFW_scaleUpdatedfunc) (RGFW_window *win, float scaleX, float scaleY)
 
typedef void(* RGFW_proc) (void)
 
typedef struct RGFW_info RGFW_info
 

Functions

RGFWDEF void RGFW_useWayland (RGFW_bool wayland)
 
RGFWDEF RGFW_bool RGFW_usingWayland (void)
 
typedef RGFW_ENUM (u8, RGFW_eventType)
 
typedef RGFW_ENUM (u8, RGFW_mouseButton)
 
typedef RGFW_ENUM (u8, RGFW_keymod)
 
typedef RGFW_ENUM (u8, RGFW_gamepadCodes)
 
RGFWDEF RGFW_monitorRGFW_getMonitors (size_t *len)
 
RGFWDEF RGFW_monitor RGFW_getPrimaryMonitor (void)
 
typedef RGFW_ENUM (u8, RGFW_modeRequest)
 
RGFWDEF RGFW_bool RGFW_monitor_requestMode (RGFW_monitor mon, RGFW_monitorMode mode, RGFW_modeRequest request)
 
RGFWDEF RGFW_bool RGFW_monitorModeCompare (RGFW_monitorMode mon, RGFW_monitorMode mon2, RGFW_modeRequest request)
 
RGFWDEF RGFW_mouseRGFW_loadMouse (u8 *icon, RGFW_area a, i32 channels)
 
RGFWDEF void RGFW_freeMouse (RGFW_mouse *mouse)
 
typedef RGFW_ENUM (u32, RGFW_windowFlags)
 
RGFWDEF RGFW_bool RGFW_monitor_scaleToWindow (RGFW_monitor mon, RGFW_window *win)
 
RGFWDEF void RGFW_setClassName (const char *name)
 
RGFWDEF void RGFW_setXInstName (const char *name)
 
RGFWDEF void RGFW_moveToMacOSResourceDir (void)
 
RGFWDEF RGFW_windowRGFW_createWindow (const char *name, RGFW_rect rect, RGFW_windowFlags flags)
 
RGFWDEF RGFW_windowRGFW_createWindowPtr (const char *name, RGFW_rect rect, RGFW_windowFlags flags, RGFW_window *win)
 
RGFWDEF void RGFW_window_initBuffer (RGFW_window *win)
 
RGFWDEF void RGFW_window_initBufferSize (RGFW_window *win, RGFW_area area)
 
RGFWDEF void RGFW_window_initBufferPtr (RGFW_window *win, u8 *buffer, RGFW_area area)
 
RGFWDEF void RGFW_window_setFlags (RGFW_window *win, RGFW_windowFlags)
 
RGFWDEF RGFW_area RGFW_getScreenSize (void)
 
RGFWDEF RGFW_eventRGFW_window_checkEvent (RGFW_window *win)
 
typedef RGFW_ENUM (i32, RGFW_eventWait)
 
RGFWDEF void RGFW_window_eventWait (RGFW_window *win, i32 waitMS)
 
RGFWDEF void RGFW_window_checkEvents (RGFW_window *win, i32 waitMS)
 
RGFWDEF void RGFW_stopCheckEvents (void)
 
RGFWDEF void RGFW_window_close (RGFW_window *win)
 
RGFWDEF void RGFW_window_move (RGFW_window *win, RGFW_point v)
 
RGFWDEF void RGFW_window_moveToMonitor (RGFW_window *win, RGFW_monitor m)
 
RGFWDEF void RGFW_window_resize (RGFW_window *win, RGFW_area a)
 
RGFWDEF void RGFW_window_setAspectRatio (RGFW_window *win, RGFW_area a)
 
RGFWDEF void RGFW_window_setMinSize (RGFW_window *win, RGFW_area a)
 
RGFWDEF void RGFW_window_setMaxSize (RGFW_window *win, RGFW_area a)
 
RGFWDEF void RGFW_window_focus (RGFW_window *win)
 
RGFWDEF RGFW_bool RGFW_window_isInFocus (RGFW_window *win)
 
RGFWDEF void RGFW_window_raise (RGFW_window *win)
 
RGFWDEF void RGFW_window_maximize (RGFW_window *win)
 
RGFWDEF void RGFW_window_setFullscreen (RGFW_window *win, RGFW_bool fullscreen)
 
RGFWDEF void RGFW_window_center (RGFW_window *win)
 
RGFWDEF void RGFW_window_minimize (RGFW_window *win)
 
RGFWDEF void RGFW_window_restore (RGFW_window *win)
 
RGFWDEF void RGFW_window_setFloating (RGFW_window *win, RGFW_bool floating)
 
RGFWDEF void RGFW_window_setOpacity (RGFW_window *win, u8 opacity)
 
RGFWDEF RGFW_bool RGFW_window_opengl_isSoftware (RGFW_window *win)
 
RGFWDEF void RGFW_window_setBorder (RGFW_window *win, RGFW_bool border)
 
RGFWDEF RGFW_bool RGFW_window_borderless (RGFW_window *win)
 
RGFWDEF void RGFW_window_setDND (RGFW_window *win, RGFW_bool allow)
 
RGFWDEF RGFW_bool RGFW_window_allowsDND (RGFW_window *win)
 
RGFWDEF void RGFW_window_setMousePassthrough (RGFW_window *win, RGFW_bool passthrough)
 
RGFWDEF void RGFW_window_setName (RGFW_window *win, const char *name)
 
RGFWDEF RGFW_bool RGFW_window_setIcon (RGFW_window *win, u8 *icon, RGFW_area a, i32 channels)
 
typedef RGFW_ENUM (u8, RGFW_icon)
 
RGFWDEF RGFW_bool RGFW_window_setIconEx (RGFW_window *win, u8 *icon, RGFW_area a, i32 channels, u8 type)
 
RGFWDEF void RGFW_window_setMouse (RGFW_window *win, RGFW_mouse *mouse)
 
RGFWDEF RGFW_bool RGFW_window_setMouseStandard (RGFW_window *win, u8 mouse)
 
RGFWDEF RGFW_bool RGFW_window_setMouseDefault (RGFW_window *win)
 
RGFWDEF void RGFW_window_mouseHold (RGFW_window *win, RGFW_area area)
 
RGFWDEF RGFW_bool RGFW_window_mouseHeld (RGFW_window *win)
 
RGFWDEF void RGFW_window_mouseUnhold (RGFW_window *win)
 
RGFWDEF void RGFW_window_hide (RGFW_window *win)
 
RGFWDEF void RGFW_window_show (RGFW_window *win)
 
RGFWDEF void RGFW_window_setShouldClose (RGFW_window *win, RGFW_bool shouldClose)
 
RGFWDEF RGFW_point RGFW_getGlobalMousePoint (void)
 
RGFWDEF RGFW_point RGFW_window_getMousePoint (RGFW_window *win)
 
RGFWDEF void RGFW_window_showMouse (RGFW_window *win, RGFW_bool show)
 
RGFWDEF RGFW_bool RGFW_window_mouseHidden (RGFW_window *win)
 
RGFWDEF void RGFW_window_moveMouse (RGFW_window *win, RGFW_point v)
 
RGFWDEF RGFW_bool RGFW_window_shouldClose (RGFW_window *win)
 
RGFWDEF RGFW_bool RGFW_window_isFullscreen (RGFW_window *win)
 
RGFWDEF RGFW_bool RGFW_window_isHidden (RGFW_window *win)
 
RGFWDEF RGFW_bool RGFW_window_isMinimized (RGFW_window *win)
 
RGFWDEF RGFW_bool RGFW_window_isMaximized (RGFW_window *win)
 
RGFWDEF RGFW_bool RGFW_window_isFloating (RGFW_window *win)
 
RGFWDEF void RGFW_window_scaleToMonitor (RGFW_window *win)
 
RGFWDEF RGFW_monitor RGFW_window_getMonitor (RGFW_window *win)
 
RGFWDEF RGFW_bool RGFW_isPressed (RGFW_window *win, RGFW_key key)
 
RGFWDEF RGFW_bool RGFW_wasPressed (RGFW_window *win, RGFW_key key)
 
RGFWDEF RGFW_bool RGFW_isHeld (RGFW_window *win, RGFW_key key)
 
RGFWDEF RGFW_bool RGFW_isReleased (RGFW_window *win, RGFW_key key)
 
RGFWDEF RGFW_bool RGFW_isClicked (RGFW_window *win, RGFW_key key)
 
RGFWDEF RGFW_bool RGFW_isMousePressed (RGFW_window *win, RGFW_mouseButton button)
 
RGFWDEF RGFW_bool RGFW_isMouseHeld (RGFW_window *win, RGFW_mouseButton button)
 
RGFWDEF RGFW_bool RGFW_isMouseReleased (RGFW_window *win, RGFW_mouseButton button)
 
RGFWDEF RGFW_bool RGFW_wasMousePressed (RGFW_window *win, RGFW_mouseButton button)
 
RGFWDEF const char * RGFW_readClipboard (size_t *size)
 
RGFWDEF RGFW_ssize_t RGFW_readClipboardPtr (char *str, size_t strCapacity)
 
RGFWDEF void RGFW_writeClipboard (const char *text, u32 textLen)
 
typedef RGFW_ENUM (u8, RGFW_debugType)
 
typedef RGFW_ENUM (u8, RGFW_errorCode)
 
RGFWDEF RGFW_debugfunc RGFW_setDebugCallback (RGFW_debugfunc func)
 
RGFWDEF void RGFW_sendDebugInfo (RGFW_debugType type, RGFW_errorCode err, RGFW_debugContext ctx, const char *msg)
 
RGFWDEF RGFW_windowMovedfunc RGFW_setWindowMovedCallback (RGFW_windowMovedfunc func)
 
RGFWDEF RGFW_windowResizedfunc RGFW_setWindowResizedCallback (RGFW_windowResizedfunc func)
 
RGFWDEF RGFW_windowQuitfunc RGFW_setWindowQuitCallback (RGFW_windowQuitfunc func)
 
RGFWDEF RGFW_mousePosfunc RGFW_setMousePosCallback (RGFW_mousePosfunc func)
 
RGFWDEF RGFW_windowRefreshfunc RGFW_setWindowRefreshCallback (RGFW_windowRefreshfunc func)
 
RGFWDEF RGFW_focusfunc RGFW_setFocusCallback (RGFW_focusfunc func)
 
RGFWDEF RGFW_mouseNotifyfunc RGFW_setMouseNotifyCallback (RGFW_mouseNotifyfunc func)
 
RGFWDEF RGFW_dndfunc RGFW_setDndCallback (RGFW_dndfunc func)
 
RGFWDEF RGFW_dndInitfunc RGFW_setDndInitCallback (RGFW_dndInitfunc func)
 
RGFWDEF RGFW_keyfunc RGFW_setKeyCallback (RGFW_keyfunc func)
 
RGFWDEF RGFW_mouseButtonfunc RGFW_setMouseButtonCallback (RGFW_mouseButtonfunc func)
 
RGFWDEF RGFW_gamepadButtonfunc RGFW_setGamepadButtonCallback (RGFW_gamepadButtonfunc func)
 
RGFWDEF RGFW_gamepadAxisfunc RGFW_setGamepadAxisCallback (RGFW_gamepadAxisfunc func)
 
RGFWDEF RGFW_gamepadfunc RGFW_setGamepadCallback (RGFW_gamepadfunc func)
 
RGFWDEF RGFW_windowResizedfunc RGFW_setWindowMaximizedCallback (RGFW_windowResizedfunc func)
 
RGFWDEF RGFW_windowResizedfunc RGFW_setWindowMinimizedCallback (RGFW_windowResizedfunc func)
 
RGFWDEF RGFW_windowResizedfunc RGFW_setWindowRestoredCallback (RGFW_windowResizedfunc func)
 
RGFWDEF RGFW_scaleUpdatedfunc RGFW_setScaleUpdatedCallback (RGFW_scaleUpdatedfunc func)
 
typedef RGFW_ENUM (u8, RGFW_gamepadType)
 
RGFWDEF u32 RGFW_isPressedGamepad (RGFW_window *win, u8 controller, RGFW_gamepadCodes button)
 
RGFWDEF u32 RGFW_isReleasedGamepad (RGFW_window *win, u8 controller, RGFW_gamepadCodes button)
 
RGFWDEF u32 RGFW_isHeldGamepad (RGFW_window *win, u8 controller, RGFW_gamepadCodes button)
 
RGFWDEF u32 RGFW_wasPressedGamepad (RGFW_window *win, u8 controller, RGFW_gamepadCodes button)
 
RGFWDEF RGFW_point RGFW_getGamepadAxis (RGFW_window *win, u16 controller, u16 whichAxis)
 
RGFWDEF const char * RGFW_getGamepadName (RGFW_window *win, u16 controller)
 
RGFWDEF size_t RGFW_getGamepadCount (RGFW_window *win)
 
RGFWDEF RGFW_gamepadType RGFW_getGamepadType (RGFW_window *win, u16 controller)
 
RGFWDEF void RGFW_window_makeCurrent (RGFW_window *win)
 
RGFWDEF RGFW_windowRGFW_getCurrent (void)
 
RGFWDEF void RGFW_window_swapBuffers (RGFW_window *win)
 
RGFWDEF void RGFW_window_swapInterval (RGFW_window *win, i32 swapInterval)
 
RGFWDEF void RGFW_window_swapBuffers_software (RGFW_window *win)
 
RGFWDEF void RGFW_window_initOpenGL (RGFW_window *win)
 
RGFWDEF void RGFW_window_freeOpenGL (RGFW_window *win)
 
typedef RGFW_ENUM (u8, RGFW_glHints)
 
RGFWDEF void RGFW_setGLHint (RGFW_glHints hint, i32 value)
 
RGFWDEF RGFW_bool RGFW_extensionSupported (const char *extension, size_t len)
 
RGFWDEF RGFW_proc RGFW_getProcAddress (const char *procname)
 
RGFWDEF void RGFW_window_makeCurrent_OpenGL (RGFW_window *win)
 
RGFWDEF void RGFW_window_swapBuffers_OpenGL (RGFW_window *win)
 
void * RGFW_getCurrent_OpenGL (void)
 
RGFWDEF RGFW_bool RGFW_extensionSupportedPlatform (const char *extension, size_t len)
 
RGFWDEF double RGFW_getTime (void)
 
RGFWDEF u64 RGFW_getTimeNS (void)
 
RGFWDEF void RGFW_sleep (u64 milisecond)
 
RGFWDEF void RGFW_setTime (double time)
 
RGFWDEF u64 RGFW_getTimerValue (void)
 
RGFWDEF u64 RGFW_getTimerFreq (void)
 
RGFWDEF u32 RGFW_checkFPS (double startTime, u32 frameCount, u32 fpsCap)
 
RGFWDEF void RGFW_setRootWindow (RGFW_window *win)
 
RGFWDEF RGFW_windowRGFW_getRootWindow (void)
 
void RGFW_eventQueuePush (RGFW_event event)
 
RGFW_eventRGFW_eventQueuePop (RGFW_window *win)
 
typedef RGFW_ENUM (u8, RGFW_key)
 
RGFWDEF u32 RGFW_apiKeyToRGFW (u32 keycode)
 
RGFWDEF u32 RGFW_rgfwToApiKey (u32 keycode)
 
RGFWDEF u8 RGFW_rgfwToKeyChar (u32 keycode)
 
typedef RGFW_ENUM (u8, RGFW_mouseIcons)
 
RGFWDEF i32 RGFW_init (void)
 
RGFWDEF void RGFW_deinit (void)
 
RGFWDEF void * RGFW_init_heap (void)
 
RGFWDEF void RGFW_deinit_heap (void)
 
RGFWDEF i32 RGFW_init_ptr (RGFW_info *info)
 
RGFWDEF void RGFW_deinit_ptr (RGFW_info *info)
 
RGFWDEF void RGFW_setInfo (RGFW_info *info)
 
RGFWDEF RGFW_infoRGFW_getInfo (void)
 

Macro Definition Documentation

◆ RGFW_ALLOC

#define RGFW_ALLOC   malloc

◆ RGFW_AREA

#define RGFW_AREA (   w,
 
)    (RGFW_area){(u32)(w), (u32)(h)}

◆ RGFW_ASSERT

#define RGFW_ASSERT   assert

◆ RGFW_ATOF

#define RGFW_ATOF (   num)    atof(num)

◆ RGFW_BIT

#define RGFW_BIT (   x)    (1 << x)

◆ RGFW_BOOL

#define RGFW_BOOL (   x)    (RGFW_bool)((x) ? RGFW_TRUE : RGFW_FALSE) /* force an value to be 0 or 1 */

◆ RGFW_BOOL_DEFINED

#define RGFW_BOOL_DEFINED

◆ RGFW_COCOA_FRAME_NAME

#define RGFW_COCOA_FRAME_NAME   NULL

◆ RGFW_ENUM

#define RGFW_ENUM (   type,
  name 
)    type name; enum

◆ RGFW_FALSE

#define RGFW_FALSE   (RGFW_bool)0

◆ RGFW_FREE

#define RGFW_FREE   free

◆ RGFW_HEADER

#define RGFW_HEADER

◆ RGFW_INT_DEFINED

#define RGFW_INT_DEFINED

◆ RGFW_key

#define RGFW_key   u8

◆ RGFW_MAX_DROPS

#define RGFW_MAX_DROPS   260 /* max items you can drop at once */

◆ RGFW_MAX_PATH

#define RGFW_MAX_PATH   260 /* max length of a path (for dnd) */

◆ RGFW_MEMCPY

#define RGFW_MEMCPY (   dist,
  src,
  len 
)    memcpy(dist, src, len)

◆ RGFW_MEMSET

#define RGFW_MEMSET (   ptr,
  value,
  num 
)    memset(ptr, value, num)

◆ RGFW_OPENGL

#define RGFW_OPENGL

◆ RGFW_POINT

#define RGFW_POINT (   x,
 
)    (RGFW_point){(i32)(x), (i32)(y)}

◆ RGFW_RECT

#define RGFW_RECT (   x,
  y,
  w,
 
)    (RGFW_rect){(i32)(x), (i32)(y), (i32)(w), (i32)(h)}

◆ RGFW_ROUND

#define RGFW_ROUND (   x)    (i32)((x) >= 0 ? (x) + 0.5f : (x) - 0.5f)

◆ RGFW_STRNCMP

#define RGFW_STRNCMP (   s1,
  s2,
  max 
)    strncmp(s1, s2, max)

◆ RGFW_STRNCPY

#define RGFW_STRNCPY (   dist,
  src,
  len 
)    strncpy(dist, src, len)

◆ RGFW_STRSTR

#define RGFW_STRSTR (   str,
  substr 
)    strstr(str, substr)

◆ RGFW_STRTOL

#define RGFW_STRTOL (   str,
  endptr,
  base 
)    strtol(str, endptr, base)

◆ RGFW_TRUE

#define RGFW_TRUE   (RGFW_bool)1

◆ RGFW_UNUSED

#define RGFW_UNUSED (   x)    (void)(x)

◆ RGFW_USERPTR

#define RGFW_USERPTR   NULL

◆ RGFWDEF

#define RGFWDEF   inline

Typedef Documentation

◆ i16

typedef int16_t i16

◆ i32

typedef int32_t i32

◆ i64

typedef int64_t i64

◆ i8

typedef int8_t i8

◆ RGFW_area

typedef struct RGFW_area RGFW_area

basic area type, if there's not already a area type of choice

◆ RGFW_bool

typedef u8 RGFW_bool

◆ RGFW_event

typedef struct RGFW_event RGFW_event

Event structure for checking/getting events

◆ RGFW_info

typedef struct RGFW_info RGFW_info

◆ RGFW_monitor

typedef struct RGFW_monitor RGFW_monitor

structure for monitor data

◆ RGFW_monitorMode

◆ RGFW_mouse

typedef void RGFW_mouse

loads mouse icon from bitmap (similar to RGFW_window_setIcon). Icon NOT resized by default

◆ RGFW_point

typedef struct RGFW_point RGFW_point

basic vector type, if there's not already a point/vector type of choice

◆ RGFW_rect

typedef struct RGFW_rect RGFW_rect

basic rect type, if there's not already a rect type of choice

◆ RGFW_window

typedef struct RGFW_window RGFW_window

window structure for managing the window

◆ u16

typedef uint16_t u16

◆ u32

typedef uint32_t u32

◆ u64

typedef uint64_t u64

◆ u8

typedef uint8_t u8

Function Documentation

◆ RGFW_deinit()

RGFWDEF void RGFW_deinit ( void  )

is called by default when the last open window is closed

◆ RGFW_deinit_heap()

RGFWDEF void RGFW_deinit_heap ( void  )

deinits the heap instance

◆ RGFW_deinit_ptr()

RGFWDEF void RGFW_deinit_ptr ( RGFW_info info)

deinits RGFW instance at pointer

◆ RGFW_ENUM() [1/6]

typedef RGFW_ENUM ( u32  ,
RGFW_windowFlags   
)

source data for the window (used by the APIs)

Optional arguments for making a windows

< the window doesn't have a border

< the window cannot be resized by the user

< the window supports drag and drop

the window should hide the mouse (can be toggled later on using RGFW_window_mouseShow)

< the window is fullscreen by default

< the window is transparent (only properly works on X11 and MacOS, although it's meant for for windows)

center the window on the screen

use OpenGL software rendering

(cocoa only), change directory to resource folder

scale the window to the screen

the window is hidden

< create a floating window

< free (RGFW_window_close) the RGFW_window struct when the window is closed (by the end user)

< focus the window when it's shown

< focus the window when it's shown

< if the window is in focus

◆ RGFW_ENUM() [2/6]

typedef RGFW_ENUM ( u8  ,
RGFW_eventType   
)

event codes

< no event has been sent

< a key has been released

key event note the code of the key pressed is stored in RGFW_event.key !!Keycodes defined at the bottom of the RGFW_HEADER part of this file!!

while a string version is stored in RGFW_event.KeyString

RGFW_event.keyMod holds the current keyMod this means if CapsLock, NumLock are active or not

< a mouse button has been pressed (left,middle,right)

< a mouse button has been released (left,middle,right)

< the position of the mouse has been changed

mouse event note the x and y of the mouse can be found in the vector, RGFW_event.point

RGFW_event.button holds which mouse button was pressed

< a gamepad was connected

< a gamepad was disconnected

< a gamepad button was pressed

< a gamepad button was released

< an axis of a gamepad was moved

gamepad event note RGFW_event.gamepad holds which gamepad was altered, if any RGFW_event.button holds which gamepad button was pressed

RGFW_event.axis holds the data of all the axises RGFW_event.axisesCount says how many axises there are

< the window was moved (by the user)

< the window was resized (by the user), [on WASM this means the browser was resized]

< window is in focus now

< window is out of focus now

< the user clicked the quit button

< a file has been dropped into the window

< the start of a dnd event, when the place where the file drop is known

< the window was maximized

< the window was minimized

< the window was restored

< content scale factor changed

◆ RGFW_ENUM() [3/6]

typedef RGFW_ENUM ( u8  ,
RGFW_gamepadCodes   
)

gamepad button codes (based on xbox/playstation), you may need to change these values per controller

< or PS X button

< or PS X button

< or PS circle button

< or PS triangle button

< or PS square button

< start button

< select button

< home button

< dpad up

< dpad down

< dpad left

< dpad right

< left bump

< left trigger

< right bumper

< right trigger

< right thumb stick

◆ RGFW_ENUM() [4/6]

typedef RGFW_ENUM ( u8  ,
RGFW_keymod   
)

◆ RGFW_ENUM() [5/6]

typedef RGFW_ENUM ( u8  ,
RGFW_modeRequest   
)

< scale the monitor size

< change the refresh rate

< change the monitor RGB bits size

◆ RGFW_ENUM() [6/6]

typedef RGFW_ENUM ( u8  ,
RGFW_mouseButton   
)

mouse button codes (RGFW_event.button)

< left mouse button is pressed

< mouse-wheel-button is pressed

< right mouse button is pressed

< mouse wheel is scrolling up

< mouse wheel is scrolling down

◆ RGFW_freeMouse()

RGFWDEF void RGFW_freeMouse ( RGFW_mouse mouse)

◆ RGFW_getInfo()

RGFWDEF RGFW_info * RGFW_getInfo ( void  )

◆ RGFW_getMonitors()

RGFWDEF RGFW_monitor * RGFW_getMonitors ( size_t *  len)

get an array of all the monitors (max 6)

◆ RGFW_getPrimaryMonitor()

RGFWDEF RGFW_monitor RGFW_getPrimaryMonitor ( void  )

get the primary monitor

◆ RGFW_init()

RGFWDEF i32 RGFW_init ( void  )

optional init/deinit function is called by default when the first window is created by default

◆ RGFW_init_heap()

RGFWDEF void * RGFW_init_heap ( void  )

inits RGFW on the heap instead of in a global var

◆ RGFW_init_ptr()

RGFWDEF i32 RGFW_init_ptr ( RGFW_info info)

init RGFW, storing the data at the pointer

◆ RGFW_loadMouse()

RGFWDEF RGFW_mouse * RGFW_loadMouse ( u8 icon,
RGFW_area  a,
i32  channels 
)

frees RGFW_mouse data

◆ RGFW_monitor_requestMode()

RGFWDEF RGFW_bool RGFW_monitor_requestMode ( RGFW_monitor  mon,
RGFW_monitorMode  mode,
RGFW_modeRequest  request 
)

request a specific mode

◆ RGFW_monitor_scaleToWindow()

RGFWDEF RGFW_bool RGFW_monitor_scaleToWindow ( RGFW_monitor  mon,
RGFW_window win 
)

scale monitor to window size

◆ RGFW_monitorModeCompare()

RGFWDEF RGFW_bool RGFW_monitorModeCompare ( RGFW_monitorMode  mon,
RGFW_monitorMode  mon2,
RGFW_modeRequest  request 
)

check if 2 monitor modes are the same

◆ RGFW_setInfo()

RGFWDEF void RGFW_setInfo ( RGFW_info info)

◆ RGFW_useWayland()

RGFWDEF void RGFW_useWayland ( RGFW_bool  wayland)

(unix) Toggle use of wayland. This will be on by default if you use RGFW_WAYLAND (if you don't use RGFW_WAYLAND, you don't expose WAYLAND functions) this is mostly used to allow you to force the use of XWayland

◆ RGFW_usingWayland()

RGFWDEF RGFW_bool RGFW_usingWayland ( void  )