restructured everything
This commit is contained in:
parent
4225a524b9
commit
c66cae17f2
61 changed files with 18406 additions and 1710 deletions
45
src/graphics/drawable/shapes/Rectangle.cpp
Normal file
45
src/graphics/drawable/shapes/Rectangle.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include <graphics/drawable/shapes/Rectangle.hpp>
|
||||
#include <graphics/RenderTarget.hpp>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
namespace sdlu
|
||||
{
|
||||
Rectangle::Rectangle() :
|
||||
Shape()
|
||||
{
|
||||
}
|
||||
|
||||
Rectangle::Rectangle(const Vector2f& position, const Vector2f& size) :
|
||||
Shape()
|
||||
{
|
||||
this->position = position;
|
||||
this->size = size;
|
||||
}
|
||||
|
||||
Vector2f Rectangle::GetSize()
|
||||
{
|
||||
return this->size;
|
||||
}
|
||||
|
||||
void Rectangle::SetSize(const Vector2f& size)
|
||||
{
|
||||
this->size = size;
|
||||
}
|
||||
|
||||
void Rectangle::SetSize(float x, float y)
|
||||
{
|
||||
this->size = Vector2f(x, y);
|
||||
}
|
||||
|
||||
void Rectangle::Draw(SDL_Renderer* const renderer) const
|
||||
{
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, color.a);
|
||||
SDL_Rect rect;
|
||||
rect.x = position.x;
|
||||
rect.y = position.y;
|
||||
rect.w = size.x;
|
||||
rect.h = size.y;
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
}
|
||||
}
|
23
src/graphics/drawable/shapes/Shape.cpp
Normal file
23
src/graphics/drawable/shapes/Shape.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include <graphics/drawable/shapes/Shape.hpp>
|
||||
|
||||
namespace sdlu
|
||||
{
|
||||
Shape::~Shape()
|
||||
{
|
||||
}
|
||||
|
||||
void Shape::SetColor(const Color& color)
|
||||
{
|
||||
this->color = color;
|
||||
}
|
||||
|
||||
Color Shape::GetColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
Shape::Shape() :
|
||||
Drawable(), Transformable()
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue