Permalink
Browse files

draw the player

  • Loading branch information...
ssloy committed Feb 9, 2019
1 parent c6a1206 commit 68d2cd560e1fa6b8a8850a55cdf19ff3f34f1b03
Showing with 5 additions and 0 deletions.
  1. BIN doc/003.png
  2. +5 −0 tinyraycaster.cpp
BIN +3.02 KB doc/003.png
Binary file not shown.
@@ -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++) {
@@ -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;

0 comments on commit 68d2cd5

Please sign in to comment.