System info & network
This commit is contained in:
57
code/gui/layout.h
Normal file
57
code/gui/layout.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef _PIUMA_GUI_LAYOUT_H_
|
||||
#define _PIUMA_GUI_LAYOUT_H_
|
||||
|
||||
#include "../lib/types.h"
|
||||
#include "../lib/geometry.h"
|
||||
|
||||
// Grid
|
||||
const s32 GUI_LAYOUT_MAX_CELLS = 0x7FFFFFFF;
|
||||
|
||||
struct Gui_Layout_Grid
|
||||
{
|
||||
v2 window_position;
|
||||
v2 window_size;
|
||||
v2 cell_size;
|
||||
f32 cell_border;
|
||||
v2s max_cells_count;
|
||||
|
||||
v2s cursor;
|
||||
Rect last_rect;
|
||||
|
||||
Rect rect(); // Get last rect
|
||||
void row(u32 count = 1);
|
||||
Rect cell(u32 count = 1);
|
||||
Rect rect_at(v2s position, v2s size = {1,1}); // Does not modify cursor. You have to assign it yourself.
|
||||
|
||||
};
|
||||
|
||||
Gui_Layout_Grid gui_layout_grid_create_by_divisions(v2 position, v2 window_size, u32 divisions_x, u32 divisions_y, f32 border = 0);
|
||||
Gui_Layout_Grid gui_layout_grid_create_by_cell_size(v2 position, v2 window_size, v2 cell_size, f32 border = 0);
|
||||
|
||||
|
||||
// Basic
|
||||
struct Gui_Layout_Basic
|
||||
{
|
||||
v2 window_position;
|
||||
v2 window_size;
|
||||
|
||||
v2 cursor = {0,0};
|
||||
f32 next_row_y = 0;
|
||||
Rect last_rect = {0,0,0,0};
|
||||
|
||||
f32 font_size;
|
||||
v2 button_padding = {0,0};
|
||||
v2 element_distance = {0,0};
|
||||
v2 window_padding = {0,0};
|
||||
|
||||
Rect rect();
|
||||
void push_rect(Rect r);
|
||||
void row();
|
||||
Rect label_rect(const char *text = "");
|
||||
Rect button_rect(const char *text = "");
|
||||
Rect button_rect(f32 length);
|
||||
};
|
||||
|
||||
Gui_Layout_Basic gui_layout_basic_create(v2 position, v2 size, f32 font_size);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user