Wuhoo
0.1
Windows using header only
|
Go to the source code of this file.
Classes | |
struct | WuhooEventKey |
Struct representing a keyboard press. More... | |
struct | WuhooRGBA |
Helper struct to work with RGBA system backed buffers. The alpha channel is currently not respected in any backend. More... | |
struct | WuhooEventMouseMove |
struct | WuhooEventMousePress |
struct | WuhooEventMouseWheel |
struct | WuhooEventWindow |
struct | WuhooEventDrop |
union | WuhooEventData |
struct | WuhooEvent |
The event union that holds event-specific data. More... | |
struct | WuhooWindow |
Macros | |
#define | WuhooNull ((void*)0) |
#define | WuhooSuccess WuhooNull |
#define | WuhooDefaultPosition (-2147483647 - 1) /* INT_MIN */ |
#define | WuhooTrue (1) |
#define | WuhooInternal static |
#define | WuhooYes WuhooTrue |
#define | WuhooFalse (0) |
#define | WuhooNo WuhooFalse |
#define | WuhooUnused(x) (void)(x) |
#define | WuhooOnlySet(value, flag) (((flag) & (value)) == (flag)) |
#define | WuhooFlag(shift_count) (1 << shift_count) |
#define | WUHOO_STRING "Wuhoo" |
#define | WUHOO_MAX_FILE_NAME_LENGTH 256 |
#define | WUHOO_MAX_TITLE_LENGTH 256 |
#define | WUHOO_MAX_CHARACTER_SIZE 6 |
Typedefs | |
typedef void * | WuhooHandle |
typedef void * | WuhooResult |
typedef unsigned char | WuhooBoolean |
typedef unsigned char | WuhooByte |
typedef unsigned short | WuhooR5G6B5 |
typedef unsigned short | WuhooR5G5B5 |
typedef unsigned int | WuhooSize |
typedef unsigned int | WuhooFlags |
typedef unsigned int | WuhooGLAttr |
typedef enum WuhooKeyModifiersEnum | WuhooMouseModifiersEnum |
typedef int | WuhooMouseModifiers |
typedef int | WuhooKeyModifiers |
typedef int | WuhooWindowFlags |
typedef unsigned int | WuhooUTF32 |
typedef unsigned short | WuhooUTF16 |
typedef unsigned char | WuhooUTF8 |
typedef WuhooResult(* | WuhooConvertRGBA) (void *dst, WuhooRGBA const *const src, WuhooSize x, WuhooSize y, WuhooSize width, WuhooSize height, WuhooSize src_width, WuhooSize src_height) |
Enumerations | |
enum | WuhooFlagsEnum { WUHOO_FLAG_TITLED = WuhooFlag(0), WUHOO_FLAG_CANVAS = WuhooFlag(2), WUHOO_FLAG_RESIZEABLE = WuhooFlag(4), WUHOO_FLAG_BORDERLESS = WuhooFlag(5), WUHOO_FLAG_MOUSE_CAPTURE = WuhooFlag(6), WUHOO_FLAG_FILE_DROP = WuhooFlag(7), WUHOO_FLAG_CLOSEABLE = WuhooFlag(8), WUHOO_FLAG_CLIENT_REGION = WuhooFlag(9), WUHOO_FLAG_WINDOW_REGION = WuhooFlag(10) } |
enum | WuhooKeyModifiersEnum { WUHOO_KMOD_NONE = 0, WUHOO_KMOD_LSHIFT = WuhooFlag(0), WUHOO_KMOD_RSHIFT = WuhooFlag(1), WUHOO_KMOD_LCTRL = WuhooFlag(2), WUHOO_KMOD_RCTRL = WuhooFlag(3), WUHOO_KMOD_LALT = WuhooFlag(4), WUHOO_KMOD_RALT = WuhooFlag(5), WUHOO_KMOD_LGUI = WuhooFlag(6), WUHOO_KMOD_RGUI = WuhooFlag(7), WUHOO_KMOD_NUM = WuhooFlag(8), WUHOO_KMOD_CAPS = WuhooFlag(9), WUHOO_KMOD_MODE = WuhooFlag(10), WUHOO_KMOD_DEADCHAR = WuhooFlag(11), WUHOO_KMOD_CTRL = (WUHOO_KMOD_LCTRL | WUHOO_KMOD_RCTRL), WUHOO_KMOD_SHIFT = (WUHOO_KMOD_LSHIFT | WUHOO_KMOD_RSHIFT), WUHOO_KMOD_ALT = (WUHOO_KMOD_LALT | WUHOO_KMOD_RALT), WUHOO_KMOD_GUI = (WUHOO_KMOD_LGUI | WUHOO_KMOD_RGUI), WUHOO_KMOD_MAX } |
enum | WuhooKeyCode { WUHOO_VKEY_UNKNOWN, WUHOO_VKEY_BACKSPACE = 8, WUHOO_VKEY_FORWARD_DELETE = WUHOO_VKEY_BACKSPACE, WUHOO_VKEY_TAB = 9, WUHOO_VKEY_ENTER = 13, WUHOO_VKEY_KPAD_ENTER, WUHOO_VKEY_ESCAPE = 27, WUHOO_VKEY_SPACE = ' ', WUHOO_VKEY_QUOTE = '\'', WUHOO_VKEY_COMMA = ',', WUHOO_VKEY_MINUS = '-', WUHOO_VKEY_PERIOD = '.', WUHOO_VKEY_FORWARD_SLASH = '/', WUHOO_VKEY_0 = '0', WUHOO_VKEY_1, WUHOO_VKEY_2, WUHOO_VKEY_3, WUHOO_VKEY_4, WUHOO_VKEY_5, WUHOO_VKEY_6, WUHOO_VKEY_7, WUHOO_VKEY_8, WUHOO_VKEY_9 = '9', WUHOO_VKEY_SEMICOLON = ';', WUHOO_VKEY_EQUALS = '=', WUHOO_VKEY_A = 'A', WUHOO_VKEY_B, WUHOO_VKEY_C, WUHOO_VKEY_D, WUHOO_VKEY_E, WUHOO_VKEY_F, WUHOO_VKEY_G, WUHOO_VKEY_H, WUHOO_VKEY_I, WUHOO_VKEY_J, WUHOO_VKEY_K, WUHOO_VKEY_L, WUHOO_VKEY_M, WUHOO_VKEY_N, WUHOO_VKEY_O, WUHOO_VKEY_P, WUHOO_VKEY_Q, WUHOO_VKEY_R, WUHOO_VKEY_S, WUHOO_VKEY_T, WUHOO_VKEY_U, WUHOO_VKEY_V, WUHOO_VKEY_W, WUHOO_VKEY_X, WUHOO_VKEY_Y, WUHOO_VKEY_Z = 'Z', WUHOO_VKEY_LEFT_BRACKET = '[', WUHOO_VKEY_BACK_SLASH = '\\', WUHOO_VKEY_RIGHT_BRACKET = ']', WUHOO_VKEY_GRAVE = '`', WUHOO_VKEY_TILDA = WUHOO_VKEY_GRAVE, WUHOO_VKEY_DELETE = 127, WUHOO_VKEY_F1, WUHOO_VKEY_F2, WUHOO_VKEY_F3, WUHOO_VKEY_F4, WUHOO_VKEY_F5, WUHOO_VKEY_F6, WUHOO_VKEY_F7, WUHOO_VKEY_F8, WUHOO_VKEY_F9, WUHOO_VKEY_F10, WUHOO_VKEY_F11, WUHOO_VKEY_F12, WUHOO_VKEY_F13, WUHOO_VKEY_PRINTSCREEN = WUHOO_VKEY_F13, WUHOO_VKEY_F14, WUHOO_VKEY_F15, WUHOO_VKEY_INSERT, WUHOO_VKEY_HELP = WUHOO_VKEY_INSERT, WUHOO_VKEY_HOME, WUHOO_VKEY_PAGE_UP, WUHOO_VKEY_END, WUHOO_VKEY_PAGE_DOWN, WUHOO_VKEY_MENU, WUHOO_VKEY_KPAD_0, WUHOO_VKEY_KPAD_1, WUHOO_VKEY_KPAD_2, WUHOO_VKEY_KPAD_3, WUHOO_VKEY_KPAD_4, WUHOO_VKEY_KPAD_5, WUHOO_VKEY_KPAD_6, WUHOO_VKEY_KPAD_7, WUHOO_VKEY_KPAD_8, WUHOO_VKEY_KPAD_9, WUHOO_VKEY_KPAD_DIVIDE, WUHOO_VKEY_KPAD_SLASH = WUHOO_VKEY_KPAD_DIVIDE, WUHOO_VKEY_KPAD_PLUS, WUHOO_VKEY_KPAD_MINUS, WUHOO_VKEY_KPAD_EQUALS, WUHOO_VKEY_KPAD_MULITPLY, WUHOO_VKEY_KPAD_DECIMAL, WUHOO_VKEY_KPAD_NUM_LOCK, WUHOO_VKEY_KPAD_COMMA = WUHOO_VKEY_KPAD_DECIMAL, WUHOO_VKEY_SHIFT, WUHOO_VKEY_CONTROL, WUHOO_VKEY_ALT, WUHOO_VKEY_CAPS_LOCK, WUHOO_VKEY_UP, WUHOO_VKEY_DOWN, WUHOO_VKEY_RIGHT, WUHOO_VKEY_LEFT, WUHOO_VKEY_MAX } |
enum | WuhooWindowFlagsEnum { WUHOO_WINDOW_FLAG_RESIZED = WuhooFlag(0), WUHOO_WINDOW_FLAG_FULL_SCREEN = WuhooFlag(1), WUHOO_WINDOW_FLAG_FOCUS_GAINED = WuhooFlag(2), WUHOO_WINDOW_FLAG_FOCUS_LOST = WuhooFlag(3), WUHOO_WINDOW_FLAG_MINIMIZED = WuhooFlag(4), WUHOO_WINDOW_FLAG_MAXIMIZED = WuhooFlag(5), WUHOO_WINDOW_FLAG_MOVED = WuhooFlag(6), WUHOO_WINDOW_FLAG_CLOSED = WuhooFlag(7), WUHOO_WINDOW_FLAG_REGION_UPDATED = WuhooFlag(8), WUHOO_WINDOW_FLAG_DROP_STARTED = WuhooFlag(9) } |
enum | WuhooWindowState { WUHOO_WSTATE_UNKNOWN, WUHOO_WSTATE_RESIZED, WUHOO_WSTATE_FULL_SCREENED, WUHOO_WSTATE_MOVED, WUHOO_WSTATE_MINIMIZED, WUHOO_WSTATE_MAXIMIZED, WUHOO_WSTATE_CREATED, WUHOO_WSTATE_CLOSED, WUHOO_WSTATE_UNFOCUSED, WUHOO_WSTATE_FOCUSED, WUHOO_WSTATE_HIDDEN, WUHOO_WSTATE_INVALIDATED, WUHOO_WSTATE_MAX } |
enum | WuhooEventType { WUHOO_EVT_NONE, WUHOO_EVT_WINDOW, WUHOO_EVT_KEY, WUHOO_EVT_MOUSE_PRESS, WUHOO_EVT_MOUSE_MOVE, WUHOO_EVT_MOUSE_WHEEL, WUHOO_EVT_DROP, WUHOO_EVT_MAX } |
enum | WuhooKeyState { WUHOO_KSTATE_UNKNOWN, WUHOO_KSTATE_UP, WUHOO_KSTATE_DOWN, WUHOO_KSTATE_MAX } |
enum | WuhooMouseState { WUHOO_MSTATE_UNKNOWN, WUHOO_MSTATE_LPRESSED, WUHOO_MSTATE_LRELEASED, WUHOO_MSTATE_RPRESSED, WUHOO_MSTATE_RRELEASED, WUHOO_MSTATE_MPRESSED, WUHOO_MSTATE_MRELEASED, WUHOO_MSTATE_MAX } |
Functions | |
WuhooResult | WuhooWindowInit (WuhooWindow *window) |
WuhooResult | WuhooWindowDestroy (WuhooWindow *window) |
WuhooResult | WuhooWindowCreate (WuhooWindow *window, int posx, int posy, WuhooSize width, WuhooSize height, const char *title, WuhooFlags flags, const void *data) |
WuhooResult | WuhooWindowEventNext (WuhooWindow *window, WuhooEvent *event) |
WuhooResult | WuhooWindowDropContentsGet (WuhooWindow *window, WuhooEvent *event, char *buffer, WuhooSize buffer_size) |
WuhooResult | WuhooWindowRegionSet (WuhooWindow *window, int posx, int posy, WuhooSize width, WuhooSize height) |
WuhooResult | WuhooWindowRegionGet (WuhooWindow *window, int *posx, int *posy, WuhooSize *width, WuhooSize *height) |
WuhooResult | WuhooWindowClientRegionGet (WuhooWindow *window, int *posx, int *posy, WuhooSize *width, WuhooSize *height) |
WuhooResult | WuhooWindowClientRegionSet (WuhooWindow *window, int posx, int posy, WuhooSize width, WuhooSize height) |
WuhooResult | WuhooWindowBlit (WuhooWindow *window, WuhooRGBA *pixels, WuhooSize src_x, WuhooSize src_y, WuhooSize src_width, WuhooSize src_height, WuhooSize dst_x, WuhooSize dst_y, WuhooSize dst_width, WuhooSize dst_height) |
WuhooResult | WuhooWindowShow (WuhooWindow *window) |
WuhooResult | WuhooWindowSetTitle (WuhooWindow *window, const char *title) |
const char * | WuhooResultString (WuhooResult result) |
wuhoo single header library.
#define WUHOO_STRING "Wuhoo" |
Wuhoo String Representation
#define WuhooSuccess WuhooNull |
Returned if everything has gone well
enum WuhooEventType |
enum WuhooMouseState |
Mouse button state of the triggered WuhooEventMouseMove, WuhooEventMousePress or WuhooEventMouseWheel.
enum WuhooWindowState |
State of the window that triggered the WuhooEventWindow.
const char* WuhooResultString | ( | WuhooResult | result | ) |
A descriptive string of the WuhooResult.
result | A WuhooResult returned from any of Wuhoo's APIs. |
WuhooResult WuhooWindowBlit | ( | WuhooWindow * | window, |
WuhooRGBA * | pixels, | ||
WuhooSize | src_x, | ||
WuhooSize | src_y, | ||
WuhooSize | src_width, | ||
WuhooSize | src_height, | ||
WuhooSize | dst_x, | ||
WuhooSize | dst_y, | ||
WuhooSize | dst_width, | ||
WuhooSize | dst_height | ||
) |
Blit pixels to the framebuffer using the window system's native calls. In case of a graphics-enabled window (e.g. OpenGL) this call simply blits the contents of the API buffer to the screen by calling the appropriate API calss (e.g. SwapBuffer, flush e.t.c.).
The current implementation does not properly handle regional drawing.
window | The WuhooWindow struct handle. |
pixels | RGBA unsigned char pixel buffer. |
src_x | Read from source starting at x (Not Implemented Yet). |
src_y | Read from source starting at y (Not Implemented Yet). |
src_width | width of the source region. |
src_height | height of the source region. |
dst_x | Write to destination starting at x. |
dst_y | Write to destination starting at y. |
dst_width | width of the destination region. |
dst_height | height of the destination region. |
WuhooResult WuhooWindowClientRegionGet | ( | WuhooWindow * | window, |
int * | posx, | ||
int * | posy, | ||
WuhooSize * | width, | ||
WuhooSize * | height | ||
) |
Get a window's position and client region size.
window | The WuhooWindow struct handle. |
posx | The horizontal postion of the window. |
posy | The vertical postion of the window. |
width | The width of the client region of the window. |
height | The height of the client region of the window. |
WuhooResult WuhooWindowClientRegionSet | ( | WuhooWindow * | window, |
int | posx, | ||
int | posy, | ||
WuhooSize | width, | ||
WuhooSize | height | ||
) |
Set a window's position and client region size.
window | The WuhooWindow struct handle. |
posx | The new horizontal postion of the window. |
posy | The new vertical postion of the window. |
width | The new width of the client region of the window. |
height | The new height of the client region of the window. |
WuhooResult WuhooWindowCreate | ( | WuhooWindow * | window, |
int | posx, | ||
int | posy, | ||
WuhooSize | width, | ||
WuhooSize | height, | ||
const char * | title, | ||
WuhooFlags | flags, | ||
const void * | data | ||
) |
Allocate all the resources required for a WuhooWindow struct and prepare for a native Window to show.
window | The WuhooWindow struct handle. |
posx | Horizontal window offset of the upper left corner. |
posy | Vertical window offset of the upper left corner. |
width | width of the window. |
height | height of the window. |
title | Title of the created window. |
flags | Flags to customize the created window. |
data | Additional data (Currently unused). |
WuhooResult WuhooWindowDestroy | ( | WuhooWindow * | window | ) |
Properly release resources aquired for a WuhooWindow struct during use of the Wuhoo API.
WuhooWindow | the window struct to destroy. |
WuhooResult WuhooWindowDropContentsGet | ( | WuhooWindow * | window, |
WuhooEvent * | event, | ||
char * | buffer, | ||
WuhooSize | buffer_size | ||
) |
Allocate all the resources required for a WuhooWindow struct and prepare for a native Window to show.
window | The WuhooWindow struct handle. |
event | The WuhooEvent struct that triggered this event in the first place. |
buffer | The buffer that receives the UTF-8 encoded list of the dropeed files. |
buffer_size | The size of the provided buffer (If you can't much the requested size of the event, you will get a truncated list). |
WuhooResult WuhooWindowEventNext | ( | WuhooWindow * | window, |
WuhooEvent * | event | ||
) |
Allocate all the resources required for a WuhooWindow struct and prepare for a native Window to show.
window | The WuhooWindow struct handle. |
event | The WuhooEvent struct to receive the new event information. |
WuhooResult WuhooWindowInit | ( | WuhooWindow * | window | ) |
Properly initialize a WuhooWindow struct for use by the Wuhoo API.
WuhooWindow | the window struct to initialize. |
WuhooResult WuhooWindowRegionGet | ( | WuhooWindow * | window, |
int * | posx, | ||
int * | posy, | ||
WuhooSize * | width, | ||
WuhooSize * | height | ||
) |
Get a window's position and client region size.
window | The WuhooWindow struct handle. |
posx | The horizontal postion of the window. |
posy | The vertical postion of the window. |
width | The width of the of the window. |
height | The height of the of the window (including title bar). |
WuhooResult WuhooWindowRegionSet | ( | WuhooWindow * | window, |
int | posx, | ||
int | posy, | ||
WuhooSize | width, | ||
WuhooSize | height | ||
) |
Set a window's position and size.
window | The WuhooWindow struct handle. |
posx | The new horizontal postion of the window. |
posy | The new vertical postion of the window. |
width | The new width of the window. |
height | The new height of the window. |
WuhooResult WuhooWindowSetTitle | ( | WuhooWindow * | window, |
const char * | title | ||
) |
Set the title of the window. The title parameter beeds to be encoded in UTF-8.
window | The WuhooWindow struct handle. |
title | The new title in UTF-8 encoding. |
WuhooResult WuhooWindowShow | ( | WuhooWindow * | window | ) |
Present the previously inited and created WuhooWindow The window should be visible on the screen after this call