nomlib
Loading...
Searching...
No Matches
nom::Rectangle Class Reference

2D Rectangle shape More...

#include <Rectangle.hpp>

Inheritance diagram for nom::Rectangle:
[legend]

Public Types

typedef Rectangle self_type
typedef Shape derived_type
Public Types inherited from nom::Shape
typedef Shape self_type
Public Types inherited from nom::Transformable
typedef Transformable self_type
Public Types inherited from nom::IDrawable
typedef IDrawable self_type
typedef self_type * raw_ptr
 A type definition for a C pointer – raw pointer – to an IDrawable object.
typedef std::unique_ptr< self_type > unique_ptr
 A type definition for a C++11 std::unique_ptr to an IDrawable object.
typedef std::shared_ptr< self_type > shared_ptr
 A type definition for a C++11 std::shared_ptr to an IDrawable object.
typedef const RenderWindow RenderTarget
Public Types inherited from nom::IObject
typedef IObject self_type
typedef IObjectraw_ptr

Public Member Functions

 Rectangle ()
 Default constructor.
virtual ~Rectangle ()
 Destructor; should be fine to inherit from.
 Rectangle (const IntRect &rect, const Color4i &fill)
 Construct a Rectangle object from parameters.
ObjectTypeInfo type () const override
 Re-implements the IObject::type method.
virtual Shapeclone () const override
Texturetexture () const
 Get a texture representation of the rectangle.
void update () override
void draw (RenderTarget &target) const override
 Render the rectangle shape.
Public Member Functions inherited from nom::Shape
virtual ~Shape (void)
 Destructor.
 Shape (const Shape &copy)
 Copy constructor.
ObjectTypeInfo type () const override
 Re-implements the IObject::type method.
const Color4i & outline_color (void) const
 Obtain the outline color used in rendering a shape.
const Color4i & fill_color (void) const
 Obtain the inside fill color used in rendering a shape.
void set_outline_color (const Color4i &color)
 Set the outline color of the shape to be rendered.
void set_fill_color (const Color4i &color)
 Set the inside (fill) color of the shape to be rendered.
Public Member Functions inherited from nom::Transformable
 Transformable (const Point2i &pos, const Size2i &size)
 Transformable (const IntRect &bounds)
 Construct an object using a complete set of coordinates (bounds).
ObjectTypeInfo type () const override
 Re-implements the IObject::type method.
const Point2i & position (void) const
 Getter for stored positioning coordinates.
const Size2i & size (void) const
 Getter for stored size dimensions.
virtual void set_position (const Point2i &coords)
 Set the positioning – X & Y rendering coordinates – of the object.
virtual void set_size (const Size2i &size)
 Set the size dimensions– width & height rendering coordinates of the object.
virtual void set_bounds (const IntRect &bounds)
 Set the complete bounds of the object – position (X, Y) and size (width and height) dimensions.
void set_position (int x, int y)
void set_size (int w, int h)
virtual void translate (const Point2i &pos)
Public Member Functions inherited from nom::IDrawable
 IDrawable (void)
 Do nothing at all default constructor.
virtual ~IDrawable (void)
 Do nothing at all destructor.
Public Member Functions inherited from nom::IObject
 IObject (void)
 Default constructor.
virtual ~IObject (void)
 Virtual destructor.
virtual bool is_type (const ObjectTypeInfo &rhs) const
 Compare this object type with another object's type.

Additional Inherited Members

Static Public Member Functions inherited from nom::IObject
template<typename Base, typename Derived>
static bool is_a (const Derived object)
 Compare two objects to determine if a derived class inherits from a base class object.
static void * operator new (nom::size_type mem)
static void operator delete (void *ptr)
Static Public Attributes inherited from nom::IObject
static uint64 total_alloc_bytes
static uint64 total_dealloc_bytes
Protected Member Functions inherited from nom::Shape
 Shape (void)

Detailed Description

2D Rectangle shape

Todo
Use SDL2's new multi-rectangle API; see SDL_RenderFillRects.

Jeffrey Carpenter i8deg.nosp@m.rees.nosp@m.@gmai.nosp@m.l.co.nosp@m.m @ 2013-10-03

Definition at line 48 of file Rectangle.hpp.

Member Typedef Documentation

◆ derived_type

typedef Shape nom::Rectangle::derived_type

Definition at line 52 of file Rectangle.hpp.

◆ self_type

typedef Rectangle nom::Rectangle::self_type

Definition at line 51 of file Rectangle.hpp.

Constructor & Destructor Documentation

◆ Rectangle()

nom::Rectangle::Rectangle ( const IntRect & rect,
const Color4i & fill )

Construct a Rectangle object from parameters.

Parameters
rectnom::IntRect object containing the coordinates.
colornom::Color4i color to fill with.

Member Function Documentation

◆ clone()

virtual Shape * nom::Rectangle::clone ( ) const
overridevirtual
Note
Implements the required Shape::clone method.

Implements nom::Shape.

◆ draw()

void nom::Rectangle::draw ( RenderTarget & target) const
overridevirtual

Render the rectangle shape.

Parameters
targetnom::RenderWindow object to render to.

Implements nom::IDrawable.

◆ texture()

Texture * nom::Rectangle::texture ( ) const

Get a texture representation of the rectangle.

Returns
A pointer to a new nom::Texture instance containing the rendering of the rectangle. The returned pointer is owned by the caller.
Remarks
This is an expensive function call.

◆ type()

ObjectTypeInfo nom::Rectangle::type ( ) const
overridevirtual

Re-implements the IObject::type method.

Remarks
This uniquely identifies the object's type.

Reimplemented from nom::IDrawable.

◆ update()

void nom::Rectangle::update ( )
overridevirtual
Note
Implements the required IDrawable::update method.

Implements nom::IDrawable.


The documentation for this class was generated from the following file: