mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
PrimitiveDrawables WIP.
--HG-- branch : dev
This commit is contained in:
@@ -1,24 +1,45 @@
|
||||
#ifndef EE_GRAPHICS_ARCDRAWABLE
|
||||
#define EE_GRAPHICS_ARCDRAWABLE
|
||||
|
||||
#include <eepp/core.hpp>
|
||||
#include <eepp/graphics/primitivedrawable.hpp>
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
class ArcDrawable : public PrimitiveDrawable {
|
||||
public:
|
||||
ArcDrawable( const Float& radius, Uint32 segmentsCount = 0, const Float& arcAngle = 360.f , const Float& arcStartAngle = 0.f );
|
||||
ArcDrawable();
|
||||
|
||||
ArcDrawable( const Float& radius, Uint32 segmentsCount = 64, const Float& arcAngle = 360.f , const Float& arcStartAngle = 0.f );
|
||||
|
||||
virtual Sizef getSize();
|
||||
|
||||
virtual void draw( const Vector2f& position );
|
||||
|
||||
virtual void draw( const Vector2f& position, const Sizef& size );
|
||||
|
||||
Float getRadius() const;
|
||||
|
||||
void setRadius(const Float & radius);
|
||||
|
||||
Float getArcAngle() const;
|
||||
|
||||
void setArcAngle(const Float & arcAngle);
|
||||
|
||||
Float getArcStartAngle() const;
|
||||
|
||||
void setArcStartAngle(const Float & arcStartAngle);
|
||||
|
||||
Uint32 getSegmentsCount() const;
|
||||
|
||||
void setSegmentsCount(const Uint32 & segmentsCount);
|
||||
protected:
|
||||
Float mRadius;
|
||||
Uint32 mSegmentsCount;
|
||||
Float mArcAngle;
|
||||
Float mArcStartAngle;
|
||||
|
||||
void updateVertex();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
17
include/eepp/graphics/circledrawable.hpp
Normal file
17
include/eepp/graphics/circledrawable.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef EE_GRAPHICS_CIRCLEDRAWABLE_HPP
|
||||
#define EE_GRAPHICS_CIRCLEDRAWABLE_HPP
|
||||
|
||||
#include <eepp/graphics/arcdrawable.hpp>
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
class CircleDrawable : public ArcDrawable {
|
||||
public:
|
||||
CircleDrawable();
|
||||
|
||||
CircleDrawable( const Float& radius, const Uint32& segmentsCount );
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -188,6 +188,8 @@ enum EE_DRAWABLE_TYPE {
|
||||
DRAWABLE_TEXTURE,
|
||||
DRAWABLE_SUBTEXTURE,
|
||||
DRAWABLE_SPRITE,
|
||||
DRAWABLE_ARC,
|
||||
DRAWABLE_RECTANGLE,
|
||||
DRAWABLE_CUSTOM
|
||||
};
|
||||
|
||||
|
||||
@@ -5,24 +5,30 @@
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
class VertexBuffer;
|
||||
|
||||
class PrimitiveDrawable : public Drawable {
|
||||
public:
|
||||
PrimitiveDrawable( EE_DRAWABLE_TYPE drawableType );
|
||||
|
||||
virtual ~PrimitiveDrawable();
|
||||
|
||||
virtual void draw( const Vector2f& position, const Sizef& size );
|
||||
|
||||
/** Set the fill mode used to draw primitives */
|
||||
void setFillMode( const EE_FILL_MODE& Mode );
|
||||
virtual void setFillMode( const EE_FILL_MODE& Mode );
|
||||
|
||||
/** @return The fill mode used to draw primitives */
|
||||
const EE_FILL_MODE& getFillMode() const;
|
||||
|
||||
/** Set the blend mode used to draw primitives */
|
||||
void setBlendMode( const EE_BLEND_MODE& Mode );
|
||||
virtual void setBlendMode( const EE_BLEND_MODE& Mode );
|
||||
|
||||
/** @return The blend mode used to draw primitives */
|
||||
const EE_BLEND_MODE& getBlendMode() const;
|
||||
|
||||
/** Set the line width to draw primitives */
|
||||
void setLineWidth( const Float& width );
|
||||
virtual void setLineWidth( const Float& width );
|
||||
|
||||
/** @return The line with to draw primitives */
|
||||
const Float& getLineWidth() const;
|
||||
@@ -30,6 +36,18 @@ class PrimitiveDrawable : public Drawable {
|
||||
EE_FILL_MODE mFillMode;
|
||||
EE_BLEND_MODE mBlendMode;
|
||||
Float mLineWidth;
|
||||
Vector2f mPosition;
|
||||
bool mNeedsUpdate;
|
||||
bool mRecreateVertexBuffer;
|
||||
VertexBuffer * mVertexBuffer;
|
||||
|
||||
virtual void onAlphaChange();
|
||||
|
||||
virtual void onColorFilterChange();
|
||||
|
||||
void prepareVertexBuffer( const EE_DRAW_MODE& drawableType );
|
||||
|
||||
virtual void updateVertex() = 0;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
24
include/eepp/graphics/rectangledrawable.hpp
Normal file
24
include/eepp/graphics/rectangledrawable.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef EE_GRAPHICS_RECTANGLEDRAWABLE
|
||||
#define EE_GRAPHICS_RECTANGLEDRAWABLE
|
||||
|
||||
#include <eepp/graphics/primitivedrawable.hpp>
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
class RectangleDrawable : PrimitiveDrawable {
|
||||
public:
|
||||
RectangleDrawable();
|
||||
|
||||
~RectangleDrawable();
|
||||
|
||||
virtual Sizef getSize();
|
||||
|
||||
virtual void draw( const Vector2f& position );
|
||||
|
||||
virtual void draw( const Vector2f& position, const Sizef& size );
|
||||
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -12,8 +12,6 @@ class EE_API VertexBufferOGL : public VertexBuffer {
|
||||
public:
|
||||
VertexBufferOGL( const Uint32& VertexFlags = VERTEX_FLAGS_DEFAULT, EE_DRAW_MODE DrawType = DM_QUADS, const Int32& ReserveVertexSize = 0, const Int32& ReserveIndexSize = 0, EE_VBO_USAGE_TYPE UsageType = VBO_USAGE_TYPE_STATIC );
|
||||
|
||||
virtual ~VertexBufferOGL();
|
||||
|
||||
void bind();
|
||||
|
||||
void draw();
|
||||
|
||||
Reference in New Issue
Block a user