wooo
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#ifndef GLOBALS_HPP
|
||||
#define GLOBALS_HPP
|
||||
|
||||
// General
|
||||
|
||||
#define TILESIZE 32.0f
|
||||
#define WIDTH (TILESIZE * 16)
|
||||
#define HEIGHT (TILESIZE * 13)
|
||||
#define FPS 60
|
||||
|
||||
//Paddle
|
||||
|
||||
#define SIZE_X 10
|
||||
#define SIZE_Y 50
|
||||
#define POS_Y 200
|
||||
#define VELOCITY 4
|
||||
|
||||
// Ball
|
||||
|
||||
#define VELOCITY_X 3
|
||||
#define VELOCITY_Y 2
|
||||
|
||||
#endif
|
||||
@@ -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