Upload files to "/"

This commit is contained in:
Wolf 2025-09-24 14:22:47 +00:00
parent c898dd8996
commit 9fe18da843
5 changed files with 84 additions and 26 deletions

View file

@ -1,31 +1,50 @@
#include <SFML/Graphics.hpp>
#include "vokzal.hpp"
using namespace std;
int main() {
// Створюємо вікно 800x600
// Створюємо вікно 1950x1200
sf::RenderWindow window(sf::VideoMode(1950, 1200), "Test Game Window");
//
vector<Platform> platforms;
platforms.push_back(Platform(299.f, 900.f, 200.f, 40.f));
platforms.push_back(Platform(700.f, 725.f, 200.f, 40.f));
platforms.push_back(Platform(1300.f, 700.f, 300.f, 50.f));
platforms.push_back(Platform(400.f, 600.f, 250.f, 30.f));
Platform ground(100.f, 1050.f, 300.f, 50.f);
window.setFramerateLimit(90); //вище 200 не рокимендую піднімати частоту після 600 буде чути писк дроселів
window.setFramerateLimit(90); //вище 200 не рокимендую піднімати частоту після 600 буде чути писк дроселів
Player player;
// Простий квадрат для гравця
sf::Clock clock;
sf::Clock gameClock;
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
window.close();}
window.close();
}
//if(event.type== sf::Event::Resized){}
float deltaTime = clock.restart().asSeconds();
float deltaTime = gameClock.restart().asSeconds();
player.update(deltaTime, platforms); // логіка гравця
player.update(deltaTime); // викликаємо логіку гравця
window.clear(sf::Color::Black); // очистка вікна
player.draw(window); // малюємо квадрат
// малюємо платформи
for (auto& platform : platforms) {
platform.draw(window);
}
ground.draw(window);
// малюємо гравця
player.draw(window);
window.display(); // відображення
}
return 0;
}