+static struct cell *pcell( v2i pos )
+{
+ return &world.data[ pos[1]*world.w + pos[0] ];
+}
+
+int main( int argc, char *argv[] )
+{
+ vg_init( argc, argv, "Fish (Marbles Computer) Ladder Simulator 2022 | N,M: change level | SPACE: Test | LeftClick: Toggle tile" );
+}
+
+void vg_register(void)
+{
+ SHADER_INIT( shader_tile_colour );
+ SHADER_INIT( shader_tile_main );
+ SHADER_INIT( shader_ball );
+}
+
+void vg_start(void)
+{
+ // Quad mesh
+ {
+ float quad_mesh[] =
+ {
+ 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,
+ 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f,
+
+ 0.48f, 0.48f, 0.5f, 0.52f, 0.52f, 0.52f, // Static dot
+ 0.375f, 0.25f, 0.5f, 0.75f, 0.625f, 0.25f, // Downwards pointing arrow
+ 0.25f, 0.625f, 0.75f, 0.5f, 0.25f, 0.375f, // Left
+ 0.625f, 0.75f, 0.5f, 0.25f, 0.375f, 0.75f, // up
+ 0.75f, 0.375f, 0.25f, 0.5f, 0.75f, 0.625f
+ };
+
+ init_mesh( &world.tile, quad_mesh, vg_list_size(quad_mesh) );
+ }
+
+ // Circle mesh
+ {
+ float circle_mesh[32*6*3];
+ int res = vg_list_size( circle_mesh ) / (6*3);
+
+ for( int i = 0; i < res; i ++ )
+ {
+ v2f v0 = { sinf( ((float)i/(float)res)*VG_TAUf ), cosf( ((float)i/(float)res)*VG_TAUf ) };
+ v2f v1 = { sinf( ((float)(i+1)/(float)res)*VG_TAUf ), cosf( ((float)(i+1)/(float)res)*VG_TAUf ) };
+
+ circle_mesh[ i*6+0 ] = 0.0f;
+ circle_mesh[ i*6+1 ] = 0.0f;
+
+ v2_copy( v0, circle_mesh + 32*6 + i*12 );
+ v2_muls( v0, 0.8f, circle_mesh + 32*6 + i*12+2 );
+ v2_copy( v1, circle_mesh + 32*6 + i*12+4 );
+
+ v2_copy( v1, circle_mesh + 32*6 + i*12+6 );
+ v2_muls( v1, 0.8f, circle_mesh + 32*6 + i*12+8 );
+ v2_muls( v0, 0.8f, circle_mesh + 32*6 + i*12+10 );
+
+ v2_copy( v0, circle_mesh + i*6+4 );
+ v2_copy( v1, circle_mesh + i*6+2 );
+ v2_copy( v0, circle_mesh+i*6+4 );
+ v2_copy( v1, circle_mesh+i*6+2 );
+ }
+
+ init_mesh( &world.circle, circle_mesh, vg_list_size( circle_mesh ) );
+ }
+
+ // Textures
+ {
+ tex_tile_detail = vg_tex2d_rgba( "textures/tile_overlays.png" );
+ vg_tex2d_mipmap();
+ vg_tex2d_linear_mipmap();
+ vg_tex2d_repeat();
+
+ tex_tile_data = vg_tex2d_rgba( "textures/tileset.png" );
+ vg_tex2d_mipmap();
+ vg_tex2d_linear_mipmap();
+ vg_tex2d_repeat();
+
+ tex_wood = vg_tex2d_rgba( "textures/wood.png" );
+ vg_tex2d_mipmap();
+ vg_tex2d_linear_mipmap();
+ vg_tex2d_repeat();
+
+ tex_ball = vg_tex2d_rgba( "textures/ball_metallic.png" );
+ vg_tex2d_mipmap();
+ vg_tex2d_linear_mipmap();
+ vg_tex2d_clamp();
+ }
+
+ map_load( level_pack[ 0 ] );
+}
+
+void vg_free(void)