1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#include "editor.h"
#include "../util/string.h"
const U32 TOOLVIEW_TITLE_OFFSET = 15;
void gui_editor_toolview_get_title( GUI_EDITOR_TOOLVIEW* view, char* out ) {
switch( editor->tool.type ) {
case EDITOR_TOOL_ENT: memcpy( out, "tool: entity", 12 ); break;
case EDITOR_TOOL_WALL: memcpy( out, "tool: wall", 10 ); break;
case EDITOR_TOOL_POLY: memcpy( out, "tool: polygon", 14 ); break;
case EDITOR_TOOL_SELECT: memcpy( out, "tool: select", 12 ); break;
case EDITOR_TOOL_SPRITE: memcpy( out, "tool: sprite", 12 ); break;
default: memcpy( out, "tool: none", 10 ); break;
}
}
void gui_editor_toolview_update( GUI_EDITOR_TOOLVIEW* view ) {
}
void gui_editor_toolview_draw_fn( void* ptr ) {
if( !editor->map ) return;
GUI_EDITOR_TOOLVIEW* view = (GUI_EDITOR_TOOLVIEW*)ptr;
I32 x = gui_relx( view );
I32 y = gui_rely( view );
I32 w = view->w;
I32 h = view->h;
STR<64> title{};
gui_editor_toolview_get_title( view, title );
gui_draw_str( x, y, ALIGN_L, FNT_JPN12, ui_clr.txt, title );
y += TOOLVIEW_TITLE_OFFSET;
CLR col = gui_is_fg_window( view )? ui_clr.border : ui_clr.border_inactive;
gui_draw_frect( x, y, w, h, col );
gui_draw_frect( x+1, y+1, w-2, h-2, ui_clr.bg_sec );
view->itemview->draw_fn( view->itemview );
}
GUI_EDITOR_TOOLVIEW* gui_editor_toolview( I32 x, I32 y, I32 w, I32 h ) {
if( !gui_check_target() ) return 0;
GUI_EDITOR_TOOLVIEW* view = new GUI_EDITOR_TOOLVIEW;
view->x = x;
view->y = y;
view->w = w;
view->h = h;
view->xbound = view->w;
view->ybound = view->h + TOOLVIEW_TITLE_OFFSET;
strcpy( view->name, "EDITOR_PROP_VIEW" );
view->draw_fn = gui_editor_toolview_draw_fn;
view->input_fn = gui_base_input_fn;
GUI_VIEW* parent = gui_get_view();
parent->children.push( view );
view->parent = parent;
gui_set_view( view );
view->itemview = gui_view( 0, TOOLVIEW_TITLE_OFFSET, w, h );
gui_set_view( parent );
return view;
}
|