wooo
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#ifndef GRAPHICS_HPP
|
||||
#define GRAPHICS_HPP
|
||||
|
||||
// Ball, Paddle
|
||||
|
||||
#include <SFML/Graphics/CircleShape.hpp>
|
||||
#include <SFML/Graphics/RectangleShape.hpp>
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
|
||||
#include "globals.hpp"
|
||||
|
||||
struct Ball
|
||||
{
|
||||
Ball(sf::Vector2f pos) : velocity({ VELOCITY_X, VELOCITY_Y })
|
||||
{
|
||||
object.setSize({ (float)SIZE_X / 2, (float)SIZE_X / 2 });
|
||||
object.setPosition(pos);
|
||||
};
|
||||
|
||||
sf::Vector2f velocity;
|
||||
sf::RectangleShape object;
|
||||
};
|
||||
|
||||
struct Paddle
|
||||
{
|
||||
Paddle(sf::Vector2f pos)
|
||||
{
|
||||
rect.setSize({ SIZE_X, SIZE_Y });
|
||||
rect.setPosition(pos);
|
||||
};
|
||||
|
||||
int points;
|
||||
sf::RectangleShape rect;
|
||||
};
|
||||
|
||||
void
|
||||
check_and_move();
|
||||
void
|
||||
handle_ball();
|
||||
|
||||
extern Paddle p1;
|
||||
extern Paddle p2;
|
||||
extern Ball ball;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user