diff --git a/font.png b/font.png new file mode 100644 index 0000000..ec98654 Binary files /dev/null and b/font.png differ diff --git a/pixel.ttf b/pixel.ttf new file mode 100644 index 0000000..2442aff Binary files /dev/null and b/pixel.ttf differ diff --git a/src/main.cpp b/src/main.cpp index a7556f0..999a2f5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,12 +2,17 @@ #include #include #include +#include #include #include +#include +#include #include #include #include #include +#include +#include #include "globals.hpp" #include "elements.hpp" #include "maps.hpp" @@ -72,8 +77,14 @@ int main() { sf::RenderWindow window(sf::VideoMode({WIDTH, HEIGHT}), "SFML window", sf::Style::Default); window.setFramerateLimit(60); + sf::Font font("pixel.ttf"); + sf::Text text(font, "0, 0", 16); + text.setPosition({ WIDTH - (TILESIZE * 11.5), HEIGHT - (int)(TILESIZE / 1.5)}); + + float f = -1; while (window.isOpen()) { window.clear(sf::Color::Black); + text.setString(std::to_string((int)player.rect.getPosition().x) + ", " + std::to_string((int)player.rect.getPosition().y)); while (const std::optional event = window.pollEvent()) { if (event->is()) window.close(); @@ -91,6 +102,7 @@ int main() { // test_square.set_velocity({ -20, 0 }); // } // } + // player.handle_movment(); player.set_velocity_y(player.get_velocity().y + player.m_acceleration); player.rect.move({0, player.get_velocity().y}); @@ -182,6 +194,7 @@ int main() { window.draw(player.rect); // window.draw(test_square.rect); window.draw(line.rect); + window.draw(text); window.display(); } for(int i = 0; i < MAX_ROWS; i++) { diff --git a/tile.png b/tile.png new file mode 100644 index 0000000..72587ef Binary files /dev/null and b/tile.png differ