From: hgn Date: Sun, 19 Dec 2021 14:26:42 +0000 (+0000) Subject: . X-Git-Url: https://harrygodden.com/git/?p=fishladder.git;a=commitdiff_plain;h=b2ed006db6dc46c57b163f572391ac74a94f4a4f . --- diff --git a/fishladder.c b/fishladder.c index 8b64ffc..7520c2c 100644 --- a/fishladder.c +++ b/fishladder.c @@ -1,5 +1,6 @@ // Copyright (C) 2021 Harry Godden (hgn) - All Rights Reserved +//#define VG_CAPTURE_MODE #define VG_STEAM #define VG_STEAM_APPID 1218140U #include "vg/vg.h" diff --git a/fishladder_resources.h b/fishladder_resources.h index 98abd62..9b787d5 100644 --- a/fishladder_resources.h +++ b/fishladder_resources.h @@ -1,3 +1,106 @@ +// FONTS +vg_tex2d tex_ubuntu = { .path = "textures/ubuntu.qoi" }; + +static Character characters_Ubuntu[] = { + {983, 90, 18, 18, 9, 9, 7}, + {55, 90, 23, 40, 7, 31, 9}, + {794, 90, 27, 26, 7, 33, 13}, + {356, 49, 36, 40, 7, 31, 21}, + {307, 0, 32, 46, 7, 34, 18}, + {564, 0, 42, 41, 7, 31, 27}, + {646, 0, 38, 41, 8, 31, 21}, + {821, 90, 21, 26, 7, 33, 7}, + {118, 0, 26, 49, 6, 34, 10}, + {144, 0, 26, 49, 9, 34, 10}, + {674, 90, 31, 31, 8, 31, 15}, + {511, 90, 33, 34, 7, 26, 18}, + {771, 90, 23, 27, 8, 12, 8}, + {957, 90, 26, 21, 8, 20, 9}, + {900, 90, 23, 22, 7, 13, 8}, + {0, 0, 32, 49, 10, 34, 12}, + {791, 0, 33, 41, 7, 32, 18}, + {28, 90, 27, 40, 6, 31, 18}, + {956, 0, 32, 41, 7, 32, 18}, + {988, 0, 32, 41, 7, 32, 18}, + {604, 49, 34, 40, 8, 31, 18}, + {0, 49, 32, 41, 7, 31, 18}, + {872, 49, 32, 40, 7, 31, 18}, + {740, 49, 33, 40, 7, 31, 18}, + {824, 0, 33, 41, 7, 31, 18}, + {773, 49, 33, 40, 7, 31, 18}, + {446, 90, 23, 35, 7, 25, 8}, + {78, 90, 23, 40, 8, 26, 8}, + {608, 90, 33, 33, 7, 26, 18}, + {738, 90, 33, 27, 7, 23, 18}, + {641, 90, 33, 33, 7, 26, 18}, + {64, 49, 30, 41, 8, 31, 13}, + {339, 0, 44, 45, 7, 31, 30}, + {204, 49, 39, 40, 9, 31, 21}, + {638, 49, 34, 40, 6, 31, 20}, + {684, 0, 36, 41, 7, 31, 20}, + {392, 49, 36, 40, 6, 31, 23}, + {806, 49, 33, 40, 6, 31, 18}, + {904, 49, 32, 40, 6, 31, 17}, + {720, 0, 36, 41, 7, 31, 21}, + {464, 49, 35, 40, 6, 31, 22}, + {101, 90, 21, 40, 6, 31, 8}, + {968, 49, 31, 40, 9, 31, 16}, + {499, 49, 35, 40, 6, 31, 20}, + {936, 49, 32, 40, 6, 31, 16}, + {162, 49, 42, 40, 7, 31, 28}, + {428, 49, 36, 40, 6, 31, 23}, + {606, 0, 40, 41, 7, 31, 25}, + {672, 49, 34, 40, 6, 31, 19}, + {267, 0, 40, 46, 7, 31, 25}, + {756, 0, 35, 41, 6, 31, 20}, + {857, 0, 33, 41, 8, 32, 17}, + {534, 49, 35, 40, 8, 31, 18}, + {569, 49, 35, 40, 6, 31, 22}, + {243, 49, 39, 40, 9, 31, 21}, + {116, 49, 46, 40, 8, 31, 29}, + {282, 49, 37, 40, 8, 31, 20}, + {319, 49, 37, 40, 9, 31, 19}, + {706, 49, 34, 40, 8, 31, 18}, + {170, 0, 25, 49, 6, 34, 10}, + {32, 0, 32, 49, 10, 34, 12}, + {195, 0, 25, 49, 9, 34, 10}, + {705, 90, 33, 30, 7, 31, 18}, + {923, 90, 34, 21, 9, 6, 15}, + {842, 90, 24, 24, 7, 34, 12}, + {295, 90, 31, 35, 8, 26, 16}, + {383, 0, 33, 43, 6, 34, 19}, + {326, 90, 31, 35, 7, 26, 15}, + {416, 0, 33, 43, 7, 34, 19}, + {197, 90, 33, 35, 7, 26, 18}, + {512, 0, 28, 43, 6, 34, 12}, + {32, 49, 32, 41, 7, 26, 18}, + {481, 0, 31, 43, 6, 34, 18}, + {94, 49, 22, 41, 7, 32, 8}, + {241, 0, 26, 47, 11, 32, 8}, + {449, 0, 32, 43, 6, 34, 16}, + {540, 0, 24, 43, 7, 34, 8}, + {122, 90, 41, 35, 6, 26, 27}, + {357, 90, 31, 35, 6, 26, 18}, + {163, 90, 34, 35, 7, 26, 19}, + {890, 0, 33, 41, 6, 26, 19}, + {923, 0, 33, 41, 7, 26, 19}, + {418, 90, 28, 35, 6, 26, 12}, + {388, 90, 30, 35, 8, 26, 14}, + {0, 90, 28, 40, 7, 31, 13}, + {263, 90, 32, 35, 7, 25, 18}, + {544, 90, 33, 34, 8, 25, 16}, + {469, 90, 42, 34, 8, 25, 25}, + {230, 90, 33, 35, 8, 26, 16}, + {839, 49, 33, 40, 9, 25, 16}, + {577, 90, 31, 34, 8, 25, 15}, + {64, 0, 27, 49, 8, 34, 10}, + {220, 0, 21, 49, 6, 34, 9}, + {91, 0, 27, 49, 9, 34, 10}, + {866, 90, 34, 23, 8, 21, 18}, +}; + +static Font font_Ubuntu = { "Ubuntu", 32, 0, 0, 1024, 256, 95, characters_Ubuntu }; + // TEXTURES // =========================================================================================================== @@ -10,7 +113,7 @@ vg_tex2d tex_monofur = { .path = "textures/ascii.qoi", .flags = VG_TEXTURE_NO_ 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, &tex_buttons }; +vg_tex2d *texture_list[] = { &tex_tile_detail, &tex_tile_data, &tex_wood, &tex_background, &tex_ball_noise, &tex_monofur, &tex_unkown, &tex_buttons, &tex_ubuntu }; // AUDIO // =========================================================================================================== diff --git a/textures/ubuntu.png b/textures/ubuntu.png new file mode 100644 index 0000000..33972e1 Binary files /dev/null and b/textures/ubuntu.png differ diff --git a/vg/vg.h b/vg/vg.h index 13f3d63..b7ebb2f 100644 --- a/vg/vg.h +++ b/vg/vg.h @@ -39,8 +39,13 @@ GLFWwindow* vg_window; // 1366, 768 // 1920, 1080 +#ifdef VG_CAPTURE_MODE +int vg_window_x = 1920; +int vg_window_y = 1080; +#else int vg_window_x = 1366; int vg_window_y = 768; +#endif v2f vg_mouse; v3f vg_mouse_ws; @@ -154,8 +159,13 @@ static void vg_init( int argc, char *argv[], const char *window_name ) glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 3 ); glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE ); glfwWindowHint( GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE ); - glfwWindowHint( GLFW_RESIZABLE, GLFW_TRUE ); +#ifdef VG_CAPTURE_MODE + glfwWindowHint( GLFW_RESIZABLE, GLFW_FALSE ); +#else + glfwWindowHint( GLFW_RESIZABLE, GLFW_TRUE ); +#endif + glfwWindowHint( GLFW_SAMPLES, 4 ); GLFWmonitor *monitor_primary = glfwGetPrimaryMonitor(); diff --git a/vg/vg_ui.h b/vg/vg_ui.h index 1172850..70d30aa 100644 --- a/vg/vg_ui.h +++ b/vg/vg_ui.h @@ -93,7 +93,7 @@ struct ui_ctx struct ui_vert { ui_px co[2]; //32 4 - u8 uv[2]; //16 2 + i16 uv[2]; //32 4 u32 colour; //32 4 ui_rect clip; //64 8 } @@ -134,6 +134,18 @@ struct ui_ctx int image_count; }; +struct ui_sdf_char +{ + int x, y, width, height, originX, originY, advance; +}; + +struct ui_sdf_font +{ + const char *name; + int size, width, height; + struct ui_sdf_char *characters; +}; + // Globals // =========================================================================================================== @@ -185,7 +197,7 @@ static void ui_init_context( ui_ctx *ctx, int index_buffer_size ) glEnableVertexAttribArray( 0 ); // UV - glVertexAttribPointer( 1, 2, GL_UNSIGNED_BYTE, GL_FALSE, stride, (void *)offsetof( struct ui_vert, uv ) ); + glVertexAttribPointer( 1, 2, GL_SHORT, GL_FALSE, stride, (void *)offsetof( struct ui_vert, uv ) ); glEnableVertexAttribArray( 1 ); // COLOUR diff --git a/vg/vg_vector.h b/vg/vg_vector.h new file mode 100644 index 0000000..384fdd9 --- /dev/null +++ b/vg/vg_vector.h @@ -0,0 +1,9 @@ +// Copyright (C) 2021 Harry Godden (hgn) - All Rights Reserved + +struct vg_vector_vert +{ + u16 co[2]; // 8b + u16 uv[2]; // 8b + u32 colour; // 4b + ui_rect clip; //64 8 +}