Skip to content

Commit

Permalink
draw the player
Browse files Browse the repository at this point in the history
  • Loading branch information
ssloy committed Feb 10, 2019
1 parent c6a1206 commit 68d2cd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Binary file added doc/003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tinyraycaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ int main() {
"0 0"\
"0002222222200000"; // our game map
assert(sizeof(map) == map_w*map_h+1); // +1 for the null terminated string
float player_x = 3.456; // player x position
float player_y = 2.345; // player y position

for (size_t j = 0; j<win_h; j++) { // fill the screen with color gradients
for (size_t i = 0; i<win_w; i++) {
Expand All @@ -86,6 +88,9 @@ int main() {
}
}

// draw the player on the map
draw_rectangle(framebuffer, win_w, win_h, player_x*rect_w, player_y*rect_h, 5, 5, pack_color(255, 255, 255));

drop_ppm_image("./out.ppm", framebuffer, win_w, win_h);

return 0;
Expand Down

0 comments on commit 68d2cd5

Please sign in to comment.