world text (old style) & optimisations
[fishladder.git] / fishladder_resources.h
index 7b12859d44f94bb993c23fab06b9dd5627826e4f..030a050645ec1d9066c1aef8acf4eea1a912affe 100644 (file)
@@ -119,14 +119,30 @@ vg_tex2d tex_ubuntu = { .path = "textures/ubuntu.qoi" };
 
 vg_tex2d tex_tile_data =       { .path = "textures/tileset.qoi" };
 vg_tex2d tex_tile_detail = { .path = "textures/tile_overlays.qoi" };
-vg_tex2d tex_wood =                    { .path = "textures/wood.qoi" };
+
+vg_tex2d tex_tiles_wood =      { .path = "textures/tile_wood.qoi" };
+vg_tex2d tex_tiles_min  =  { .path = "textures/tile_minimal.qoi" };
+vg_tex2d tex_tiles_lab  =  { .path = "textures/tile_lab.qoi" };
+
 vg_tex2d tex_ball_noise =  { .path = "textures/bnoise.qoi" };
 vg_tex2d tex_monofur   =  { .path = "textures/ascii.qoi", .flags = VG_TEXTURE_NO_MIP };
 vg_tex2d tex_unkown            =  { .path = "textures/unkown.qoi" };
 vg_tex2d tex_buttons           =  { .path = "textures/buttons.qoi" };
 vg_tex2d tex_sprites           =  { .path = "textures/autocombine.qoi" };
 
-vg_tex2d *texture_list[] = { &tex_tile_detail, &tex_tile_data, &tex_wood, &tex_ball_noise, &tex_monofur, &tex_unkown, &tex_buttons, &tex_ubuntu, &tex_sprites };
+vg_tex2d *texture_list[] = { 
+   &tex_tile_detail, 
+   &tex_tile_data, 
+   &tex_tiles_wood, 
+   &tex_tiles_min, 
+   &tex_tiles_lab, 
+   &tex_ball_noise, 
+   &tex_monofur, 
+   &tex_unkown, 
+   &tex_buttons, 
+   &tex_ubuntu, 
+   &tex_sprites 
+};
 
 #include "sprites_autocombine.h"
 
@@ -239,24 +255,10 @@ sfx_system audio_system_ui =
        .name = "UI"
 };
 
-ui_colourset ui_fl_colours = {
-       .main = 0xff807373,
-       .hover = 0xff918484,
-       .active = 0xffad9f9e
-};
-
-ui_colourset ui_fl_colours_inactive = {
-       .main = 0xff655958,
-       .hover = 0xff655958,
-       .active = 0xff655958
-};
-
 static void resource_load_main(void)
 {
        // Textures // UI
        vg_tex2d_init( texture_list, vg_list_size( texture_list ) );
-       ui_global_ctx.colours_main = &ui_fl_colours;
-       gui_reset_colours();
        
        // Audio
        sfx_set_init( &audio_tile_mod, NULL );
@@ -350,7 +352,8 @@ SHADER_DEFINE( shader_ball,
                "float shadow = exp(-((shadow_coords_sqr.x+shadow_coords_sqr.y)-0.0125)*15.0);"
                
                "vec3 marble_comp = uColour*0.9 + (noise_sample.x*0.7+pow(rim_light,3.0)*2.0) * 0.1;"
-               "vec4 colour_comp = mix( vec4(0.74,0.53,0.34,shadow), vec4(marble_comp,1.0), circle_factor );"
+               //"vec4 colour_comp = mix( vec4(0.74,0.53,0.34,shadow), vec4(marble_comp,1.0), circle_factor );"
+               "vec4 colour_comp = mix( vec4(0.2,0.2,0.2,shadow), vec4(marble_comp,1.0), circle_factor );"
                
                "FragColor = colour_comp;"
        "}"
@@ -402,19 +405,23 @@ SHADER_DEFINE( shader_tile_main,
        "uniform float uForeground;"
        "uniform vec2 uMousePos;"
        "uniform vec4 uColour;"
+   "uniform vec3 uShadowing;"
        ""
        "in vec4 aTexCoords;"
        "in vec2 aWorldCoords;"
        ""
        "void main()"
        "{"
-               "vec3 shadowing_colour = vec3( 0.93, 0.88536, 0.8184 ) * 0.97;"
+               //"vec3 shadowing_colour = vec3( 0.93, 0.88536, 0.8184 ) * 0.97;"
+               //"vec3 shadowing_colour = vec3( 0.8, 0.8, 0.8 );"
+
                "vec4 glyph = texture( uTexGlyphs, aTexCoords.xy );"
                "vec4 wood = texture( uTexWood, aTexCoords.zw );"
                "vec4 wood_secondary = texture( uTexWood, aTexCoords.zw + 0.25 );"
-               "vec3 wood_comp = mix( wood_secondary.rgb * shadowing_colour, wood.rgb, clamp( glyph.b * 2.0 - 1.0, 0.0, 1.0 ) );"
+               "vec3 wood_comp = mix( wood_secondary.rgb * uShadowing, wood.rgb, clamp( glyph.b*2.0-1.0, 0.0, 1.0 ) );"
                
-               "vec3 shadows = mix( vec3( 0.85, 0.7344, 0.561 ), vec3(1.0,1.0,1.0), glyph.r );"
+               //"vec3 shadows = mix( vec3( 0.85, 0.7344, 0.561 ), vec3(1.0,1.0,1.0), glyph.r );"
+               "vec3 shadows = mix( uShadowing, vec3(1.0,1.0,1.0), glyph.r );"
                
                "vec4 output_regular = vec4( wood_comp * shadows, mix( glyph.a, glyph.b, uForeground ) );"
                
@@ -424,7 +431,8 @@ SHADER_DEFINE( shader_tile_main,
                "FragColor = mix( output_regular, output_ghost, uGhost ) * uColour;"
        "}"
        ,
-       UNIFORMS({ "uPv", "uOffset", "uTexGlyphs", "uTexWood", "uSubTransform", "uGhost", "uMousePos", "uColour", "uForeground", "uVisibility" })
+       UNIFORMS({ "uPv", "uOffset", "uTexGlyphs", "uTexWood", "uSubTransform", "uGhost", "uMousePos", 
+         "uColour", "uForeground", "uVisibility", "uShadowing" })
 )
 
 SHADER_DEFINE( shader_background,
@@ -618,8 +626,8 @@ SHADER_DEFINE( shader_sprite,
 
        // VERTEX
        "layout (location=0) in vec2 a_co;" // quad mesh
-       "layout (location=1) in vec4 ins_uv;"  // instanced data (uv)
-       "layout (location=2) in vec3 ins_pos;" // position + scale
+       "uniform vec4 uUv;"
+       "uniform vec3 uPos;"
        ""
        "uniform mat3 uPv;"
        ""
@@ -627,25 +635,24 @@ SHADER_DEFINE( shader_sprite,
        ""
        "void main()"
        "{"
-               "vec2 vertex_world = ins_uv.zw * a_co * ins_pos.z + ins_pos.xy;"
+               "vec2 vertex_world = uUv.zw * (a_co-0.5) * uPos.z + uPos.xy;"
                "gl_Position = vec4( uPv * vec3( vertex_world, 1.0 ), 1.0 );"
-               "aTexCoords = ins_uv.xy + (a_co+0.5)*ins_uv.zw;"
+               "aTexCoords = uUv.xy + a_co*uUv.zw;"
        "}",
        
        // FRAGMENT
        "uniform sampler2D uTexMain;"
-       "uniform vec4 uColour;"
        "out vec4 FragColor;"
        ""
        "in vec2 aTexCoords;"
        ""
        "void main()"
        "{"
-               "vec4 glyph = texture( uTexGlyphs, aTexCoords );"
-               "FragColor = glyph;"
+               "vec4 texture_sample = texture( uTexMain, aTexCoords );"
+               "FragColor = texture_sample;"
        "}"
        ,
-       UNIFORMS({ "uPv", "uTexMain", "uColour" })
+       UNIFORMS({ "uPv", "uTexMain", "uUv", "uPos" })
 )
 
 void vg_register(void)
@@ -657,6 +664,7 @@ void vg_register(void)
        SHADER_INIT( shader_wire );
        SHADER_INIT( shader_buttons );
        SHADER_INIT( shader_sdf );
+       SHADER_INIT( shader_sprite );
 }
 
 /*
@@ -690,6 +698,19 @@ struct cmp_level
        
        int _unlock, _linked;   // When completed, unlock this level
        struct cmp_level *unlock, *linked;
+
+   struct world_string
+   {
+      enum placement
+      {
+         k_placement_top,
+         k_placement_bottom
+      }
+      placement;
+
+      const char *str;
+   }
+   strings[2];
        
        int serial_id;
        int is_tutorial;
@@ -965,6 +986,24 @@ static struct cmp_level cmp_levels_computer[] =
                .title = "3 BIT ADDITION",
                .map_name = "cmp_add3b",
                .description = "",
+      .strings = 
+      {
+         {
+            .placement = k_placement_top,
+            //.str ="\t\t\t\t\t\t\t\t\t|      NUMBER A     |       |      NUMBER B     |\n"
+            .str =""
+"\t\t\t\t\t\t\t\t\t\x80\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x82       \x80\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x81\x82\n"
+"\t\t\t\t\t\t\t\t\t\x83 4       2       1 \x84  add  \x83 4       2       1 \x84\n"
+"\t\t\t\t\t\t\t\t\t\x83                   \x84       \x83                   \x84"
+         },
+         {
+            .placement = k_placement_bottom,
+            .str =
+"\t\t\t\x83                           \x84\n"
+"\t\t\t\x83 8       4       2       1 \x84 result a+b\n"
+"\t\t\t\x85\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x86"
+         }
+      },
 
                ._unlock = 25
        },