water splash
[carveJwlIkooP6JGAAIwe30JlM.git] / world_sfd.h
index 88f73316585dc28980d4b708da56045be628dafa..c6fa66b0fdb49942485fb85c8fb3ab022fc22132 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef SFD_H
 #define SFD_H
 
-#include "common.h"
-#include "model.h"
 #include "world.h"
 
 #include "shaders/scoretext.h"
@@ -11,25 +9,9 @@
 vg_tex2d tex_scoretext = { .path = "textures/scoretext.qoi",
                            .flags = VG_TEXTURE_CLAMP|VG_TEXTURE_NEAREST };
 
-struct sfd_instance
-{
-   float *buffer;
-
-   u32 w,h;
-};
-
-
-struct subworld_sfd
-{
-   scene mesh;
-   mdl_submesh *sm_module, *sm_card;
-   glmesh temp;
-
-   struct sfd_instance tester;
-};
-
-static struct subworld_sfd *subworld_sfd(void);
-
+/* 
+ * TODO: utf-8 -> ascii
+ */
 
 float sfd_encode_glyph( char c )
 {
@@ -44,7 +26,7 @@ float sfd_encode_glyph( char c )
       value = 63-c;
    else
    {
-      int base = 'A'+11+27;
+      int base = 11+26;
 
       switch( c )
       {
@@ -58,8 +40,8 @@ float sfd_encode_glyph( char c )
          case '*': value=base+7; break;
          case '+': value=base+8; break;
          case '-': value=base+9; break;
-         case ':': value=base+10; break;
-         case '/': value=base+11; break;
+         case '/': value=base+10; break;
+         case ':': value=base+11; break;
          default: value=0; break;
       }
    }
@@ -120,7 +102,7 @@ static void sfd_update( struct sfd_instance *display )
 static void sfd_render( struct sfd_instance *display, 
                         m4x4f projection, v3f camera, m4x3f transform )
 {
-   struct subworld_sfd *sfd = subworld_sfd();
+   struct subworld_sfd *sfd = &world.sfd;
    scene_bind( &sfd->mesh );
 
    shader_scoretext_use();
@@ -160,7 +142,7 @@ static void sfd_render( struct sfd_instance *display,
 
 static int world_sfd_test( int argc, const char *argv[] )
 {
-   struct subworld_sfd *sfd = subworld_sfd();
+   struct subworld_sfd *sfd = &world.sfd;
 
    if( argc == 2 )
    {
@@ -173,7 +155,7 @@ static int world_sfd_test( int argc, const char *argv[] )
 
 static void world_sfd_init(void)
 {
-   struct subworld_sfd *sfd = subworld_sfd();
+   struct subworld_sfd *sfd = &world.sfd;
 
        vg_function_push( (struct vg_cmd){
                .name = "sfd",
@@ -206,7 +188,7 @@ static void world_sfd_init(void)
          float const k_glyph_uvw = 1.0f/64.0f;
          vert->uv[0] -= k_glyph_uvw * (float)(i-4);
          vert->colour[0] = 0.0f;
-         vert->colour[1] = i-4;
+         vert->colour[1] = i*36;
       }
    }
 
@@ -216,7 +198,7 @@ static void world_sfd_init(void)
    free( mboard );
    vg_tex2d_init( (vg_tex2d *[]){ &tex_scoretext }, 1 );
 
-   sfd_new( &sfd->tester, 16, 8 );
+   sfd_new( &sfd->tester, 27, 13 );
 }
 
 static void world_sfd_register(void)