add sfml project

add wxWidgets project
This commit is contained in:
2025-02-26 16:30:42 +01:00
parent c92383af46
commit 6064e56327
192 changed files with 32663 additions and 1 deletions
+47
View File
@@ -0,0 +1,47 @@
#include "SFML/Graphics.hpp"
using namespace sf;
int main()
{
RenderWindow window(VideoMode({ 640, 480 }), "Hello World Example");
CircleShape circle(100.0f);
circle.setFillColor(Color(200, 0, 0));
Texture texture("assets/card_clubs_02.png");
Sprite sprite(texture);
while (window.isOpen())
{
while (const std::optional event = window.pollEvent())
{
if (event->is<Event::Closed>())
{
window.close();
}
//else if (event->is<Event::KeyPressed>())
else if (const Event::KeyPressed* keyPressed = event->getIf<Event::KeyPressed>())
{
if (keyPressed->scancode == Keyboard::Scancode::Escape) {
window.close();
}
}
}
// move circle
if (Keyboard::isKeyPressed(Keyboard::Scancode::Right))
{
circle.move(Vector2f(1, 0));
}
// clear window to start every from scratch
window.clear();
window.draw(circle);
window.draw(sprite);
window.display();
}
return 0;
}