1
0
Fork 0
forked from NotAShelf/rogged

render: add player sprite. welcome to dude man

This commit is contained in:
A.M. Rowsell 2026-04-08 10:22:26 -04:00
commit 0b3608b18c
Signed by: amr
GPG key ID: E0879EDBDB0CA7B1
6 changed files with 10 additions and 6 deletions

View file

@ -505,6 +505,8 @@ static void game_loop(void) {
GameState gs;
memset(&gs, 0, sizeof(GameState));
load_audio_assets(&gs);
// entities
Texture2D player_tile = LoadTexture("./assets/entities/player_white.png");
// Initialize first floor
rng_seed(12345);
init_floor(&gs, 1);
@ -552,7 +554,7 @@ static void game_loop(void) {
render_map(&gs.map);
render_items(gs.items, gs.item_count);
render_enemies(gs.enemies, gs.enemy_count);
render_player(&gs.player);
render_player(&gs.player, &player_tile);
EndMode2D();
// Floating texts follow world shake

View file

@ -29,10 +29,12 @@ void render_map(const Map *map) {
}
}
void render_player(const Player *p) {
Rectangle rect = {(float)(p->position.x * TILE_SIZE), (float)(p->position.y * TILE_SIZE), (float)TILE_SIZE,
(float)TILE_SIZE};
DrawRectangleRec(rect, BLUE);
void render_player(const Player *p, Texture2D *ptile) {
//Rectangle rect = {(float)(p->position.x * TILE_SIZE), (float)(p->position.y * TILE_SIZE), (float)TILE_SIZE,
// (float)TILE_SIZE};
//DrawRectangleRec(rect, BLUE);
DrawTexture(*ptile, (float)(p->x * TILE_SIZE), (float)(p->y * TILE_SIZE), (Color){255, 255, 255, 255});
}
void render_enemies(const Enemy *enemies, int count) {

View file

@ -77,7 +77,7 @@
void render_map(const Map *map);
// Render the player
void render_player(const Player *p);
void render_player(const Player *p, Texture2D *ptile);
// Render all enemies
void render_enemies(const Enemy *enemies, int count);