Window.h File Reference

WINDOW is a simple cross-platform API for accessing the native platform window, keyboard and mouse io. More...

#include <libos/Defines.h>
Include dependency graph for Window.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  losWindowInfo
 losWindowInfo is the window creation struct we pass this into the creation function for the library to create a window object More...
 

Typedefs

typedef struct losWindow_T * losWindow
 this is the Library object that is used to Control the Native as the user only holds a pointer to the library object that is controlled by the library. More...
 
typedef enum losMouseButton losMouseButton
 losMouseButton is the programmatically encoded form of the platforms mouse buttons
 
typedef enum losKeyboardButton losKeyboardButton
 losKeyboardButton is the programmatically encoded form of the platforms keyboard keys
 
typedef struct losWindowInfo losWindowInfo
 losWindowInfo is the window creation struct we pass this into the creation function for the library to create a window object
 

Enumerations

enum  losMouseButton { LOS_RIGHT_BUTTON , LOS_MIDDLE_BUTTON , LOS_LEFT_BUTTON }
 losMouseButton is the programmatically encoded form of the platforms mouse buttons
 
enum  losKeyboardButton {
  LOS_KEY_0 , LOS_KEY_1 , LOS_KEY_2 , LOS_KEY_3 ,
  LOS_KEY_4 , LOS_KEY_5 , LOS_KEY_6 , LOS_KEY_7 ,
  LOS_KEY_8 , LOS_KEY_9 , LOS_KEY_A , LOS_KEY_B ,
  LOS_KEY_C , LOS_KEY_D , LOS_KEY_E , LOS_KEY_F ,
  LOS_KEY_G , LOS_KEY_H , LOS_KEY_I , LOS_KEY_J ,
  LOS_KEY_K , LOS_KEY_L , LOS_KEY_M , LOS_KEY_N ,
  LOS_KEY_O , LOS_KEY_P , LOS_KEY_Q , LOS_KEY_R ,
  LOS_KEY_S , LOS_KEY_T , LOS_KEY_U , LOS_KEY_V ,
  LOS_KEY_W , LOS_KEY_X , LOS_KEY_Y , LOS_KEY_Z ,
  LOS_KEY_APOSTROPHE , LOS_KEY_BACKSLASH , LOS_KEY_COMMA , LOS_KEY_LEFT_BRACKET ,
  LOS_KEY_MINUS , LOS_KEY_PERIOD , LOS_KEY_RIGHT_BRACKET , LOS_KEY_SEMICOLON ,
  LOS_KEY_SLASH , LOS_KEY_BACKSPACE , LOS_KEY_DELETE , LOS_KEY_END ,
  LOS_KEY_ENTER , LOS_KEY_ESCAPE , LOS_KEY_HOME , LOS_KEY_INSERT ,
  LOS_KEY_PAGE_DOWN , LOS_KEY_PAGE_UP , LOS_KEY_PAUSE , LOS_KEY_SPACE ,
  LOS_KEY_TAB , LOS_KEY_CAPS_LOCK , LOS_KEY_NUM_LOCK , LOS_KEY_SCROLL_LOCK ,
  LOS_KEY_F1 , LOS_KEY_F2 , LOS_KEY_F3 , LOS_KEY_F4 ,
  LOS_KEY_F5 , LOS_KEY_F6 , LOS_KEY_F7 , LOS_KEY_F8 ,
  LOS_KEY_F9 , LOS_KEY_F10 , LOS_KEY_F11 , LOS_KEY_F12 ,
  LOS_KEY_ALT , LOS_KEY_LEFT_ALT , LOS_KEY_RIGHT_ALT , LOS_KEY_CONTROL ,
  LOS_KEY_LEFT_CONTROL , LOS_KEY_RIGHT_CONTROL , LOS_KEY_SHIFT , LOS_KEY_LEFT_SHIFT ,
  LOS_KEY_RIGHT_SHIFT , LOS_KEY_LEFT_SUPER , LOS_KEY_RIGHT_SUPER , LOS_KEY_PRINT_SCREEN ,
  LOS_KEY_DOWN , LOS_KEY_LEFT , LOS_KEY_RIGHT , LOS_KEY_UP ,
  LOS_KEY_NUM_PAD_0 , LOS_KEY_NUM_PAD_1 , LOS_KEY_NUM_PAD_2 , LOS_KEY_NUM_PAD_3 ,
  LOS_KEY_NUM_PAD_4 , LOS_KEY_NUM_PAD_5 , LOS_KEY_NUM_PAD_6 , LOS_KEY_NUM_PAD_7 ,
  LOS_KEY_NUM_PAD_8 , LOS_KEY_NUM_PAD_9 , LOS_KEY_ADD , LOS_KEY_DECIMAL ,
  LOS_KEY_DIVIDE , LOS_KEY_EQUAL , LOS_KEY_MULTIPLY , LOS_KEY_SUBTRACT
}
 losKeyboardButton is the programmatically encoded form of the platforms keyboard keys More...
 

Functions

EXPORT_DLL enum losResult losCreateWindow (losWindow *window_handle, losWindowInfo window_info)
 losCreateWindow is to create the library object but dose not release the object to the library user More...
 
EXPORT_DLL enum losResult losUpdateWindow (losWindow window_handle)
 losUpdateWindow is used to pump the event loop of the native window 1 call = 1 pump More...
 
EXPORT_DLL struct losSize losRequestWindowSize (losWindow window_handle)
 losUpdateWindow is used to get the current window size of the window at the time of the request More...
 
EXPORT_DLL uint8_t losIsKeyDown (losWindow window_handle, losKeyboardButton button)
 losIsKeyDown is used for the library user to ask if a keyboard button is active More...
 
EXPORT_DLL uint8_t losIsMouseDown (losWindow window_handle, losMouseButton button)
 losIsMouseDown is used for the library user to ask if a mouse button is active More...
 
EXPORT_DLL enum losResult losRequestClose (losWindow window_handle)
 losIsMouseDown is used for the library user to ask the window to close More...
 
EXPORT_DLL struct losSize losRequestMousePosition (losWindow window_handle)
 losRequestMousePosition is used for the library user to ask where the mouse is in the window More...
 
EXPORT_DLL struct losSize losRequestMouseWheelDelta (losWindow window_handle)
 losRequestMouseWheelDelta is used for the library user to ask for the mouse wheel delta More...
 
EXPORT_DLL struct losSize losIsBeingPressed (losWindow window_handle)
 losRequestMousePosition is used for the library user to ask where the screen is being touched More...
 
EXPORT_DLL void losDestroyWindow (losWindow window_handle)
 losDestroyWindow is to close the library object and safely delete it More...
 

Detailed Description

WINDOW is a simple cross-platform API for accessing the native platform window, keyboard and mouse io.

Author
Luke Shore luket.nosp@m.hemo.nosp@m.dded@.nosp@m.gmai.nosp@m.l.com
Version
1.0
Date
05/12/2022

Typedef Documentation

◆ losWindow

typedef struct losWindow_T* losWindow

this is the Library object that is used to Control the Native as the user only holds a pointer to the library object that is controlled by the library.

Importation of libraries

Enumeration Type Documentation

◆ losKeyboardButton

losKeyboardButton is the programmatically encoded form of the platforms keyboard keys

Enumerator
LOS_KEY_0 

UTF-8 (0)

LOS_KEY_1 

UTF-8 (1)

LOS_KEY_2 

UTF-8 (2)

LOS_KEY_3 

UTF-8 (3)

LOS_KEY_4 

UTF-8 (4)

LOS_KEY_5 

UTF-8 (5)

LOS_KEY_6 

UTF-8 (6)

LOS_KEY_7 

UTF-8 (7)

LOS_KEY_8 

UTF-8 (8)

LOS_KEY_9 

UTF-8 (9)

LOS_KEY_A 

UTF-8 (a)

LOS_KEY_B 

UTF-8 (b)

LOS_KEY_C 

UTF-8 (c)

LOS_KEY_D 

UTF-8 (d)

LOS_KEY_E 

UTF-8 (e)

LOS_KEY_F 

UTF-8 (f)

LOS_KEY_G 

UTF-8 (g)

LOS_KEY_H 

UTF-8 (h)

LOS_KEY_I 

UTF-8 (i)

LOS_KEY_J 

UTF-8 (j)

LOS_KEY_K 

UTF-8 (k)

LOS_KEY_L 

UTF-8 (l)

LOS_KEY_M 

UTF-8 (m)

LOS_KEY_N 

UTF-8 (n)

LOS_KEY_O 

UTF-8 (o)

LOS_KEY_P 

UTF-8 (p)

LOS_KEY_Q 

UTF-8 (q)

LOS_KEY_R 

UTF-8 (r)

LOS_KEY_S 

UTF-8 (s)

LOS_KEY_T 

UTF-8 (t)

LOS_KEY_U 

UTF-8 (u)

LOS_KEY_V 

UTF-8 (v)

LOS_KEY_W 

UTF-8 (w)

LOS_KEY_X 

UTF-8 (x)

LOS_KEY_Y 

UTF-8 (y)

LOS_KEY_Z 

UTF-8 (z)

LOS_KEY_APOSTROPHE 

UTF-8 (')

LOS_KEY_BACKSLASH 

UTF-8 ()

LOS_KEY_COMMA 

UTF-8 (,)

LOS_KEY_LEFT_BRACKET 

UTF-8 ('(')

LOS_KEY_MINUS 

UTF-8 (-)

LOS_KEY_PERIOD 

UTF-8 (.)

LOS_KEY_RIGHT_BRACKET 

UTF-8 (')')

LOS_KEY_SEMICOLON 

UTF-8 (;)

LOS_KEY_SLASH 

UTF-8 (/)

LOS_KEY_BACKSPACE 

UTF-8 ('<-')

LOS_KEY_DELETE 

UTF-8 (delete)

LOS_KEY_END 

UTF-8 (end)

LOS_KEY_ENTER 

UTF-8 (return)

LOS_KEY_ESCAPE 

UTF-8 (esc)

LOS_KEY_HOME 

UTF-8 (home)

LOS_KEY_INSERT 

UTF-8 (insert)

LOS_KEY_PAGE_DOWN 

UTF-8 (/)

LOS_KEY_PAGE_UP 

UTF-8 (\/)

LOS_KEY_PAUSE 

UTF-8 (pause)

LOS_KEY_SPACE 

UTF-8 (' ')

LOS_KEY_TAB 

UTF-8 (' ')

LOS_KEY_CAPS_LOCK 

UTF-8 (cap_lock)

LOS_KEY_NUM_LOCK 

UTF-8 (num_lock)

LOS_KEY_SCROLL_LOCK 

UTF-8 (scroll_lock)

LOS_KEY_F1 

UTF-8 (f1)

LOS_KEY_F2 

UTF-8 (f2)

LOS_KEY_F3 

UTF-8 (f3)

LOS_KEY_F4 

UTF-8 (f4)

LOS_KEY_F5 

UTF-8 (f5)

LOS_KEY_F6 

UTF-8 (f6)

LOS_KEY_F7 

UTF-8 (f7)

LOS_KEY_F8 

UTF-8 (f8)

LOS_KEY_F9 

UTF-8 (f9)

LOS_KEY_F10 

UTF-8 (f10)

LOS_KEY_F11 

UTF-8 (f11)

LOS_KEY_F12 

UTF-8 (f12)

LOS_KEY_ALT 

UTF-8 (alt left)

LOS_KEY_LEFT_ALT 

UTF-8 (alt left)

LOS_KEY_RIGHT_ALT 

UTF-8 (alt right)

LOS_KEY_CONTROL 

UTF-8 (control left)

LOS_KEY_LEFT_CONTROL 

UTF-8 (control left)

LOS_KEY_RIGHT_CONTROL 

UTF-8 (control right)

LOS_KEY_SHIFT 

UTF-8 (shift left)

LOS_KEY_LEFT_SHIFT 

UTF-8 (shift left)

LOS_KEY_RIGHT_SHIFT 

UTF-8 (shift right)

LOS_KEY_LEFT_SUPER 

UTF-8 (win left)

LOS_KEY_RIGHT_SUPER 

UTF-8 (win right)

LOS_KEY_PRINT_SCREEN 

UTF-8 (print_screen)

LOS_KEY_DOWN 

UTF-8 (\/)

LOS_KEY_LEFT 

UTF-8 ('->')

LOS_KEY_RIGHT 

UTF-8 ('<-')

LOS_KEY_UP 

UTF-8 (/)

LOS_KEY_NUM_PAD_0 

UTF-8 (0)

LOS_KEY_NUM_PAD_1 

UTF-8 (1)

LOS_KEY_NUM_PAD_2 

UTF-8 (2)

LOS_KEY_NUM_PAD_3 

UTF-8 (3)

LOS_KEY_NUM_PAD_4 

UTF-8 (4)

LOS_KEY_NUM_PAD_5 

UTF-8 (5)

LOS_KEY_NUM_PAD_6 

UTF-8 (6)

LOS_KEY_NUM_PAD_7 

UTF-8 (7)

LOS_KEY_NUM_PAD_8 

UTF-8 (8)

LOS_KEY_NUM_PAD_9 

UTF-8 (9)

LOS_KEY_ADD 

UTF-8 (+)

LOS_KEY_DECIMAL 

UTF-8 (.)

LOS_KEY_DIVIDE 

UTF-8 (/)

LOS_KEY_EQUAL 

UTF-8 (=)

LOS_KEY_MULTIPLY 

UTF-8 (*)

LOS_KEY_SUBTRACT 

UTF-8 (-)

Function Documentation

◆ losCreateWindow()

EXPORT_DLL enum losResult losCreateWindow ( losWindow window_handle,
losWindowInfo  window_info 
)

losCreateWindow is to create the library object but dose not release the object to the library user

Parameters
[out]window_handle
[in]window_info
Returns
losResult

◆ losDestroyWindow()

EXPORT_DLL void losDestroyWindow ( losWindow  window_handle)

losDestroyWindow is to close the library object and safely delete it

Parameters
[in]window_handle

◆ losIsBeingPressed()

EXPORT_DLL struct losSize losIsBeingPressed ( losWindow  window_handle)

losRequestMousePosition is used for the library user to ask where the screen is being touched

Parameters
[in]window_handle
Returns
losSize
Note
this is note implemented on platforms as of V1.0.0

◆ losIsKeyDown()

EXPORT_DLL uint8_t losIsKeyDown ( losWindow  window_handle,
losKeyboardButton  button 
)

losIsKeyDown is used for the library user to ask if a keyboard button is active

Parameters
[in]window_handle
[in]button
Returns
uint8_t

◆ losIsMouseDown()

EXPORT_DLL uint8_t losIsMouseDown ( losWindow  window_handle,
losMouseButton  button 
)

losIsMouseDown is used for the library user to ask if a mouse button is active

Parameters
[in]window_handle
[in]button
Returns
uint8_t

◆ losRequestClose()

EXPORT_DLL enum losResult losRequestClose ( losWindow  window_handle)

losIsMouseDown is used for the library user to ask the window to close

Parameters
[in]window_handle
Returns
losResult

◆ losRequestMousePosition()

EXPORT_DLL struct losSize losRequestMousePosition ( losWindow  window_handle)

losRequestMousePosition is used for the library user to ask where the mouse is in the window

Parameters
[in]window_handle
Returns
losSize

◆ losRequestMouseWheelDelta()

EXPORT_DLL struct losSize losRequestMouseWheelDelta ( losWindow  window_handle)

losRequestMouseWheelDelta is used for the library user to ask for the mouse wheel delta

Parameters
[in]window_handle
Returns
losSize
Note
this is note implemented on all platforms as of V1.0.0

◆ losRequestWindowSize()

EXPORT_DLL struct losSize losRequestWindowSize ( losWindow  window_handle)

losUpdateWindow is used to get the current window size of the window at the time of the request

Parameters
[in]window_handle
Returns
losSize

◆ losUpdateWindow()

EXPORT_DLL enum losResult losUpdateWindow ( losWindow  window_handle)

losUpdateWindow is used to pump the event loop of the native window 1 call = 1 pump

Parameters
[in]window_handle
Returns
losResult
Note
the way to check if the window should close check to see if function returns "LOS_WINDOW_CLOSE"