@ -540,7 +540,7 @@ void game_update(float dt, bool* window_should_close)
}
}
//game_debug(dt);
//game_debug(dt);
//debug_gui(dt);
//game_ debug_gui(dt);
console_update ( game_state - > console , gui_state_get ( ) , dt ) ;
console_update ( game_state - > console , gui_state_get ( ) , dt ) ;
scene_update ( game_state - > scene , dt ) ;
scene_update ( game_state - > scene , dt ) ;
if ( game_state - > game_mode = = GAME_MODE_GAME )
if ( game_state - > game_mode = = GAME_MODE_GAME )
@ -590,7 +590,7 @@ void game_debug_gui(float dt)
if ( scale_left ) window_flags | = NK_WINDOW_SCALE_LEFT ;
if ( scale_left ) window_flags | = NK_WINDOW_SCALE_LEFT ;
if ( minimizable ) window_flags | = NK_WINDOW_MINIMIZABLE ;
if ( minimizable ) window_flags | = NK_WINDOW_MINIMIZABLE ;
if ( nk_begin ( ctx , " Overview " , nk_rect ( 70 , 7 0, 400 , 600 ) , window_flags ) )
if ( nk_begin ( ctx , " Overview " , nk_rect ( 10 , 1 0, 400 , 600 ) , window_flags ) )
{
{
if ( show_menu )
if ( show_menu )
{
{
@ -599,11 +599,12 @@ void game_debug_gui(float dt)
static nk_size mprog = 60 ;
static nk_size mprog = 60 ;
static int mslider = 10 ;
static int mslider = 10 ;
static int mcheck = nk_true ;
static int mcheck = nk_true ;
nk_menubar_begin ( ctx ) ;
nk_menubar_begin ( ctx ) ;
nk_layout_row_begin ( ctx , NK_STATIC , 25 , 4 ) ;
/* menu #1 */
nk_layout_row_begin ( ctx , NK_STATIC , 25 , 5 ) ;
nk_layout_row_push ( ctx , 45 ) ;
nk_layout_row_push ( ctx , 45 ) ;
if ( nk_menu_begin_label ( ctx , " Menu " , NK_TEXT_LEFT , nk_vec2 ( 120 , 200 ) ) )
if ( nk_menu_begin_label ( ctx , " MENU " , NK_TEXT_LEFT , nk_vec2 ( 120 , 200 ) ) )
{
{
static size_t prog = 40 ;
static size_t prog = 40 ;
static int slider = 10 ;
static int slider = 10 ;
@ -618,6 +619,63 @@ void game_debug_gui(float dt)
nk_checkbox_label ( ctx , " check " , & check ) ;
nk_checkbox_label ( ctx , " check " , & check ) ;
nk_menu_end ( ctx ) ;
nk_menu_end ( ctx ) ;
}
}
/* menu #2 */
nk_layout_row_push ( ctx , 60 ) ;
if ( nk_menu_begin_label ( ctx , " ADVANCED " , NK_TEXT_LEFT , nk_vec2 ( 200 , 600 ) ) )
{
enum menu_state { MENU_NONE , MENU_FILE , MENU_EDIT , MENU_VIEW , MENU_CHART } ;
static enum menu_state menu_state = MENU_NONE ;
enum nk_collapse_states state ;
state = ( menu_state = = MENU_FILE ) ? NK_MAXIMIZED : NK_MINIMIZED ;
if ( nk_tree_state_push ( ctx , NK_TREE_TAB , " FILE " , & state ) ) {
menu_state = MENU_FILE ;
nk_menu_item_label ( ctx , " New " , NK_TEXT_LEFT ) ;
nk_menu_item_label ( ctx , " Open " , NK_TEXT_LEFT ) ;
nk_menu_item_label ( ctx , " Save " , NK_TEXT_LEFT ) ;
nk_menu_item_label ( ctx , " Close " , NK_TEXT_LEFT ) ;
nk_menu_item_label ( ctx , " Exit " , NK_TEXT_LEFT ) ;
nk_tree_pop ( ctx ) ;
}
else menu_state = ( menu_state = = MENU_FILE ) ? MENU_NONE : menu_state ;
state = ( menu_state = = MENU_EDIT ) ? NK_MAXIMIZED : NK_MINIMIZED ;
if ( nk_tree_state_push ( ctx , NK_TREE_TAB , " EDIT " , & state ) ) {
menu_state = MENU_EDIT ;
nk_menu_item_label ( ctx , " Copy " , NK_TEXT_LEFT ) ;
nk_menu_item_label ( ctx , " Delete " , NK_TEXT_LEFT ) ;
nk_menu_item_label ( ctx , " Cut " , NK_TEXT_LEFT ) ;
nk_menu_item_label ( ctx , " Paste " , NK_TEXT_LEFT ) ;
nk_tree_pop ( ctx ) ;
}
else menu_state = ( menu_state = = MENU_EDIT ) ? MENU_NONE : menu_state ;
state = ( menu_state = = MENU_VIEW ) ? NK_MAXIMIZED : NK_MINIMIZED ;
if ( nk_tree_state_push ( ctx , NK_TREE_TAB , " VIEW " , & state ) ) {
menu_state = MENU_VIEW ;
nk_menu_item_label ( ctx , " About " , NK_TEXT_LEFT ) ;
nk_menu_item_label ( ctx , " Options " , NK_TEXT_LEFT ) ;
nk_menu_item_label ( ctx , " Customize " , NK_TEXT_LEFT ) ;
nk_tree_pop ( ctx ) ;
}
else menu_state = ( menu_state = = MENU_VIEW ) ? MENU_NONE : menu_state ;
state = ( menu_state = = MENU_CHART ) ? NK_MAXIMIZED : NK_MINIMIZED ;
if ( nk_tree_state_push ( ctx , NK_TREE_TAB , " CHART " , & state ) ) {
size_t i = 0 ;
const float values [ ] = { 26.0f , 13.0f , 30.0f , 15.0f , 25.0f , 10.0f , 20.0f , 40.0f , 12.0f , 8.0f , 22.0f , 28.0f } ;
menu_state = MENU_CHART ;
nk_layout_row_dynamic ( ctx , 150 , 1 ) ;
nk_chart_begin ( ctx , NK_CHART_COLUMN , NK_LEN ( values ) , 0 , 50 ) ;
for ( i = 0 ; i < NK_LEN ( values ) ; + + i )
nk_chart_push ( ctx , values [ i ] ) ;
nk_chart_end ( ctx ) ;
nk_tree_pop ( ctx ) ;
}
else menu_state = ( menu_state = = MENU_CHART ) ? MENU_NONE : menu_state ;
nk_menu_end ( ctx ) ;
}
/* menu widgets */
nk_layout_row_push ( ctx , 70 ) ;
nk_layout_row_push ( ctx , 70 ) ;
nk_progress ( ctx , & mprog , 100 , NK_MODIFIABLE ) ;
nk_progress ( ctx , & mprog , 100 , NK_MODIFIABLE ) ;
nk_slider_int ( ctx , 0 , & mslider , 16 , 1 ) ;
nk_slider_int ( ctx , 0 , & mslider , 16 , 1 ) ;
@ -636,7 +694,8 @@ void game_debug_gui(float dt)
nk_label ( ctx , " By Micha Mettke " , NK_TEXT_LEFT ) ;
nk_label ( ctx , " By Micha Mettke " , NK_TEXT_LEFT ) ;
nk_label ( ctx , " nuklear is licensed under the public domain License. " , NK_TEXT_LEFT ) ;
nk_label ( ctx , " nuklear is licensed under the public domain License. " , NK_TEXT_LEFT ) ;
nk_popup_end ( ctx ) ;
nk_popup_end ( ctx ) ;
} else show_app_about = nk_false ;
}
else show_app_about = nk_false ;
}
}
/* window flags */
/* window flags */
@ -730,14 +789,13 @@ void game_debug_gui(float dt)
option = nk_option_label ( ctx , " optionB " , option = = B ) ? B : option ;
option = nk_option_label ( ctx , " optionB " , option = = B ) ? B : option ;
option = nk_option_label ( ctx , " optionC " , option = = C ) ? C : option ;
option = nk_option_label ( ctx , " optionC " , option = = C ) ? C : option ;
nk_layout_row ( ctx , NK_STATIC , 30 , 2 , ratio ) ;
nk_layout_row ( ctx , NK_STATIC , 30 , 2 , ratio ) ;
nk_labelf ( ctx , NK_TEXT_LEFT , " Slider int " ) ;
nk_labelf ( ctx , NK_TEXT_LEFT , " Slider int " ) ;
nk_slider_int ( ctx , 0 , & int_slider , 10 , 1 ) ;
nk_slider_int ( ctx , 0 , & int_slider , 10 , 1 ) ;
nk_label ( ctx , " Slider float " , NK_TEXT_LEFT ) ;
nk_label ( ctx , " Slider float " , NK_TEXT_LEFT ) ;
nk_slider_float ( ctx , 0 , & float_slider , 5.0 , 0.5f ) ;
nk_slider_float ( ctx , 0 , & float_slider , 5.0 , 0.5f ) ;
nk_labelf ( ctx , NK_TEXT_LEFT , " Progressbar " , prog_value ) ;
nk_labelf ( ctx , NK_TEXT_LEFT , " Progressbar: %zu " , prog_value ) ;
nk_progress ( ctx , & prog_value , 100 , NK_MODIFIABLE ) ;
nk_progress ( ctx , & prog_value , 100 , NK_MODIFIABLE ) ;
nk_layout_row ( ctx , NK_STATIC , 25 , 2 , ratio ) ;
nk_layout_row ( ctx , NK_STATIC , 25 , 2 , ratio ) ;
@ -762,6 +820,33 @@ void game_debug_gui(float dt)
nk_tree_pop ( ctx ) ;
nk_tree_pop ( ctx ) ;
}
}
if ( nk_tree_push ( ctx , NK_TREE_NODE , " Inactive " , NK_MINIMIZED ) )
{
static int inactive = 1 ;
nk_layout_row_dynamic ( ctx , 30 , 1 ) ;
nk_checkbox_label ( ctx , " Inactive " , & inactive ) ;
nk_layout_row_static ( ctx , 30 , 80 , 1 ) ;
if ( inactive ) {
struct nk_style_button button ;
button = ctx - > style . button ;
ctx - > style . button . normal = nk_style_item_color ( nk_rgb ( 40 , 40 , 40 ) ) ;
ctx - > style . button . hover = nk_style_item_color ( nk_rgb ( 40 , 40 , 40 ) ) ;
ctx - > style . button . active = nk_style_item_color ( nk_rgb ( 40 , 40 , 40 ) ) ;
ctx - > style . button . border_color = nk_rgb ( 60 , 60 , 60 ) ;
ctx - > style . button . text_background = nk_rgb ( 60 , 60 , 60 ) ;
ctx - > style . button . text_normal = nk_rgb ( 60 , 60 , 60 ) ;
ctx - > style . button . text_hover = nk_rgb ( 60 , 60 , 60 ) ;
ctx - > style . button . text_active = nk_rgb ( 60 , 60 , 60 ) ;
nk_button_label ( ctx , " button " ) ;
ctx - > style . button = button ;
}
else if ( nk_button_label ( ctx , " button " ) )
fprintf ( stdout , " button pressed \n " ) ;
nk_tree_pop ( ctx ) ;
}
if ( nk_tree_push ( ctx , NK_TREE_NODE , " Selectable " , NK_MINIMIZED ) )
if ( nk_tree_push ( ctx , NK_TREE_NODE , " Selectable " , NK_MINIMIZED ) )
{
{
if ( nk_tree_push ( ctx , NK_TREE_NODE , " List " , NK_MINIMIZED ) )
if ( nk_tree_push ( ctx , NK_TREE_NODE , " List " , NK_MINIMIZED ) )
@ -828,7 +913,7 @@ void game_debug_gui(float dt)
static int check_values [ 5 ] ;
static int check_values [ 5 ] ;
static float position [ 3 ] ;
static float position [ 3 ] ;
static struct nk_color combo_color = { 130 , 50 , 50 , 255 } ;
static struct nk_color combo_color = { 130 , 50 , 50 , 255 } ;
static struct nk_color combo_color2 = { 130 , 180 , 50 , 255 } ;
static struct nk_colorf combo_color2 = { 0.509f , 0.705f , 0.2f , 1.0f } ;
static size_t prog_a = 20 , prog_b = 40 , prog_c = 10 , prog_d = 90 ;
static size_t prog_a = 20 , prog_b = 40 , prog_c = 10 , prog_d = 90 ;
static const char * weapons [ ] = { " Fist " , " Pistol " , " Shotgun " , " Plasma " , " BFG " } ;
static const char * weapons [ ] = { " Fist " , " Pistol " , " Shotgun " , " Plasma " , " BFG " } ;
@ -837,7 +922,7 @@ void game_debug_gui(float dt)
/* default combobox */
/* default combobox */
nk_layout_row_static ( ctx , 25 , 200 , 1 ) ;
nk_layout_row_static ( ctx , 25 , 200 , 1 ) ;
current_weapon = nk_combo ( ctx , weapons , LEN ( weapons ) , current_weapon , 25 , nk_vec2 ( 200 , 200 ) ) ;
current_weapon = nk_combo ( ctx , weapons , NK_ LEN( weapons ) , current_weapon , 25 , nk_vec2 ( 200 , 200 ) ) ;
/* slider color combobox */
/* slider color combobox */
if ( nk_combo_begin_color ( ctx , combo_color , nk_vec2 ( 200 , 200 ) ) ) {
if ( nk_combo_begin_color ( ctx , combo_color , nk_vec2 ( 200 , 200 ) ) ) {
@ -853,9 +938,8 @@ void game_debug_gui(float dt)
combo_color . a = ( nk_byte ) nk_slide_int ( ctx , 0 , combo_color . a , 255 , 5 ) ;
combo_color . a = ( nk_byte ) nk_slide_int ( ctx , 0 , combo_color . a , 255 , 5 ) ;
nk_combo_end ( ctx ) ;
nk_combo_end ( ctx ) ;
}
}
/* complex color combobox */
/* complex color combobox */
if ( nk_combo_begin_color ( ctx , combo_color2 , nk_vec2 ( 200 , 400 ) ) ) {
if ( nk_combo_begin_color ( ctx , nk_rgb_cf ( combo_color2 ) , nk_vec2 ( 200 , 400 ) ) ) {
enum color_mode { COL_RGB , COL_HSV } ;
enum color_mode { COL_RGB , COL_HSV } ;
static int col_mode = COL_RGB ;
static int col_mode = COL_RGB ;
# ifndef DEMO_DO_NOT_USE_COLOR_PICKER
# ifndef DEMO_DO_NOT_USE_COLOR_PICKER
@ -869,22 +953,22 @@ void game_debug_gui(float dt)
nk_layout_row_dynamic ( ctx , 25 , 1 ) ;
nk_layout_row_dynamic ( ctx , 25 , 1 ) ;
if ( col_mode = = COL_RGB ) {
if ( col_mode = = COL_RGB ) {
combo_color2 . r = ( nk_byte ) nk_propertyi ( ctx , " #R: " , 0 , combo_color2 . r , 255 , 1 , 1 ) ;
combo_color2 . r = nk_propertyf ( ctx , " #R: " , 0 , combo_color2 . r , 1.0f , 0.01f , 0.005f ) ;
combo_color2 . g = ( nk_byte ) nk_propertyi ( ctx , " #G: " , 0 , combo_color2 . g , 255 , 1 , 1 ) ;
combo_color2 . g = nk_propertyf ( ctx , " #G: " , 0 , combo_color2 . g , 1.0f , 0.01f , 0.005f ) ;
combo_color2 . b = ( nk_byte ) nk_propertyi ( ctx , " #B: " , 0 , combo_color2 . b , 255 , 1 , 1 ) ;
combo_color2 . b = nk_propertyf ( ctx , " #B: " , 0 , combo_color2 . b , 1.0f , 0.01f , 0.005f ) ;
combo_color2 . a = ( nk_byte ) nk_propertyi ( ctx , " #A: " , 0 , combo_color2 . a , 255 , 1 , 1 ) ;
combo_color2 . a = nk_propertyf ( ctx , " #A: " , 0 , combo_color2 . a , 1.0f , 0.01f , 0.005f ) ;
} else {
}
nk_byte tmp [ 4 ] ;
else {
nk_color_hsva_bv ( tmp , combo_color2 ) ;
float hsva [ 4 ] ;
tmp [ 0 ] = ( nk_byte ) nk_propertyi ( ctx , " #H: " , 0 , tmp [ 0 ] , 255 , 1 , 1 ) ;
nk_colorf_hsva_fv ( hsva , combo_color2 ) ;
tmp [ 1 ] = ( nk_byte ) nk_propertyi ( ctx , " #S: " , 0 , tmp [ 1 ] , 255 , 1 , 1 ) ;
hsva [ 0 ] = nk_propertyf ( ctx , " #H: " , 0 , hsva [ 0 ] , 1.0f , 0.01f , 0.05f ) ;
tmp [ 2 ] = ( nk_byte ) nk_propertyi ( ctx , " #V: " , 0 , tmp [ 2 ] , 255 , 1 , 1 ) ;
hsva [ 1 ] = nk_propertyf ( ctx , " #S: " , 0 , hsva [ 1 ] , 1.0f , 0.01f , 0.05f ) ;
tmp [ 3 ] = ( nk_byte ) nk_propertyi ( ctx , " #A: " , 0 , tmp [ 3 ] , 255 , 1 , 1 ) ;
hsva [ 2 ] = nk_propertyf ( ctx , " #V: " , 0 , hsva [ 2 ] , 1.0f , 0.01f , 0.05f ) ;
combo_color2 = nk_hsva_bv ( tmp ) ;
hsva [ 3 ] = nk_propertyf ( ctx , " #A: " , 0 , hsva [ 3 ] , 1.0f , 0.01f , 0.05f ) ;
combo_color2 = nk_hsva_colorfv ( hsva ) ;
}
}
nk_combo_end ( ctx ) ;
nk_combo_end ( ctx ) ;
}
}
/* progressbar combobox */
/* progressbar combobox */
sum = prog_a + prog_b + prog_c + prog_d ;
sum = prog_a + prog_b + prog_c + prog_d ;
sprintf ( buffer , " %lu " , sum ) ;
sprintf ( buffer , " %lu " , sum ) ;
@ -925,8 +1009,8 @@ void game_debug_gui(float dt)
size_t i = 0 ;
size_t i = 0 ;
static const float values [ ] = { 26.0f , 13.0f , 30.0f , 15.0f , 25.0f , 10.0f , 20.0f , 40.0f , 12.0f , 8.0f , 22.0f , 28.0f , 5.0f } ;
static const float values [ ] = { 26.0f , 13.0f , 30.0f , 15.0f , 25.0f , 10.0f , 20.0f , 40.0f , 12.0f , 8.0f , 22.0f , 28.0f , 5.0f } ;
nk_layout_row_dynamic ( ctx , 150 , 1 ) ;
nk_layout_row_dynamic ( ctx , 150 , 1 ) ;
nk_chart_begin ( ctx , NK_CHART_COLUMN , LEN ( values ) , 0 , 50 ) ;
nk_chart_begin ( ctx , NK_CHART_COLUMN , NK_ LEN( values ) , 0 , 50 ) ;
for ( i = 0 ; i < LEN ( values ) ; + + i ) {
for ( i = 0 ; i < NK_ LEN( values ) ; + + i ) {
nk_flags res = nk_chart_push ( ctx , values [ i ] ) ;
nk_flags res = nk_chart_push ( ctx , values [ i ] ) ;
if ( res & NK_CHART_CLICKED ) {
if ( res & NK_CHART_CLICKED ) {
chart_selection = values [ i ] ;
chart_selection = values [ i ] ;
@ -968,7 +1052,9 @@ void game_debug_gui(float dt)
if ( nk_combo_begin_label ( ctx , buffer , nk_vec2 ( 350 , 400 ) ) )
if ( nk_combo_begin_label ( ctx , buffer , nk_vec2 ( 350 , 400 ) ) )
{
{
int i = 0 ;
int i = 0 ;
const char * month [ ] = { " January " , " February " , " March " , " Apil " , " May " , " June " , " July " , " August " , " September " , " Ocotober " , " November " , " December " } ;
const char * month [ ] = { " January " , " February " , " March " ,
" April " , " May " , " June " , " July " , " August " , " September " ,
" October " , " November " , " December " } ;
const char * week_days [ ] = { " SUN " , " MON " , " TUE " , " WED " , " THU " , " FRI " , " SAT " } ;
const char * week_days [ ] = { " SUN " , " MON " , " TUE " , " WED " , " THU " , " FRI " , " SAT " } ;
const int month_days [ ] = { 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ;
const int month_days [ ] = { 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ;
int year = sel_date . tm_year + 1900 ;
int year = sel_date . tm_year + 1900 ;
@ -984,8 +1070,9 @@ void game_debug_gui(float dt)
if ( nk_button_symbol ( ctx , NK_SYMBOL_TRIANGLE_LEFT ) ) {
if ( nk_button_symbol ( ctx , NK_SYMBOL_TRIANGLE_LEFT ) ) {
if ( sel_date . tm_mon = = 0 ) {
if ( sel_date . tm_mon = = 0 ) {
sel_date . tm_mon = 11 ;
sel_date . tm_mon = 11 ;
sel_date . tm_year = MAX_NUM ( 0 , sel_date . tm_year - 1 ) ;
sel_date . tm_year = NK_MAX ( 0 , sel_date . tm_year - 1 ) ;
} else sel_date . tm_mon - - ;
}
else sel_date . tm_mon - - ;
}
}
nk_layout_row_push ( ctx , 0.9f ) ;
nk_layout_row_push ( ctx , 0.9f ) ;
sprintf ( buffer , " %s %d " , month [ sel_date . tm_mon ] , year ) ;
sprintf ( buffer , " %s %d " , month [ sel_date . tm_mon ] , year ) ;
@ -995,7 +1082,8 @@ void game_debug_gui(float dt)
if ( sel_date . tm_mon = = 11 ) {
if ( sel_date . tm_mon = = 11 ) {
sel_date . tm_mon = 0 ;
sel_date . tm_mon = 0 ;
sel_date . tm_year + + ;
sel_date . tm_year + + ;
} else sel_date . tm_mon + + ;
}
else sel_date . tm_mon + + ;
}
}
nk_layout_row_end ( ctx ) ;
nk_layout_row_end ( ctx ) ;
@ -1010,7 +1098,7 @@ void game_debug_gui(float dt)
/* weekdays */
/* weekdays */
nk_layout_row_dynamic ( ctx , 35 , 7 ) ;
nk_layout_row_dynamic ( ctx , 35 , 7 ) ;
for ( i = 0 ; i < ( int ) LEN ( week_days ) ; + + i )
for ( i = 0 ; i < ( int ) NK_ LEN( week_days ) ; + + i )
nk_label ( ctx , week_days [ i ] , NK_TEXT_CENTERED ) ;
nk_label ( ctx , week_days [ i ] , NK_TEXT_CENTERED ) ;
/* days */
/* days */
@ -1127,12 +1215,8 @@ void game_debug_gui(float dt)
nk_chart_end ( ctx ) ;
nk_chart_end ( ctx ) ;
}
}
if ( index ! = - 1 ) {
if ( index ! = - 1 )
char buffer [ NK_MAX_NUMBER_BUFFER ] ;
nk_tooltipf ( ctx , " Value: %.2f " , ( float ) cos ( ( float ) index * step ) ) ;
float val = ( float ) cos ( ( float ) index * step ) ;
sprintf ( buffer , " Value: %.2f " , val ) ;
nk_tooltip ( ctx , buffer ) ;
}
if ( line_index ! = - 1 ) {
if ( line_index ! = - 1 ) {
nk_layout_row_dynamic ( ctx , 20 , 1 ) ;
nk_layout_row_dynamic ( ctx , 20 , 1 ) ;
nk_labelf ( ctx , NK_TEXT_LEFT , " Selected value: %.2f " , ( float ) cos ( ( float ) index * step ) ) ;
nk_labelf ( ctx , NK_TEXT_LEFT , " Selected value: %.2f " , ( float ) cos ( ( float ) index * step ) ) ;
@ -1152,11 +1236,8 @@ void game_debug_gui(float dt)
}
}
nk_chart_end ( ctx ) ;
nk_chart_end ( ctx ) ;
}
}
if ( index ! = - 1 ) {
if ( index ! = - 1 )
char buffer [ NK_MAX_NUMBER_BUFFER ] ;
nk_tooltipf ( ctx , " Value: %.2f " , ( float ) fabs ( sin ( step * ( float ) index ) ) ) ;
sprintf ( buffer , " Value: %.2f " , ( float ) fabs ( sin ( step * ( float ) index ) ) ) ;
nk_tooltip ( ctx , buffer ) ;
}
if ( col_index ! = - 1 ) {
if ( col_index ! = - 1 ) {
nk_layout_row_dynamic ( ctx , 20 , 1 ) ;
nk_layout_row_dynamic ( ctx , 20 , 1 ) ;
nk_labelf ( ctx , NK_TEXT_LEFT , " Selected value: %.2f " , ( float ) fabs ( sin ( step * ( float ) col_index ) ) ) ;
nk_labelf ( ctx , NK_TEXT_LEFT , " Selected value: %.2f " , ( float ) fabs ( sin ( step * ( float ) col_index ) ) ) ;
@ -1203,7 +1284,7 @@ void game_debug_gui(float dt)
struct nk_rect bounds ;
struct nk_rect bounds ;
/* menu contextual */
/* menu contextual */
nk_layout_row_static ( ctx , 30 , 15 0 , 1 ) ;
nk_layout_row_static ( ctx , 30 , 16 0 , 1 ) ;
bounds = nk_widget_bounds ( ctx ) ;
bounds = nk_widget_bounds ( ctx ) ;
nk_label ( ctx , " Right click me for menu " , NK_TEXT_LEFT ) ;
nk_label ( ctx , " Right click me for menu " , NK_TEXT_LEFT ) ;
@ -1268,7 +1349,8 @@ void game_debug_gui(float dt)
nk_popup_close ( ctx ) ;
nk_popup_close ( ctx ) ;
}
}
nk_popup_end ( ctx ) ;
nk_popup_end ( ctx ) ;
} else popup_active = nk_false ;
}
else popup_active = nk_false ;
}
}
/* tooltip */
/* tooltip */
@ -1403,11 +1485,41 @@ void game_debug_gui(float dt)
}
}
nk_tree_pop ( ctx ) ;
nk_tree_pop ( ctx ) ;
}
}
if ( nk_tree_push ( ctx , NK_TREE_NODE , " Tree " , NK_MINIMIZED ) )
{
static int root_selected = 0 ;
int sel = root_selected ;
if ( nk_tree_element_push ( ctx , NK_TREE_NODE , " Root " , NK_MINIMIZED , & sel ) ) {
static int selected [ 8 ] ;
int i = 0 , node_select = selected [ 0 ] ;
if ( sel ! = root_selected ) {
root_selected = sel ;
for ( i = 0 ; i < 8 ; + + i )
selected [ i ] = sel ;
}
if ( nk_tree_element_push ( ctx , NK_TREE_NODE , " Node " , NK_MINIMIZED , & node_select ) ) {
int j = 0 ;
static int sel_nodes [ 4 ] ;
if ( node_select ! = selected [ 0 ] ) {
selected [ 0 ] = node_select ;
for ( i = 0 ; i < 4 ; + + i )
sel_nodes [ i ] = node_select ;
}
nk_layout_row_static ( ctx , 18 , 100 , 1 ) ;
for ( j = 0 ; j < 4 ; + + j )
nk_selectable_symbol_label ( ctx , NK_SYMBOL_CIRCLE_SOLID , ( sel_nodes [ j ] ) ? " Selected " : " Unselected " , NK_TEXT_RIGHT , & sel_nodes [ j ] ) ;
nk_tree_element_pop ( ctx ) ;
}
nk_layout_row_static ( ctx , 18 , 100 , 1 ) ;
for ( i = 1 ; i < 8 ; + + i )
nk_selectable_symbol_label ( ctx , NK_SYMBOL_CIRCLE_SOLID , ( selected [ i ] ) ? " Selected " : " Unselected " , NK_TEXT_RIGHT , & selected [ i ] ) ;
nk_tree_element_pop ( ctx ) ;
}
nk_tree_pop ( ctx ) ;
}
if ( nk_tree_push ( ctx , NK_TREE_NODE , " Notebook " , NK_MINIMIZED ) )
if ( nk_tree_push ( ctx , NK_TREE_NODE , " Notebook " , NK_MINIMIZED ) )
{
{
static int current_tab = 0 ;
static int current_tab = 0 ;
struct nk_vec2 item_padding ;
struct nk_rect bounds ;
struct nk_rect bounds ;
float step = ( 2 * 3.141592654f ) / 32 ;
float step = ( 2 * 3.141592654f ) / 32 ;
enum chart_type { CHART_LINE , CHART_HISTO , CHART_MIXED } ;
enum chart_type { CHART_LINE , CHART_HISTO , CHART_MIXED } ;
@ -1431,7 +1543,8 @@ void game_debug_gui(float dt)
ctx - > style . button . normal = ctx - > style . button . active ;
ctx - > style . button . normal = ctx - > style . button . active ;
current_tab = nk_button_label ( ctx , names [ i ] ) ? i : current_tab ;
current_tab = nk_button_label ( ctx , names [ i ] ) ? i : current_tab ;
ctx - > style . button . normal = button_color ;
ctx - > style . button . normal = button_color ;
} else current_tab = nk_button_label ( ctx , names [ i ] ) ? i : current_tab ;
}
else current_tab = nk_button_label ( ctx , names [ i ] ) ? i : current_tab ;
}
}
nk_style_pop_float ( ctx ) ;
nk_style_pop_float ( ctx ) ;
@ -1441,6 +1554,7 @@ void game_debug_gui(float dt)
{
{
nk_style_pop_vec2 ( ctx ) ;
nk_style_pop_vec2 ( ctx ) ;
switch ( current_tab ) {
switch ( current_tab ) {
default : break ;
case CHART_LINE :
case CHART_LINE :
nk_layout_row_dynamic ( ctx , 100 , 1 ) ;
nk_layout_row_dynamic ( ctx , 100 , 1 ) ;
bounds = nk_widget_bounds ( ctx ) ;
bounds = nk_widget_bounds ( ctx ) ;
@ -1482,7 +1596,8 @@ void game_debug_gui(float dt)
break ;
break ;
}
}
nk_group_end ( ctx ) ;
nk_group_end ( ctx ) ;
} else nk_style_pop_vec2 ( ctx ) ;
}
else nk_style_pop_vec2 ( ctx ) ;
nk_tree_pop ( ctx ) ;
nk_tree_pop ( ctx ) ;
}
}
@ -1760,7 +1875,6 @@ void game_debug_gui(float dt)
}
}
}
}
nk_end ( ctx ) ;
nk_end ( ctx ) ;
//return !nk_window_is_closed(ctx, "Overview");
}
}