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

2D line segment More...

#include <Line.hpp>

Inheritance diagram for nom::Line:
[legend]

Public Types

typedef Line self_type
typedef Shape derived_class
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

 Line (void)
 Default constructor.
virtual ~Line (void)
 Destructor; should be fine to inherit from.
 Line (const IntRect &bounds, const Color4i &outline)
 Construct a Line object from parameters.
virtual Shapeclone () const override
 Implements the required Shape::clone method.
ObjectTypeInfo type () const override
 Re-implements the IObject::type method.
void update () override
void draw (RenderTarget &target) const override
 Render the line segments.
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 line segment

Todo
Use SDL2's new multi-line API; see SDL_RenderDrawLines.

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

Definition at line 46 of file Line.hpp.

Member Typedef Documentation

◆ derived_class

typedef Shape nom::Line::derived_class

Definition at line 50 of file Line.hpp.

◆ self_type

typedef Line nom::Line::self_type

Definition at line 49 of file Line.hpp.

Constructor & Destructor Documentation

◆ Line()

nom::Line::Line ( const IntRect & bounds,
const Color4i & outline )

Construct a Line object from parameters.

Parameters
boundsnom::IntRect object containing the starting & ending coordinates.
colornom::Color4i color to render.

Member Function Documentation

◆ clone()

virtual Shape * nom::Line::clone ( ) const
overridevirtual

Implements the required Shape::clone method.

Implements nom::Shape.

◆ draw()

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

Render the line segments.

Parameters
targetnom::RenderWindow object to render to.

Implements nom::IDrawable.

◆ type()

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

Re-implements the IObject::type method.

Remarks
This uniquely identifies the object's type.

Reimplemented from nom::IDrawable.

◆ update()

void nom::Line::update ( )
overridevirtual

Do nothing method; we have it only because it is required by interface contract with IDrawable (which is fine).

Todo
Measure performance (CPU cycles, ticks/FPS, ...) difference with using a return / abort on rendering when our line object is up-to-date and determine if it is worth the implementation VS risk of inconsistency. Jeffrey Carpenter i8deg.nosp@m.rees.nosp@m.@gmai.nosp@m.l.co.nosp@m.m @ 2013-10-03

Implements nom::IDrawable.


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