#include #include #include #include "player.h" #include "gun.h" #include "point.h" #include "velocity.h" float width = 1280; float height = 720; std::string window_name = "Toxy"; int main() { sf::RenderWindow window(sf::VideoMode(width, height), window_name); window.setVerticalSyncEnabled(true); // V-Sync enabled float angle; int mouseX, mouseY; sf::Color color(8, 105, 201); sf::Texture gunTexture; gunTexture.loadFromFile("sprites/gunRight.png"); Player player(Point(width / 2, height / 2), Velocity(0,0), color, Gun(player.getPoint(), gunTexture, 150, 45)); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); } window.clear(sf::Color(184, 184, 184)); mouseX = sf::Mouse::getPosition(window).x - width / 2; mouseY = sf::Mouse::getPosition(window).y - height / 2; player.setAngle(atan2(mouseY,mouseX)); player.draw(window); window.display(); } return 0; }