a-game

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

commit 0f660ef29106284fb5cfb0d8c297211a43295d56
parent 02150a817068f774af47a986ae703d08baac3152
Author: amin <dev@aminmesbah.com>
Date:   Thu, 28 Mar 2019 07:12:25 +0000

Render a FFOOFF square

FossilOrigin-Name: a856a8467b06b83c69abea9d9878301219f6b2e74db49669d415fecb30b8b72a
Diffstat:
Msrc/game.c | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/game.c b/src/game.c @@ -254,6 +254,24 @@ void game_update_and_render(struct GameState *game_state, f32 dt, v2u framebuffe glBindVertexArray(0); } + // render player + { + glBindVertexArray(game_state->tiles.vao); + v2 player_pos = (v2) { screen.width / 2.0f, screen.height / 2.0f }; + m4 model = glmth_m4_init_id(); + model = glmth_translate(model, (v3) { player_pos.x, player_pos.y, 0.0f }); + model = glmth_scale(model, (v3) {100.0f, 100.0f, 1.0f}); + shader_setm4(&game_state->star_shader, "model", &model); + v3 color = (v3) { 1.0f, 0.0f, 1.0f }; + shader_setv3(&game_state->star_shader, "color", &color); + + m4 projection = glmth_projection_ortho(0.0f, screen.width, screen.height, 0.0f, -1.0f, 0.0f); + shader_setm4(&game_state->star_shader, "projection", &projection); + + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); + glBindVertexArray(0); + } + #if 0 // render stars {