diff --git a/GameMap.h b/GameMap.h index 2188413..6511a7d 100644 --- a/GameMap.h +++ b/GameMap.h @@ -1,5 +1,21 @@ #ifndef MAIN_Gmap_H #define MAIN_Gmap_H +#include + +enum class E_TileType +{ + Floor, + Wall, + Empty +}; + +struct GameMap +{ + GameMap(); + +private: + std::vector> now_wall; +}; #endif \ No newline at end of file diff --git a/Image.cpp b/Image.cpp index 792adb8..908c68e 100644 --- a/Image.cpp +++ b/Image.cpp @@ -80,6 +80,17 @@ Image::Image(Image&& a) noexcept : width(a.width), height(a.height), size(a.size a.data = nullptr; } +Image::Image(const Image ©, E_ImgRotation rot) : width(copy.height), height(copy.width), size(copy.size), channels(copy.channels) +{ + data = new Pixel[width * (size_t)height]; + for (int y = 0; y < height; y++) + for (int x = 0; x < width; x++) + SetPixel(x, y, copy.GetPixel(height - 1 - y, x)); + + self_allocated = true; + return; +} + int Image::Save(const std::string &a_path) { diff --git a/Image.h b/Image.h index fd444c1..742983e 100644 --- a/Image.h +++ b/Image.h @@ -47,6 +47,8 @@ inline bool operator< (const Pixel a, const Pixel b) constexpr Pixel backgroundColor{0, 0, 0, 0}; +enum class E_ImgRotation { Rot_90 }; + struct Image { explicit Image(const std::string &a_path); @@ -58,6 +60,8 @@ struct Image Image(const Image ©, int scale); Image(const Image ©, int scale_x, int scale_y); + Image(const Image ©, E_ImgRotation rot); + Image(const Image ©); Image(Image && a) noexcept; diff --git a/main.cpp b/main.cpp index 9b756ca..c3b0cdf 100644 --- a/main.cpp +++ b/main.cpp @@ -164,6 +164,8 @@ int main(int argc, char** argv) glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT); GL_CHECK_ERRORS; glClearColor(0.0f, 0.0f, 0.0f, 1.0f); GL_CHECK_ERRORS; + + Image img90 {img, E_ImgRotation::Rot_90}; //game loop while (!glfwWindowShouldClose(window)) { //GLfloat currentFrame = glfwGetTime(); @@ -174,9 +176,10 @@ int main(int argc, char** argv) glfwPollEvents(); img.Draw(screenBuffer, {64 * 0,0}); - img.Draw(screenBuffer, {64 * 1,0}, true); - img.Draw(screenBuffer, {64 * 2,0}, false, true); - img.Draw(screenBuffer, {64 * 3,0}, true, true); + img90.Draw(screenBuffer, {64 * 1,0}); + //img.Draw(screenBuffer, {64 * 1,0}, true); + //img.Draw(screenBuffer, {64 * 2,0}, false, true); + //img.Draw(screenBuffer, {64 * 3,0}, true, true); processPlayerMovement(player); player.Draw(screenBuffer); diff --git a/maps/F.txt b/maps/F.txt index 4e05452..7075fe0 100644 --- a/maps/F.txt +++ b/maps/F.txt @@ -1,15 +1,15 @@ z+ ####################.#################### #.................#...#.................# -#.................#...#.................# -#....G............#...#.................# -#.................#...#.................# -#.................#.....................# -#.................#...#.................# -#.................#...#.................# -#.................#...#.................# -#.................#...#.................# -#.................#...#.................# +#.............. ..#...#.................# +#....G......... #...#.................# +#........... ..#...#.................# +#........... .....#.....................# +#.... .. . .....#...#.................# +# ... . .....#...#.................# +# .. ... ........#...#.................# +#. .. ... ........#...#.................# +#. . ............#...#.................# #.................#...#.................# #.................#...#.................# #...............###...###...............#