diff --git a/doc/002.png b/doc/002.png new file mode 100644 index 0000000..1812ba8 Binary files /dev/null and b/doc/002.png differ diff --git a/tinyraycaster.cpp b/tinyraycaster.cpp index 4d4e6d8..6d51bcd 100644 --- a/tinyraycaster.cpp +++ b/tinyraycaster.cpp @@ -29,11 +29,43 @@ void drop_ppm_image(const std::string filename, const std::vector &ima ofs.close(); } +void draw_rectangle(std::vector &img, const size_t img_w, const size_t img_h, const size_t x, const size_t y, const size_t w, const size_t h, const uint32_t color) { + assert(img.size()==img_w*img_h); + for (size_t i=0; i framebuffer(win_w*win_h, 255); // the image itself, initialized to white + const size_t map_w = 16; // map width + const size_t map_h = 16; // map height + const char map[] = "0000222222220000"\ + "1 0"\ + "1 11111 0"\ + "1 0 0"\ + "0 0 1110000"\ + "0 3 0"\ + "0 10000 0"\ + "0 0 11100 0"\ + "0 0 0 0"\ + "0 0 1 00000"\ + "0 1 0"\ + "2 1 0"\ + "0 0 0"\ + "0 0000000 0"\ + "0 0"\ + "0002222222200000"; // our game map + assert(sizeof(map) == map_w*map_h+1); // +1 for the null terminated string + for (size_t j = 0; j