SDL Breakout Engine
0.1.0
An implementation of a Breakout game using sdl, implemented with efficient resource management.
|
#include <GameObject.hpp>
Public Member Functions | |
bool | Collide (GameObject &el2, bool angle) |
bool | Collide (Brick &el2, bool angle) |
MovingGUIElement (const std::shared_ptr< TextureWrapper > &texture, const Vector3D &startPosition, Vector3D direction) | |
Blank moving element. More... | |
MovingGUIElement (const std::shared_ptr< TextureWrapper > &texture, const Vector3D &startPosition, Vector3D direction, const std::string &tag) | |
Blank moving element. More... | |
MovingGUIElement () | |
Blank moving element. More... | |
![]() | |
MovingGUIElement (const std::shared_ptr< TextureWrapper > &texture, const Vector3D &startPosition, Vector3D direction) | |
MovingGUIElement (const std::shared_ptr< TextureWrapper > &texture, const Vector3D &startPosition, Vector3D direction, const std::string &tag) | |
void | Move (float dt, int screenWidth, int screenHeight) |
void | UpdateDirection (const Vector3D &direction) |
MovingGUIElement () | |
Blank moving element. More... | |
const Vector3D & | _GetDirection () const |
bool | Collide (GameObject &el2, bool angle) |
![]() | |
GUIElement (const std::shared_ptr< TextureWrapper > &texture) | |
GUIElement (const std::shared_ptr< TextureWrapper > &texture, const std::string &tag) | |
GUIElement (const std::shared_ptr< TextureWrapper > &texture, const Vector3D &startPosition) | |
GUIElement (const std::shared_ptr< TextureWrapper > &texture, const Vector3D &startPosition, const std::string &tag) | |
void | Render (SDL_Renderer *renderer) |
GUIElement () | |
blank GUIElement More... | |
![]() | |
GameObject (const std::string &tag) | |
GameObject (const Vector3D &position) | |
GameObject (const Vector3D &position, const std::string &tag) | |
GameObject (const Vector3D &position, const Vector3D &size) | |
GameObject (const Vector3D &position, const Vector3D &size, const std::string &tag) | |
void | Update (const Vector3D &position) |
Vector3D | GetSize () |
Vector3D | GetSize () const |
const Vector3D & | _GetPosition () const |
void | DebugRender (SDL_Renderer *renderer) |
virtual void | Hit (const std::string &tag) |
GameObject () | |
default constructor for a gameobject More... | |
Additional Inherited Members | |
![]() | |
std::string | mTag = "" |
the name of this object, should be unique to other objects unless grouping is desired. More... | |
bool | alive = true |
whether this object is alive or not. More... | |
![]() | |
std::shared_ptr< TextureWrapper > | mTexture |
internal texture More... | |
SDL_Rect | mDestination |
rectangle representing the bounding box More... | |
![]() | |
int | mWidth = 0 |
internal width More... | |
int | mHeight = 0 |
internal height More... | |
Vector3D | mPosition = Vector3D(0, 0, 0) |
internal position More... | |
Vector3D | startPosition |
start position More... | |
The specialized Ball gui element. Represents a ball in a breakout game.
bool Ball::Collide | ( | Brick & | el2, |
bool | angle | ||
) |
Attempts collision with the given object, if angle is true then perform a range of movement.
angle is too specific for a general API class like this, should be abstracted into the Ball class.
use vector math to determine the angle between the two objects, and then the distance, for more effective collision checking
Currently calculates overlap between the two bounding boxes and compares them to determine what type of collision happened. This is effective for rectangles but is a very elaborate implementation.
el2 | the object to check collision with |
angle | whether to change this objects direction relative to where it hit el2 |
Plays a brick sound and score a point.
bool Ball::Collide | ( | GameObject & | el2, |
bool | angle | ||
) |
Attempts collision with the given object, if angle is true then perform a range of movement.
angle is too specific for a general API class like this, should be abstracted into the Ball class.
use vector math to determine the angle between the two objects, and then the distance, for more effective collision checking
Currently calculates overlap between the two bounding boxes and compares them to determine what type of collision happened. This is effective for rectangles but is a very elaborate implementation.
el2 | the object to check collision with |
angle | whether to change this objects direction relative to where it hit el2 |
Plays a sound upon contact as it must be a paddle hit.
|
usingdefault |
Blank moving element.
|
using |
Blank moving element.
|
using |
Blank moving element.