world buttons
[fishladder.git] / fishladder_resources.h
index 8c8ee3b64e32417ece53df146b67ab9fb2da9e7c..f5b392a898648b6fd43eac60af963ce490decbd8 100644 (file)
@@ -8,8 +8,9 @@ vg_tex2d tex_background =       { .path = "textures/background.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 *texture_list[] = { &tex_tile_detail, &tex_tile_data, &tex_wood, &tex_background, &tex_ball_noise, &tex_monofur, &tex_unkown };
+vg_tex2d *texture_list[] = { &tex_tile_detail, &tex_tile_data, &tex_wood, &tex_background, &tex_ball_noise, &tex_monofur, &tex_unkown, &tex_buttons };
 
 // AUDIO
 // ===========================================================================================================
@@ -379,6 +380,43 @@ SHADER_DEFINE( shader_wire,
        UNIFORMS({ "uPv", "uColour", "uTexMain", "uStart", "uEnd", "uCurve" })
 )
 
+SHADER_DEFINE( shader_buttons,
+       // VERTEX
+       "layout (location=0) in vec2 a_co;"
+       "uniform vec4 uOffset;" // Tile x/y, uv x/y
+       "uniform mat3 uPv;"
+       ""
+       "out vec2 aTexCoords;"
+       ""
+       "void main()"
+       "{"
+               // Vertex transform
+               "vec3 worldpos = vec3( a_co + uOffset.xy, 1.0 );"
+               "gl_Position = vec4( uPv * worldpos, 1.0 );"
+
+               // Create texture coords
+               "vec2 edge_safe_coords = a_co * 0.98 + 0.01;"
+               "aTexCoords = (edge_safe_coords + uOffset.zw) * 0.25;"  
+       "}",
+       
+       // FRAGMENT
+       "out vec4 FragColor;"
+       ""
+       "uniform sampler2D uTexMain;"
+       "uniform vec4 uColour;" // rgb, light amount
+       ""
+       "in vec2 aTexCoords;"
+       ""
+       "void main()"
+       "{"
+               "vec4 glyph = texture( uTexMain, aTexCoords.xy );"
+               
+               "FragColor = vec4( uColour.rgb * (mix(glyph.r, glyph.g, uColour.a)+0.02)*2.6 + glyph.b * 0.4, glyph.a );"
+       "}"
+       ,
+       UNIFORMS({ "uPv", "uOffset", "uTexMain", "uColour" })
+)
+
 
 void vg_register(void)
 {
@@ -387,6 +425,7 @@ void vg_register(void)
        SHADER_INIT( shader_ball );
        SHADER_INIT( shader_background );
        SHADER_INIT( shader_wire );
+       SHADER_INIT( shader_buttons );
 }
 
 /*
@@ -580,6 +619,7 @@ struct cmp_level
 
 static struct cmp_level cmp_levels_tutorials[] = 
 {
+       // r1
        {
                .serial_id = 0,
                .title = "PRINCIPLE 1",
@@ -589,6 +629,7 @@ static struct cmp_level cmp_levels_tutorials[] =
                ._unlock = 1,
                .is_tutorial = 1
        },
+       // r1
        {
                .serial_id = 1,
                .title = "PRINCIPLE 2",
@@ -599,6 +640,7 @@ static struct cmp_level cmp_levels_tutorials[] =
                ._unlock = 2,
                .is_tutorial = 1,
        },
+       // r1
        {
                .serial_id = 2,
                .title = "PRINCIPLE 3",
@@ -608,6 +650,7 @@ static struct cmp_level cmp_levels_tutorials[] =
                ._unlock = 12,
                .is_tutorial = 1
        },
+       // r1
        {
                .serial_id = 12,
                .title = "PRINCIPLE 4",
@@ -622,29 +665,34 @@ static struct cmp_level cmp_levels_tutorials[] =
 
 static struct cmp_level cmp_levels_basic[] =
 {
+       // r1
        {
                .serial_id = 3,
                .title = "SUBDIVISION 1",
                .map_name = "cmp_b01",
-               .description = "Simple maths, branching required.",
+               .description = "Sometimes getting the desired amount takes\n"
+                                                       "dividing up the input and recombining it.",
                
                ._linked = 4,
                ._unlock = 6
        },
+       // r1
        {
                .serial_id = 4,
                .title = "SUBDIVISION 2",
                .map_name = "cmp_b02",
-               .description = "Simple maths, except more.",
+               .description = "",
                
                ._linked = 5,
                ._unlock = 7
        },
+       // r1
        {
                .serial_id = 5,
                .title = "RESTRUCTURE",
                .map_name = "cmp_b03",
-               .description = "Not so simple swap",
+               .description = "It is possible to swap these values using\n"
+                                                       "simple division and addition.",
                
                ._unlock = 8
        },
@@ -697,20 +745,23 @@ static struct cmp_level cmp_levels_basic[] =
                
                ._unlock = 15
        },
+       // r2
        {
                .serial_id = 15,
                .title = "PRINCIPLE 5",
                .map_name = "cmp_b10",
                .description = 
-                       "The competent engineers among you may have already\n" 
-                       "spotted and utilized these parts of the system\n"
+                       "The eager engineers among you may have already spotted\n" 
+                       "and utilized these parts of the system\n"
                        "\n"
                        "We forgot to include the relevant principle tasks as\n"
                        "of your training package, you will now be tasked to\n"
                        "complete them",
 
-               ._unlock = 16
+               ._unlock = 16,
+               .is_tutorial = 1
        },
+       // r2
        {
                .serial_id = 16,
                .title = "ROUTING PROBLEM",
@@ -743,7 +794,8 @@ static struct cmp_level cmp_levels_basic[] =
                        "this results in no operation being performed, and no\n"
                        "state changes take place in the Twisty Turny(TM)\n",
 
-               ._unlock = 18
+               ._unlock = 18,
+               .is_tutorial = 1
        },
        {
                .serial_id = 18,