diff --git a/cascaydia.otf b/cascaydia.otf new file mode 100644 index 0000000..eda387e Binary files /dev/null and b/cascaydia.otf differ diff --git a/game.cpp b/game.cpp new file mode 100644 index 0000000..e69de29 diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..ab0349a --- /dev/null +++ b/main.cpp @@ -0,0 +1,60 @@ +#include +#include + +#define DELAY 30000 + +int main(int argc, char** argv) { + int x = 0, y = 0; + int max_x = 800, max_y = 600; + int direction = 0; + + sf::RenderWindow window(sf::VideoMode(max_x, max_y), "SFML Window"); + + sf::Font font; + if (!font.loadFromFile("cascaydia.otf")) { + std::cerr << "Failed to load font" << std::endl; + return 1; + } + + sf::Text text("o", font, 24); + text.setFillColor(sf::Color::White); + + while (window.isOpen()) { + sf::Event event; + while (window.pollEvent(event)) { + if (event.type == sf::Event::Closed) { + window.close(); + } + } + + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up) && y > 0) { + y--; + } + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down) && y < max_y - 1) { + y++; + } + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left) && x > 0) { + x--; + } + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right) && x < max_x - 1) { + x++; + } + + // Clear the window + window.clear(); + + // Set the position of the text + text.setPosition(x, y); + + // Draw the text on the window + window.draw(text); + + // Display everything that was drawn + window.display(); + + sf::sleep(sf::microseconds(DELAY)); + } + + return 0; +} + diff --git a/racingcar.cpp b/racingcar.cpp new file mode 100644 index 0000000..e69de29