Graphics::SceneObject Class Reference

A Scene containing multiple objects. More...

#include <Scene.h>

Inheritance diagram for Graphics::SceneObject:
Collaboration diagram for Graphics::SceneObject:

Public Types

using Callback = Delegate< void(SceneObject *scene)>
 
- Public Types inherited from Graphics::Object
enum class  Kind { XX }
 
using List = LinkedObjectListTemplate< Object >
 
using OwnedList = OwnedLinkedObjectListTemplate< Object >
 
- Public Types inherited from LinkedObjectTemplate< Object >
using Iterator = IteratorTemplate< Object, Object *, Object & >
 
using ConstIterator = IteratorTemplate< const Object, const Object *, const Object & >
 

Public Member Functions

 SceneObject ()
 
 SceneObject (Size size, const String &name=nullptr)
 
 SceneObject (RenderTarget &target, const String &name=nullptr)
 
Kind kind () const override
 
void write (MetaWriter &meta) const override
 
RenderercreateRenderer (const Location &location) const override
 Create a software renderer for this object. More...
 
template<typename T >
T * addObject (T *obj)
 Add a new object to the scene. More...
 
template<typename T >
std::enable_if< std::is_base_of< Asset, T >::value, T * >::type addAsset (T *asset)
 
ObjectAssetaddAsset (Object *object)
 
Size getSize () const
 
void reset (Size size)
 Reset the scene with a new size. More...
 
void clear (const Brush &brush=Color::Black)
 Clear the scene and fill with a chosen colour. More...
 
template<typename... ParamTypes>
FilledRectObjectfillRect (ParamTypes... params)
 
template<typename... ParamTypes>
RectObjectdrawRect (ParamTypes... params)
 
RectObjectdrawRoundRect (int x0, int y0, int w, int h, int radius, Color color)
 
FilledRectObjectfillRoundRect (int x0, int y0, int w, int h, int radius, Color color)
 
template<typename... ParamTypes>
LineObjectdrawLine (ParamTypes... params)
 
template<typename... ParamTypes>
PolylineObjectdrawTriangle (const Pen &pen, Point pt1, Point pt2, Point pt3)
 
PolylineObjectdrawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, Color color)
 
template<typename... ParamTypes>
PolylineObjectdrawPolyline (ParamTypes... params)
 
template<typename... ParamTypes>
CircleObjectdrawCircle (ParamTypes... params)
 
template<typename... ParamTypes>
FilledCircleObjectfillCircle (ParamTypes... params)
 
template<typename... ParamTypes>
EllipseObjectdrawEllipse (ParamTypes... params)
 
template<typename... ParamTypes>
FilledEllipseObjectfillEllipse (ParamTypes... params)
 
template<typename... ParamTypes>
ArcObjectdrawArc (ParamTypes... params)
 
template<typename... ParamTypes>
FilledArcObjectfillArc (ParamTypes... params)
 
template<typename... ParamTypes>
ReferenceObjectdrawImage (const ImageObject &image, Point pos, ParamTypes... params)
 
template<typename... ParamTypes>
ReferenceObjectdrawObject (const Object &object, ParamTypes... params)
 
SurfaceObjectcopySurface (Surface &surface, const Rect &dest, Point source)
 
CopyObjectcopy (const Rect &source, Point dest)
 Copy region of display to another. More...
 
ScrollObjectscroll (const Rect &area, int16_t cx, int16_t cy, bool wrapx=false, bool wrapy=false, Color fill=Color::None)
 Scroll display memory. More...
 
ScrollObjectscroll (const Rect &area, int16_t cx, int16_t cy, Color fill)
 
- Public Member Functions inherited from Graphics::Object
bool operator== (const Object &other) const
 
virtual String getTypeStr () const
 
- Public Member Functions inherited from LinkedObjectTemplate< Object >
Object * getNext () const
 
bool insertAfter (Object *object)
 
Iterator begin () const
 
Iterator end () const
 
Iterator cbegin () const
 
Iterator cend () const
 
- Public Member Functions inherited from LinkedObject
virtual ~LinkedObject ()
 
virtual LinkedObjectnext () const
 
bool insertAfter (LinkedObject *object)
 
bool operator== (const LinkedObject &other) const
 
bool operator!= (const LinkedObject &other) const
 

Public Attributes

Size size
 
CString name
 
OwnedList objects
 
AssetList assets
 

Detailed Description

A Scene containing multiple objects.

Member Typedef Documentation

◆ Callback

Constructor & Destructor Documentation

◆ SceneObject() [1/3]

Graphics::SceneObject::SceneObject ( )
inline

◆ SceneObject() [2/3]

Graphics::SceneObject::SceneObject ( Size  size,
const String name = nullptr 
)
inline

◆ SceneObject() [3/3]

Graphics::SceneObject::SceneObject ( RenderTarget target,
const String name = nullptr 
)
inline

Member Function Documentation

◆ addAsset() [1/2]

ObjectAsset* Graphics::SceneObject::addAsset ( Object object)
inline

◆ addAsset() [2/2]

template<typename T >
std::enable_if<std::is_base_of<Asset, T>::value, T*>::type Graphics::SceneObject::addAsset ( T *  asset)
inline

◆ addObject()

template<typename T >
T* Graphics::SceneObject::addObject ( T *  obj)
inline

Add a new object to the scene.

Parameters
objThis will be owned by the scene

Use this method to add custom objects. To draw an object multiple times use drawObject which will add a reference instead.

◆ clear()

void Graphics::SceneObject::clear ( const Brush brush = Color::Black)
inline

Clear the scene and fill with a chosen colour.

◆ copy()

CopyObject* Graphics::SceneObject::copy ( const Rect source,
Point  dest 
)
inline

Copy region of display to another.

Parameters
sourceArea to copy
destTop-left corner to copy to

◆ copySurface()

SurfaceObject* Graphics::SceneObject::copySurface ( Surface surface,
const Rect dest,
Point  source 
)
inline

◆ createRenderer()

Renderer* Graphics::SceneObject::createRenderer ( const Location location) const
overridevirtual

Create a software renderer for this object.

Parameters
location
Return values
rendererReturned renderer object

Return nullptr if object cannot/should not be rendered

Implements Graphics::Object.

◆ drawArc()

template<typename... ParamTypes>
ArcObject* Graphics::SceneObject::drawArc ( ParamTypes...  params)
inline

◆ drawCircle()

template<typename... ParamTypes>
CircleObject* Graphics::SceneObject::drawCircle ( ParamTypes...  params)
inline

◆ drawEllipse()

template<typename... ParamTypes>
EllipseObject* Graphics::SceneObject::drawEllipse ( ParamTypes...  params)
inline

◆ drawImage()

template<typename... ParamTypes>
ReferenceObject* Graphics::SceneObject::drawImage ( const ImageObject image,
Point  pos,
ParamTypes...  params 
)
inline

◆ drawLine()

template<typename... ParamTypes>
LineObject* Graphics::SceneObject::drawLine ( ParamTypes...  params)
inline

◆ drawObject()

template<typename... ParamTypes>
ReferenceObject* Graphics::SceneObject::drawObject ( const Object object,
ParamTypes...  params 
)
inline

◆ drawPolyline()

template<typename... ParamTypes>
PolylineObject* Graphics::SceneObject::drawPolyline ( ParamTypes...  params)
inline

◆ drawRect()

template<typename... ParamTypes>
RectObject* Graphics::SceneObject::drawRect ( ParamTypes...  params)
inline

◆ drawRoundRect()

RectObject* Graphics::SceneObject::drawRoundRect ( int  x0,
int  y0,
int  w,
int  h,
int  radius,
Color  color 
)
inline

◆ drawTriangle() [1/2]

template<typename... ParamTypes>
PolylineObject* Graphics::SceneObject::drawTriangle ( const Pen pen,
Point  pt1,
Point  pt2,
Point  pt3 
)
inline

◆ drawTriangle() [2/2]

PolylineObject* Graphics::SceneObject::drawTriangle ( int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2,
Color  color 
)
inline

◆ fillArc()

template<typename... ParamTypes>
FilledArcObject* Graphics::SceneObject::fillArc ( ParamTypes...  params)
inline

◆ fillCircle()

template<typename... ParamTypes>
FilledCircleObject* Graphics::SceneObject::fillCircle ( ParamTypes...  params)
inline

◆ fillEllipse()

template<typename... ParamTypes>
FilledEllipseObject* Graphics::SceneObject::fillEllipse ( ParamTypes...  params)
inline

◆ fillRect()

template<typename... ParamTypes>
FilledRectObject* Graphics::SceneObject::fillRect ( ParamTypes...  params)
inline

◆ fillRoundRect()

FilledRectObject* Graphics::SceneObject::fillRoundRect ( int  x0,
int  y0,
int  w,
int  h,
int  radius,
Color  color 
)
inline

◆ getSize()

Size Graphics::SceneObject::getSize ( ) const
inline

◆ kind()

Kind Graphics::SceneObject::kind ( ) const
inlineoverridevirtual

Implements Graphics::Object.

◆ reset()

void Graphics::SceneObject::reset ( Size  size)
inline

Reset the scene with a new size.

◆ scroll() [1/2]

ScrollObject* Graphics::SceneObject::scroll ( const Rect area,
int16_t  cx,
int16_t  cy,
bool  wrapx = false,
bool  wrapy = false,
Color  fill = Color::None 
)
inline

Scroll display memory.

Parameters
areaRegion to scroll
cxDistance to scroll horizontally
cyDistance to scroll vertically
wrapxtrue to scroll, false to clip in X direction
wrapxY scroll/clip
fillOptional color to fill in clip mode

◆ scroll() [2/2]

ScrollObject* Graphics::SceneObject::scroll ( const Rect area,
int16_t  cx,
int16_t  cy,
Color  fill 
)
inline

◆ write()

void Graphics::SceneObject::write ( MetaWriter meta) const
inlineoverridevirtual

Implements Graphics::Object.

Member Data Documentation

◆ assets

AssetList Graphics::SceneObject::assets

◆ name

CString Graphics::SceneObject::name

◆ objects

OwnedList Graphics::SceneObject::objects

◆ size

Size Graphics::SceneObject::size

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