28 #ifndef _NANO_OBJECT_H_ 29 #define _NANO_OBJECT_H_ 255 return static_cast<NanoObject<T> *
>(prev ? prev->m_next : m_first);
326 while ( p && p != &
object )
344 object.m_next =
nullptr;
345 object.setTiler(this->
m_tiler);
352 getPrev()->
m_next = &object;
368 object.m_next = m_first;
369 object.m_tiler = this->
m_tiler;
381 if ( m_first ==
nullptr )
384 else if ( &
object == m_first )
387 m_first =
object.m_next;
388 object.m_next =
nullptr;
389 object.m_tiler =
nullptr;
396 if ( p->
m_next == &
object )
399 p->
m_next =
object.m_next;
400 object.m_next =
nullptr;
401 object.m_tiler =
nullptr;
NanoObject< T > * getNext(NanoObject< T > *prev=nullptr)
Returns next object in the list.
bool has(NanoObject< T > &object)
Returns true if NanoObjectList contains specified object.
void moveBy(const NanoPoint &p)
Moves sprite to new position by specified offset.
struct _NanoPoint NanoPoint
Describes point.
void refresh() override
Marks nano object location for refreshing on the new frame.
lcdint_t height() const
Returns height of NanoObject.
T * m_tiler
Active tiler, assigned to the NanoEngineObject.
NanoRect structure describes rectangle area.
void setSize(const NanoPoint &size)
Sets new size of NanoObject.
lcdint_t y() const
Returns sprite y position.
const NanoPoint bottom() const
Returns bottom-center point of the sprite.
Template class for NanoEngine objects lists.
lcdint_t height() const
returns height of NanoRect
NanoPoint p2
right-bottom point of the rectangle area
int8_t lcdint_t
internal int type, used by the library.
NanoObject(const NanoPoint &pos, const NanoPoint &size)
Creates basic object with arbitrary size.
const NanoRect & getRect() const
Returns rectangle area, occupied by the NanoObject.
const NanoPoint right() const
Returns right-center point of the sprite.
SSD1306 HAL IO communication functions.
lcdint_t y
y position in pixels
const NanoPoint left() const
Returns left-center point of the sprite.
const NanoPoint & getPosition() const
Returns current sprite position (top-left corner)
const NanoPoint top() const
Returns top-center point of the sprite.
void insert(NanoObject< T > &object)
Adds new NanoObject to the beginning of the list and marks it for refresh.
void resize(const NanoPoint &size)
Resizes NanoObject and marks screen area for refresh.
void draw() override
Draws nano object Engine canvas.
void refresh() override
Refreshes all objects in the list.
struct _NanoRect NanoRect
NanoRect structure describes rectangle area.
void moveTo(const NanoPoint &p)
Moves sprite to new position and marks screen area for refresh.
This is base class for all NanoObjects.
NanoObject< T > * getPrev(NanoObject< T > *curr=nullptr)
Returns previous object in the list.
void update() override
Updates all objects in the list.
bool hasTiler()
Returns true if NanoEngineObject is bound to NanoEngine instance.
NanoObject(const NanoPoint &pos)
Creates basic object with the size [1,1].
T & getTiler()
Returns reference to NanoEngine.
NanoRect m_rect
Rectangle area occupied by the object.
lcdint_t width() const
Returns width of NanoObject.
void update() override
Updates NanoObject.
void add(NanoObject< T > &object)
Adds new NanoObject to the end of the list and marks it for refresh.
void setTiler(T *tiler)
Bind NanoEngineObject to specific NanoEngine.
lcdint_t x() const
Returns sprite x position.
void draw() override
Draw all objects from the list in the buffer.
lcdint_t width() const
returns width of NanoRect
NanoEngineObject< T > * m_next
Next NanoEngineObject in the list.
const NanoPoint center() const
Returns center point of the sprite.
NanoPoint p1
top-left point of the rectangle area
lcdint_t x
x position in pixels
Tiler helper for graphics processing.
Template class for all NanoEngine objects.
void setPos(const NanoPoint &p)
Sets position of NanoObject, doesn't mark for update content on the screen.