init commit, with sample code

This commit is contained in:
2024-11-04 18:21:33 +01:00
parent dacbba25b3
commit 171650af73
705 changed files with 121089 additions and 0 deletions

53
main.cpp Normal file
View File

@@ -0,0 +1,53 @@
#include <iostream>
#include "SFML/Graphics.hpp"
int main()
{
std::cout << "Game started\n";
sf::RenderWindow window(sf::VideoMode(600, 800), "My window");
window.setVerticalSyncEnabled(true);
window.setFramerateLimit(60);
sf::RectangleShape rectangle(sf::Vector2f(120.0f, 50.0f));
float sizeIncrement = 1.0f;
while (window.isOpen()) {
window.clear();
if(rectangle.getSize().x > 5 && rectangle.getSize().y > 5 && rectangle.getSize().x < 300 && rectangle.getSize().y < 300) {
rectangle.setSize(rectangle.getSize() + sf::Vector2f(sizeIncrement, sizeIncrement));
rectangle.setPosition(
float(window.getSize().x) / 2 - rectangle.getSize().x / 2,
float(window.getSize().y) / 2 - rectangle.getSize().y / 2
);
} else {
rectangle.setSize(sf::Vector2f(120.0f, 50.0f));
rectangle.setPosition(
float(window.getSize().x) / 2 - rectangle.getSize().x / 2,
float(window.getSize().y) / 2 - rectangle.getSize().y / 2
);
}
// Tu są handlowane eventy
sf::Event event{};
while (window.pollEvent(event)) {
if(event.type == sf::Event::MouseWheelScrolled) {
if(event.mouseWheelScroll.delta > 0) {
sizeIncrement = 1.0f;
} else {
sizeIncrement = -1.0f;
}
}
if (event.type == sf::Event::Closed)
window.close();
}
window.draw(rectangle);
window.display();
}
return 0;
}