Add misc and sfml modules with initial implementations, including new classes, assets, and CMake integration.

This commit is contained in:
2026-02-27 16:02:24 +01:00
parent 939e98d5b2
commit 8c726d9cb5
883 changed files with 365 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
//
// Created by David Hackbarth on 27.02.26.
//
#include "Ball.h"
+13
View File
@@ -0,0 +1,13 @@
//
// Created by David Hackbarth on 27.02.26.
//
#ifndef CMAKESFMLPROJECT_BALL_H
#define CMAKESFMLPROJECT_BALL_H
class Ball {
};
#endif //CMAKESFMLPROJECT_BALL_H
+19
View File
@@ -0,0 +1,19 @@
//
// Created by David Hackbarth on 27.02.26.
//
#include "Paddle.h"
Paddle::Paddle(sf::Keyboard::Key upKey, sf::Keyboard::Key downKey) : _shape(sf::Vector2f(20, 100)), _upKey(upKey),
_downKey(downKey) {
_shape.setFillColor(sf::Color::White);
}
void Paddle::Update(float dt) {
if (sf::Keyboard::isKeyPressed(_upKey)) {
_shape.move(sf::Vector2f(0, -100 * dt));
}
if (sf::Keyboard::isKeyPressed(_downKey)) {
_shape.move(sf::Vector2f(0, 100 * dt));
}
}
+25
View File
@@ -0,0 +1,25 @@
//
// Created by David Hackbarth on 27.02.26.
//
#ifndef CMAKESFMLPROJECT_PADDLE_H
#define CMAKESFMLPROJECT_PADDLE_H
#include "SFML/Graphics/RectangleShape.hpp"
#include "SFML/Window/Keyboard.hpp"
class Paddle {
public:
Paddle(sf::Keyboard::Key upKey, sf::Keyboard::Key downKey);
sf::RectangleShape& getShape() { return _shape; }
void Update(float dt);
private:
sf::RectangleShape _shape;
sf::Keyboard::Key _upKey;
sf::Keyboard::Key _downKey;
};
#endif //CMAKESFMLPROJECT_PADDLE_H