-static ui_colourset flcol_list_a = {
- .main = 0xff877979,
- .hover = 0xffa09393,
- .active = 0xffbfb1b0
-};
-static ui_colourset flcol_list_b = {
- .main = 0xff7c6e6e,
- .hover = 0xffa09393,
- .active = 0xffbfb1b0
-};
-
-static ui_colourset flcol_list_complete_a = {
- .main = 0xff62a064,
- .hover = 0xff8dc18f,
- .active = 0xffb2ddb3
-};
-
-static ui_colourset flcol_list_complete_b = {
- .main = 0xff79b37b,
- .hover = 0xff8dc18f,
- .active = 0xffb2ddb3
-};
-
-static ui_colourset flcol_list_locked = {
- .main = 0xff655959,
- .hover = 0xff655959,
- .active = 0xff655959
-};
-
-static struct
-{
- SteamLeaderboard_t steam_leaderboard;
- int leaderboard_show;
-
- struct leaderboard_player
- {
- // Internal
- u64_steamid id;
- i32 score;
- int is_local_player;
-
- // To be displayed
- char score_text[ 16 ];
- char player_name[ 48 ];
- GLuint texture; // Not dynamic
- }
- leaderboard_players[10];
- int leaderboard_count;
-
- struct
- {
- struct cmp_level *level;
-
- i32 score;
- int is_waiting;
- }
- upload_request;
-
- struct cmp_level *level_selected;
-}
-ui_data;
-
-void vg_ui(void)
-{
- /*
- // UI memory
- static int pack_selection = 0;
- static struct pack_info
- {
- struct cmp_level *levels;
- u32 level_count;
- const char *name;
- }
- pack_infos[] =
- {
- {
- .levels = cmp_levels_tutorials,
- .level_count = vg_list_size(cmp_levels_tutorials),
- .name = "Training"
- },
- {
- .levels = cmp_levels_basic,
- .level_count = vg_list_size(cmp_levels_basic),
- .name = "Main"
- },
- {
- .levels = cmp_levels_grad,
- .level_count = vg_list_size(cmp_levels_tutorials),
- .name = "Expert"
- }
- };
-
- // UI Code
- ui_global_ctx.cursor[0] = 0;
- ui_global_ctx.cursor[1] = 0;
- ui_global_ctx.cursor[2] = 256;
-
- gui_fill_y();
-
- ui_global_ctx.id_base = 4 << 16;
-
- gui_new_node();
- {
- gui_capture_mouse( 9999 );
- gui_fill_rect( ui_global_ctx.cursor, 0xff5a4e4d );
-
- gui_text( "ASSIGNMENTS", 32, 0 );
-
- ui_global_ctx.cursor[1] += 30;
- ui_global_ctx.cursor[3] = 25;
-
- gui_new_node();
- {
- ui_rect_pad( ui_global_ctx.cursor, 2 );
- ui_global_ctx.cursor[2] = 84;
-
- for( int i = 0; i < 3; i ++ )
- {
- int pack_is_unlocked = pack_infos[i].levels[0].unlocked;
-
- if( i == pack_selection || !pack_is_unlocked )
- gui_override_colours( &flcol_list_locked );
-
- if( gui_button( 2000 + i ) == k_button_click && pack_is_unlocked )
- pack_selection = i;
-
- ui_global_ctx.cursor[1] += 2;
- gui_text( pack_is_unlocked? pack_infos[i].name: "???", 24, 0 );
- gui_end_right();
-
- gui_reset_colours();
- }
- }
- gui_end_down();
-
- ui_global_ctx.cursor[3] = 500;
-
- // DRAW LEVEL SELECTION LIST
- {
- struct cmp_level *levels = pack_infos[ pack_selection ].levels;
- int count = pack_infos[ pack_selection ].level_count;
-
- static struct ui_scrollbar sb = {
- .bar_height = 400
- };
-
- ui_px view_height = ui_global_ctx.cursor[3];
- ui_px level_height = 50;
-
- // Level scroll view
- gui_new_node();
- {
- gui_fill_rect( ui_global_ctx.cursor, 0xff5a4e4d );
- gui_set_clip( ui_global_ctx.cursor );
-
- ui_global_ctx.cursor[2] = 14;
- gui_align_right();
-
- ui_px content_height = count*level_height;
- if( content_height > view_height )
- {
- ui_scrollbar( &ui_global_ctx, &sb, 1 );
- ui_global_ctx.cursor[1] -= ui_calculate_content_scroll( &sb, content_height );
- }
- else
- {
- gui_fill_rect( ui_global_ctx.cursor, 0xff807373 );
- }
-
- ui_global_ctx.cursor[2] = 240;
- ui_global_ctx.cursor[3] = level_height;
- gui_align_left();
-
- for( int i = 0; i < count; i ++ )
- {
- struct cmp_level *lvl_info = &levels[i];
-
- if( lvl_info->unlocked )
- {
- if( lvl_info->completed_score != 0 )
- gui_override_colours( i&0x1? &flcol_list_complete_a: &flcol_list_complete_b );
- else
- gui_override_colours( i&0x1? &flcol_list_a: &flcol_list_b );
- }
- else
- gui_override_colours( &flcol_list_locked );
-
- if( lvl_info->unlocked )
- {
- if( gui_button( 2 + i ) == k_button_click )
- {
- ui_data.level_selected = &levels[i];
- ui_data.leaderboard_show = 0;
-
- if( pack_selection >= 1 )
- sw_find_leaderboard( ui_data.level_selected->map_name );
- }
-
- ui_global_ctx.override_colour = 0xffffffff;
- gui_text( lvl_info->title, 24, 0 );
- ui_global_ctx.cursor[1] += 18;
- gui_text( lvl_info->completed_score>0? "passed": "incomplete", 24, 0 );
- }
- else
- {
- gui_button( 2 + i );
-
- ui_global_ctx.override_colour = 0xff786f6f;
- gui_text( "???", 24, 0 );
- ui_global_ctx.cursor[1] += 18;
- gui_text( "locked", 24, 0 );
- }
-
- gui_end_down();
- }
-
- gui_reset_colours();
- gui_release_clip();
- }
- gui_end_down();
- }
- }
- gui_end_right();
-
- // Selected level UI
- // ============================================================
-
- if( ui_data.level_selected )
- {
- ui_global_ctx.cursor[0] += 16;
- ui_global_ctx.cursor[1] += 16;
- ui_global_ctx.cursor[2] = 512-40;
- ui_global_ctx.cursor[3] = 560-16;
-
- gui_new_node();
- {
- gui_capture_mouse( 9999 );
-
- gui_fill_rect( ui_global_ctx.cursor, 0xff5a4e4d );
- ui_global_ctx.cursor[1] += 4;
- gui_text( ui_data.level_selected->title, 24, 0 );
-
- ui_global_ctx.cursor[1] += 30;
- ui_rect_pad( ui_global_ctx.cursor, 8 );
- ui_global_ctx.cursor[3] = 300;
-
- gui_new_node();
- {
- gui_fill_rect( ui_global_ctx.cursor, 0xff655959 );
- }
- gui_end_down();
-
- //ui_text_use_paragraph( &ui_global_ctx );
- ui_global_ctx.cursor[1] += 2;
-
- gui_text( ui_data.level_selected->description, 16, 0 );
- //ui_text_use_title( &ui_global_ctx );
-
- // Buttons at the bottom
- ui_global_ctx.cursor[3] = 25;
- ui_global_ctx.cursor[2] = 80;
-
- gui_align_bottom();
- ui_global_ctx.cursor[1] -= 8;
-
- if( gui_button( 3000 ) == k_button_click )
- {
- ui_data.level_selected = NULL;
- }
- gui_text( "BACK", 24, k_text_alignment_center );
- gui_end();
-
- gui_align_right();
- ui_global_ctx.cursor[2] = 170;
- ui_global_ctx.cursor[0] -= 8 + 170 + 2;
-
- {
- gui_override_colours( &flcol_list_locked );
- if( gui_button( 3001 ) == k_button_click )
- vg_error( "UNIMPLEMENTED\n" );
-
- ui_global_ctx.override_colour = 0xff888888;
-
- gui_text( "RESTORE SOLUTION", 24, k_text_alignment_center );
- gui_end_right();
- ui_global_ctx.override_colour = 0xffffffff;
- }
-
- ui_global_ctx.cursor[0] += 2;
- ui_global_ctx.cursor[2] = 80;
-
- {
- gui_override_colours( &flcol_list_complete_a );
- if( gui_button( 3002 ) == k_button_click )
- {
- if( console_changelevel( 1, &ui_data.level_selected->map_name ) )
- {
- world.pCmpLevel = ui_data.level_selected;
-
- ui_data.level_selected = NULL;
- ui_data.leaderboard_show = 0;
- }
- }
- gui_text( "PLAY", 24, k_text_alignment_center );
- gui_end();
- }
-
- gui_reset_colours();
- }
- gui_end_right();
-
- if( ui_data.leaderboard_show )
- {
- ui_global_ctx.cursor[0] += 16;
- ui_global_ctx.cursor[2] = 350;
- ui_global_ctx.cursor[3] = 25;
-
- // If has results
- gui_new_node();
- {
- gui_fill_rect( ui_global_ctx.cursor, 0xff5a4e4d );
- gui_text( "FRIEND LEADERBOARD", 24, 0 );
- }
- gui_end_down();
-
- ui_global_ctx.cursor[1] += 2;
-
- gui_new_node();
- {
- ui_global_ctx.cursor[3] = 32+8;
-
- for( int i = 0; i < ui_data.leaderboard_count; i ++ )
- {
- gui_new_node();
- {
- gui_fill_rect( ui_global_ctx.cursor, i&0x1? flcol_list_a.main: flcol_list_b.main );
-
- ui_global_ctx.cursor[0] += 4;
- ui_global_ctx.cursor[1] += 4;
-
- // 1,2,3 ...
- static const char *places[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" };
- gui_text( places[i], 24, 0 );
- ui_global_ctx.cursor[0] += 32;
-
- struct leaderboard_player *player = &ui_data.leaderboard_players[i];
-
- // Players image
- ui_global_ctx.cursor[2] = 32;
- ui_global_ctx.cursor[3] = 32;
-
- gui_new_node();
- {
- gui_push_image( ui_global_ctx.cursor, player->texture );
- }
- gui_end_right();
-
- // Players name
- gui_text( player->player_name, 24, 0 );
-
- ui_global_ctx.cursor[2] = 50;
- gui_align_right();
-
- gui_text( player->score_text, 24, k_text_alignment_right );
- }
- gui_end_down();
-
- ui_global_ctx.cursor[1] += 2;
- }
- }
- gui_end();
- }
- }
- */
-}