RGFW
A multi-platform single-header very simple-to-use framework library for creating GUI Libraries or simple GUI programs.
Loading...
Searching...
No Matches
Functions
Window_management

Functions

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)
 

Detailed Description

Function Documentation

◆ RGFW_createWindow()

RGFWDEF RGFW_window * RGFW_createWindow ( const char *  name,
RGFW_rect  rect,
RGFW_windowFlags  flags 
)

function to create a window and struct

◆ RGFW_createWindowPtr()

RGFWDEF RGFW_window * RGFW_createWindowPtr ( const char *  name,
RGFW_rect  rect,
RGFW_windowFlags  flags,
RGFW_window win 
)

function to create a window (without allocating a window struct)

◆ RGFW_ENUM() [1/2]

typedef RGFW_ENUM ( i32  ,
RGFW_eventWait   
)

for RGFW_window_eventWait and RGFW_window_checkEvents waitMS -> Allows the function to keep checking for events even after RGFW_window_checkEvent == NULL if waitMS == 0, the loop will not wait for events if waitMS > 0, the loop will wait that many miliseconds after there are no more events until it returns if waitMS == -1 or waitMS == the max size of an unsigned 32-bit int, the loop will not return until it gets another event

◆ RGFW_ENUM() [2/2]

typedef RGFW_ENUM ( u8  ,
RGFW_icon   
)

◆ RGFW_getGlobalMousePoint()

RGFWDEF RGFW_point RGFW_getGlobalMousePoint ( void  )

where the mouse is on the screen

◆ RGFW_getScreenSize()

RGFWDEF RGFW_area RGFW_getScreenSize ( void  )

get the size of the screen to an area struct

◆ RGFW_moveToMacOSResourceDir()

RGFWDEF void RGFW_moveToMacOSResourceDir ( void  )

(cocoa only) change directory to resource folder

◆ RGFW_setClassName()

RGFWDEF void RGFW_setClassName ( const char *  name)

the class name for X11 and WinAPI. apps with the same class will be grouped by the WM by default the class name will == the root window's name

◆ RGFW_setXInstName()

RGFWDEF void RGFW_setXInstName ( const char *  name)

X11 instance name (window name will by used by default)

◆ RGFW_stopCheckEvents()

RGFWDEF void RGFW_stopCheckEvents ( void  )

tell RGFW_window_eventWait to stop waiting (to be ran from another thread)

◆ RGFW_window_allowsDND()

RGFWDEF RGFW_bool RGFW_window_allowsDND ( RGFW_window win)

check if DND is allowed

◆ RGFW_window_borderless()

RGFWDEF RGFW_bool RGFW_window_borderless ( RGFW_window win)

◆ RGFW_window_center()

RGFWDEF void RGFW_window_center ( RGFW_window win)

center the window

◆ RGFW_window_checkEvent()

RGFWDEF RGFW_event * RGFW_window_checkEvent ( RGFW_window win)

this function checks an individual event (and updates window structure attributes) this means, using this function without a while loop may cause event lag

ex.

while (RGFW_window_checkEvent(win) != NULL) [this keeps checking events until it reaches the last one]

this function is optional if you choose to use event callbacks, although you still need some way to tell RGFW to process events eg. RGFW_window_checkEvents check current event (returns a pointer to win->event or NULL if there is no event)

◆ RGFW_window_checkEvents()

RGFWDEF void RGFW_window_checkEvents ( RGFW_window win,
i32  waitMS 
)

check all the events until there are none left. This should only be used if you're using callbacks only

◆ RGFW_window_close()

RGFWDEF void RGFW_window_close ( RGFW_window win)

window managment functions close the window and free leftover data

◆ RGFW_window_eventWait()

RGFWDEF void RGFW_window_eventWait ( RGFW_window win,
i32  waitMS 
)

sleep until RGFW gets an event or the timer ends (defined by OS)

◆ RGFW_window_focus()

RGFWDEF void RGFW_window_focus ( RGFW_window win)

sets the focus to this window

◆ RGFW_window_getMousePoint()

RGFWDEF RGFW_point RGFW_window_getMousePoint ( RGFW_window win)

where the mouse is on the window

◆ RGFW_window_hide()

RGFWDEF void RGFW_window_hide ( RGFW_window win)

hide the window

◆ RGFW_window_initBuffer()

RGFWDEF void RGFW_window_initBuffer ( RGFW_window win)

◆ RGFW_window_initBufferPtr()

RGFWDEF void RGFW_window_initBufferPtr ( RGFW_window win,
u8 buffer,
RGFW_area  area 
)

◆ RGFW_window_initBufferSize()

RGFWDEF void RGFW_window_initBufferSize ( RGFW_window win,
RGFW_area  area 
)

◆ RGFW_window_isFloating()

RGFWDEF RGFW_bool RGFW_window_isFloating ( RGFW_window win)

if the window is floating

◆ RGFW_window_isFullscreen()

RGFWDEF RGFW_bool RGFW_window_isFullscreen ( RGFW_window win)

if the window is fullscreen

◆ RGFW_window_isHidden()

RGFWDEF RGFW_bool RGFW_window_isHidden ( RGFW_window win)

if the window is hidden

◆ RGFW_window_isInFocus()

RGFWDEF RGFW_bool RGFW_window_isInFocus ( RGFW_window win)

checks the focus to this window

◆ RGFW_window_isMaximized()

RGFWDEF RGFW_bool RGFW_window_isMaximized ( RGFW_window win)

if the window is maximized

◆ RGFW_window_isMinimized()

RGFWDEF RGFW_bool RGFW_window_isMinimized ( RGFW_window win)

if the window is minimized

◆ RGFW_window_maximize()

RGFWDEF void RGFW_window_maximize ( RGFW_window win)

maximize the window

◆ RGFW_window_minimize()

RGFWDEF void RGFW_window_minimize ( RGFW_window win)

minimize the window (in taskbar (per OS))

◆ RGFW_window_mouseHeld()

RGFWDEF RGFW_bool RGFW_window_mouseHeld ( RGFW_window win)

if the mouse is held by RGFW

◆ RGFW_window_mouseHidden()

RGFWDEF RGFW_bool RGFW_window_mouseHidden ( RGFW_window win)

if the mouse is hidden

◆ RGFW_window_mouseHold()

RGFWDEF void RGFW_window_mouseHold ( RGFW_window win,
RGFW_area  area 
)

◆ RGFW_window_mouseUnhold()

RGFWDEF void RGFW_window_mouseUnhold ( RGFW_window win)

stop holding the mouse and let it move freely

◆ RGFW_window_move()

RGFWDEF void RGFW_window_move ( RGFW_window win,
RGFW_point  v 
)

move a window to a given point

Parameters
vnew pos

◆ RGFW_window_moveMouse()

RGFWDEF void RGFW_window_moveMouse ( RGFW_window win,
RGFW_point  v 
)

move the mouse to a given point

◆ RGFW_window_moveToMonitor()

RGFWDEF void RGFW_window_moveToMonitor ( RGFW_window win,
RGFW_monitor  m 
)

move window to a specific monitor

◆ RGFW_window_opengl_isSoftware()

RGFWDEF RGFW_bool RGFW_window_opengl_isSoftware ( RGFW_window win)

◆ RGFW_window_raise()

RGFWDEF void RGFW_window_raise ( RGFW_window win)

raise the window (to the top)

◆ RGFW_window_resize()

RGFWDEF void RGFW_window_resize ( RGFW_window win,
RGFW_area  a 
)

resize window to a current size/area

Parameters
winsource window
anew size

◆ RGFW_window_restore()

RGFWDEF void RGFW_window_restore ( RGFW_window win)

restore the window from minimized (per OS)

◆ RGFW_window_setAspectRatio()

RGFWDEF void RGFW_window_setAspectRatio ( RGFW_window win,
RGFW_area  a 
)

set window aspect ratio

◆ RGFW_window_setBorder()

RGFWDEF void RGFW_window_setBorder ( RGFW_window win,
RGFW_bool  border 
)

if the window should have a border or not (borderless) based on bool value of border

◆ RGFW_window_setDND()

RGFWDEF void RGFW_window_setDND ( RGFW_window win,
RGFW_bool  allow 
)

turn on / off dnd (RGFW_windowAllowDND stil must be passed to the window)

◆ RGFW_window_setFlags()

RGFWDEF void RGFW_window_setFlags ( RGFW_window win,
RGFW_windowFlags   
)

set the window flags (will undo flags if they don't match the old ones)

◆ RGFW_window_setFloating()

RGFWDEF void RGFW_window_setFloating ( RGFW_window win,
RGFW_bool  floating 
)

make the window a floating window

◆ RGFW_window_setFullscreen()

RGFWDEF void RGFW_window_setFullscreen ( RGFW_window win,
RGFW_bool  fullscreen 
)

turn fullscreen on / off for a window

◆ RGFW_window_setIcon()

RGFWDEF RGFW_bool RGFW_window_setIcon ( RGFW_window win,
u8 icon,
RGFW_area  a,
i32  channels 
)

image MAY be resized by default, set both the taskbar and window icon

Parameters
winsource window
iconicon bitmap
awidth and height of the bitmap
channelshow many channels the bitmap has (rgb : 3, rgba : 4)

◆ RGFW_window_setIconEx()

RGFWDEF RGFW_bool RGFW_window_setIconEx ( RGFW_window win,
u8 icon,
RGFW_area  a,
i32  channels,
u8  type 
)

sets mouse to RGFW_mouse icon (loaded from a bitmap struct)

◆ RGFW_window_setMaxSize()

RGFWDEF void RGFW_window_setMaxSize ( RGFW_window win,
RGFW_area  a 
)

set the maximum dimensions of a window

◆ RGFW_window_setMinSize()

RGFWDEF void RGFW_window_setMinSize ( RGFW_window win,
RGFW_area  a 
)

set the minimum dimensions of a window

◆ RGFW_window_setMouse()

RGFWDEF void RGFW_window_setMouse ( RGFW_window win,
RGFW_mouse mouse 
)

sets the mouse to a standard API cursor (based on RGFW_MOUSE, as seen at the end of the RGFW_HEADER part of this file)

◆ RGFW_window_setMouseDefault()

RGFWDEF RGFW_bool RGFW_window_setMouseDefault ( RGFW_window win)

sets the mouse to the default mouse icon

◆ RGFW_window_setMousePassthrough()

RGFWDEF void RGFW_window_setMousePassthrough ( RGFW_window win,
RGFW_bool  passthrough 
)

turn on / off mouse passthrough

◆ RGFW_window_setMouseStandard()

RGFWDEF RGFW_bool RGFW_window_setMouseStandard ( RGFW_window win,
u8  mouse 
)

◆ RGFW_window_setName()

RGFWDEF void RGFW_window_setName ( RGFW_window win,
const char *  name 
)

rename window to a given string

◆ RGFW_window_setOpacity()

RGFWDEF void RGFW_window_setOpacity ( RGFW_window win,
u8  opacity 
)

sets the opacity of a window

◆ RGFW_window_setShouldClose()

RGFWDEF void RGFW_window_setShouldClose ( RGFW_window win,
RGFW_bool  shouldClose 
)

◆ RGFW_window_shouldClose()

RGFWDEF RGFW_bool RGFW_window_shouldClose ( RGFW_window win)

if the window should close (RGFW_close was sent or escape was pressed)

◆ RGFW_window_show()

RGFWDEF void RGFW_window_show ( RGFW_window win)

show the window

◆ RGFW_window_showMouse()

RGFWDEF void RGFW_window_showMouse ( RGFW_window win,
RGFW_bool  show 
)

show the mouse or hide the mouse