added simple settings window
authorhgn <hgodden00@gmail.com>
Tue, 11 Jan 2022 23:21:23 +0000 (23:21 +0000)
committerhgn <hgodden00@gmail.com>
Tue, 11 Jan 2022 23:21:23 +0000 (23:21 +0000)
fishladder.c
maps/dev_settings.map [new file with mode: 0644]

index 08406bc8acd2a19ca65de60b58247b0fa9286087..5948f627efc2113f388fad462af4dd50f513ca7c 100644 (file)
@@ -388,27 +388,27 @@ m3x3f m_mdl;
 
 static int colour_set_id = 0;
 
-static void colour_code_v3( char const cc, v3f target )
+static v3f colour_sets[][4] =
 {
-       static v3f colour_sets[][4] =
-       {
-               { { 1.0f, 0.9f, 0.3f },                 // Yellow
-                 { 0.4f, 0.8f, 1.00f },                // Blue
-                 { 0.2f, 0.9f, 0.14f },                // Green
-                 { 0.882f, 0.204f, 0.922f }    // Pink
-               },
-               { { 1.0f, 0.9f, 0.3f },                 // Yellow
-                 { 0.4f, 0.8f, 1.00f },                // Blue
-                 { 0.85f, 0.85f, 0.85f },              // Weiss
-                 { 0.2f, 0.2f, 0.2f }                  // Black/Gray
-               },
-               { { 1.0f, 0.9f, 0.3f },                 // Yellow
-                 { 0.827f, 0.373f, 0.718f },   // Pink
-                 { 0.0f, 0.353f, 0.71f },              // Blue
-                 { 0.863f, 0.196f, 0.125f }    // Red
-               },
-       };
+       { { 1.0f, 0.9f, 0.3f },                 // Yellow
+         { 0.4f, 0.8f, 1.00f },                // Blue
+         { 0.2f, 0.9f, 0.14f },                // Green
+         { 0.882f, 0.204f, 0.922f }    // Pink
+       },
+       { { 1.0f, 0.9f, 0.3f },                 // Yellow
+         { 0.4f, 0.8f, 1.00f },                // Blue
+         { 0.85f, 0.85f, 0.85f },              // Weiss
+         { 0.2f, 0.2f, 0.2f }                  // Black/Gray
+       },
+       { { 1.0f, 0.9f, 0.3f },                 // Yellow
+         { 0.827f, 0.373f, 0.718f },   // Pink
+         { 0.0f, 0.353f, 0.71f },              // Blue
+         { 0.863f, 0.196f, 0.125f }    // Red
+       },
+};
 
+static void colour_code_v3( char const cc, v3f target )
+{
        if( cc >= 'a' && cc <= 'z' )
        {
                int id = cc - 'a';
@@ -2953,7 +2953,92 @@ void vg_render(void)
        */
 }
 
-void vg_ui(void) {}
+void vg_ui(void) 
+{
+       if( world.st.state == k_game_state_settings )
+       {
+               gui_group_id( 35 );
+
+               ui_global_ctx.cursor[2] = 225;
+               gui_fill_y();
+               gui_align_right();
+
+               gui_new_node();
+               {
+                       gui_capture_mouse( 200 );
+
+                       gui_fill_rect( ui_global_ctx.cursor, 0xC0202020 );
+                       ui_rect_pad( ui_global_ctx.cursor, 8 );
+                       
+                       ui_global_ctx.cursor[3] = 25;
+                       
+                       gui_new_node();
+                       {
+                               gui_text( "Settings", 3 );
+                       }
+                       gui_end();
+
+                       // Colour scheme selection
+                       ui_global_ctx.cursor[1] += 30;
+
+                       gui_text( "Colour Scheme", 2 );
+                       ui_global_ctx.cursor[1] += 25;
+
+                       gui_new_node();
+                       {
+                               ui_global_ctx.cursor[2] = 50;
+
+                               for( int i = 0; i < 4; i ++ )
+                               {
+                                       gui_new_node();
+                                       {
+                                               // Convert to RGB
+                                               u32 rgb = 0xff000000;
+
+                                               for( int j = 0; j < 3; j ++ )
+                                                       rgb |= (u32)(colour_sets[ colour_set_id ][i][j]*255.0f) << j * 8;
+
+                                               gui_fill_rect( ui_global_ctx.cursor, rgb );
+                                       }
+                                       gui_end_right();
+                               }
+                       }
+                       gui_end_down();
+                       
+                       gui_new_node();
+                       {
+                               ui_global_ctx.cursor[2] = 25;
+                               if( gui_button( 0 ) == k_button_click )
+                               {
+                                       if( colour_set_id > 0 )
+                                               colour_set_id --;
+                               }
+                               gui_text( "<", 2 );
+                               gui_end_right();
+                               
+                               ui_global_ctx.cursor[2] = 150;
+                               gui_new_node();
+                               {
+                                       ui_global_ctx.cursor[0] += 45;
+                                       ui_global_ctx.cursor[1] += 6;
+                                       gui_text( (const char *[]){ "Normal", "Extra1", "Extra2" }[ colour_set_id ], 2 );
+                               }
+                               gui_end_right();
+
+                               ui_global_ctx.cursor[2] = 25;
+                               if( gui_button( 1 ) == k_button_click )
+                               {
+                                       if( colour_set_id < vg_list_size( colour_sets )-1 )
+                                               colour_set_id ++;
+                               }
+                               gui_text( ">", 2 );
+                               gui_end_down();
+                       }
+                       gui_end_down();
+               }
+               gui_end();
+       }
+}
 
 #if STEAM_LEADERBOARDS
 void leaderboard_dispatch_score(void)
diff --git a/maps/dev_settings.map b/maps/dev_settings.map
new file mode 100644 (file)
index 0000000..8f0bf71
--- /dev/null
@@ -0,0 +1,10 @@
+##############;
+##############;
+##          ##;
+##          ##;
+##          ##;
+##          ##;
+##          ##;
+##          ##;
+##############;
+##############;