a-game

2D platformer written from scratch.
git clone git://git.amin.space/a-game.git
Log | Files | Refs | README | LICENSE

commit 8246212e7d5347ce89650b53576cdbdd4a120aff
parent a853d1f2b1d8cbc02aaa6ed59d20d9c8bb0efa3e
Author: amin <dev@aminmesbah.com>
Date:   Sat,  6 Jul 2019 07:18:22 +0000

Use a nicer tile texture

FossilOrigin-Name: 63aeaa5ee123adbff898b220a3e901130516b165d07240aa45e435d20c3571b2
Diffstat:
Aassets/tile0.tga | 0
Msrc/game.c | 28++--------------------------
Msrc/render.c | 2+-
3 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/assets/tile0.tga b/assets/tile0.tga Binary files differ. diff --git a/src/game.c b/src/game.c @@ -195,7 +195,7 @@ internal void game_init(struct GameMemory *game_memory, v2u framebuffer) { size_t file_len = 0; //u8 *t = platform.platform_read_entire_file("assets/test_sw_origin.tga", &file_len); - u8 *t = platform.platform_read_entire_file("assets/test_sw_origin_rle.tga", &file_len); + u8 *t = platform.platform_read_entire_file("assets/tile0.tga", &file_len); assert(t); i32 img_w = 0; @@ -410,7 +410,7 @@ void game_update_and_render(struct GameMemory *game_memory, struct GameInput *ga // game_detect_collisions { -#if 1 +#if 0 #define RENDER_COLLISION_DEBUG_QUAD(r, c) renderer_debug_quad_draw(&game_state->renderer, (r), (c)); #else #define RENDER_COLLISION_DEBUG_QUAD(r, c) @@ -613,30 +613,6 @@ void game_update_and_render(struct GameMemory *game_memory, struct GameInput *ga } } -#if 0 - // texture test - { - m4 model = math_m4_init_id(); - model = math_translate(model, (v3) {12.5f, 5.0f, 0.0f}); - model = math_scale(model, (v3) {10.0f, 10.0f, 10.0f}); - static f32 bork = 0; - bork += dt; - f32 scale_factor = fabsf(1.0f * sinf(bork)); - model = math_scale(model, (v3) {scale_factor, scale_factor, 0.0f}); - v3 color = {1.0f, 1.0f, 1.0f}; - - renderer_job_enqueue( - &game_state->renderer, - (struct RenderJob) { - .ebo = game_state->renderer.quad_ebo, - .color = color, - .model = model, - .tex_interp = 1.0f, - .layer = RENDER_LAYER_DEBUG, - }); - } -#endif - renderer_jobs_sort(&game_state->renderer, &game_state->world_allocator); renderer_jobs_draw(&game_state->renderer); } diff --git a/src/render.c b/src/render.c @@ -59,7 +59,7 @@ internal void renderer_init(struct RendererState *renderer, struct Image *images glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glActiveTexture(GL_TEXTURE0); }