add ui module
This commit is contained in:
parent
1744e689b5
commit
6008ebf5ed
12 changed files with 703 additions and 215 deletions
58
src/pxl8_ui.h
Normal file
58
src/pxl8_ui.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#pragma once
|
||||
|
||||
#include "pxl8_gfx.h"
|
||||
#include "pxl8_types.h"
|
||||
|
||||
typedef struct pxl8_ui pxl8_ui;
|
||||
|
||||
typedef struct pxl8_frame_theme {
|
||||
u8 bg_color;
|
||||
u32 sprite_id;
|
||||
i32 corner_size;
|
||||
i32 edge_size;
|
||||
i32 padding;
|
||||
} pxl8_frame_theme;
|
||||
|
||||
typedef struct pxl8_menu_item {
|
||||
bool enabled;
|
||||
const char* label;
|
||||
} pxl8_menu_item;
|
||||
|
||||
typedef enum pxl8_ui_options {
|
||||
PXL8_UI_NOCLOSE = 1 << 0,
|
||||
PXL8_UI_NOFRAME = 1 << 1,
|
||||
PXL8_UI_NORESIZE = 1 << 2,
|
||||
PXL8_UI_NOTITLE = 1 << 3
|
||||
} pxl8_ui_options;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
pxl8_ui* pxl8_ui_create(pxl8_gfx* gfx);
|
||||
void pxl8_ui_destroy(pxl8_ui* ui);
|
||||
|
||||
void pxl8_ui_frame_begin(pxl8_ui* ui);
|
||||
void pxl8_ui_frame_end(pxl8_ui* ui);
|
||||
|
||||
void pxl8_ui_input_keydown(pxl8_ui* ui, i32 key);
|
||||
void pxl8_ui_input_keyup(pxl8_ui* ui, i32 key);
|
||||
void pxl8_ui_input_mousedown(pxl8_ui* ui, i32 x, i32 y, i32 button);
|
||||
void pxl8_ui_input_mousemove(pxl8_ui* ui, i32 x, i32 y);
|
||||
void pxl8_ui_input_mouseup(pxl8_ui* ui, i32 x, i32 y, i32 button);
|
||||
void pxl8_ui_input_scroll(pxl8_ui* ui, i32 x, i32 y);
|
||||
void pxl8_ui_input_text(pxl8_ui* ui, const char* text);
|
||||
|
||||
bool pxl8_ui_button(pxl8_ui* ui, const char* label);
|
||||
void pxl8_ui_label(pxl8_ui* ui, const char* text);
|
||||
void pxl8_ui_layout_row(pxl8_ui* ui, i32 item_count, const i32* widths, i32 height);
|
||||
i32 pxl8_ui_menu(pxl8_ui* ui, pxl8_menu_item* items, i32 item_count);
|
||||
void pxl8_ui_panel(pxl8_ui* ui, pxl8_bounds rect, pxl8_frame_theme* theme);
|
||||
bool pxl8_ui_window_begin(pxl8_ui* ui, const char* title, pxl8_bounds rect, i32 options);
|
||||
void pxl8_ui_window_end(pxl8_ui* ui);
|
||||
|
||||
pxl8_frame_theme pxl8_ui_theme_default(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue