LCDGFX LCD display driver  1.1.5
This library is developed to control SSD1306/SSD1325/SSD1327/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
NanoEngineTiler< C, D > Class Template Reference

#include <tiler.h>

Inheritance diagram for NanoEngineTiler< C, D >:

Public Types

typedef NanoEngineTiler< C, D > TilerT
 

Public Member Functions

void refresh ()
 
void refresh (const NanoRect &rect)
 
void refresh (const NanoPoint &point) __attribute__((noinline))
 
void refresh (lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2) __attribute__((noinline))
 
void refreshWorld (const NanoRect &rect)
 
void refreshWorld (lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2) __attribute__((noinline))
 
void refreshWorld (const NanoPoint &point)
 
void localCoordinates ()
 
void worldCoordinates ()
 
void moveTo (const NanoPoint &position)
 
void moveToAndRefresh (const NanoPoint &position)
 
const NanoPointgetPosition () const
 
void drawCallback (TNanoEngineOnDraw callback)
 
bool collision (const NanoPoint &p, const NanoRect &rect)
 Returns true if point is inside the rectangle area. Returns true if point is inside the rectangle area. More...
 
void insert (NanoEngineObject< TilerT > &object) __attribute__((noinline))
 
void remove (NanoEngineObject< TilerT > &object) __attribute__((noinline))
 
void update () __attribute__((noinline))
 
C & getCanvas ()
 
D & getDisplay ()
 

Protected Member Functions

 NanoEngineTiler (D &display)
 
void displayBuffer () __attribute__((noinline))
 refreshes content on oled display. Refreshes content on oled display. Call it, if you want to update the screen. Engine will update only those areas, which are marked by refresh() methods.
 
void displayPopup (const char *msg)
 prints popup message over display content prints popup message over display content More...
 

Protected Attributes

D & m_display
 
TNanoEngineOnDraw m_onDraw
 
uint16_t m_refreshFlags [NE_MAX_TILE_ROWS]
 

Detailed Description

template<class C, class D>
class NanoEngineTiler< C, D >

This class template is responsible for holding and updating data about areas to be refreshed on LCD display. It accepts canvas class, tile width in pixels, tile height in pixels and number of bits in tile width as arguments for the template. For example, for 8x8 8-bit RGB tiles the reference should be NanoEngineTiler<NanoCanvas8,8,8,3>, and 3 bits means 3^2 = 8. If you need to have single big buffer, holding the whole content for monochrome display, you can specify something like this NanoEngineTiler<NanoCanvas1,128,64,7>.

Definition at line 79 of file tiler.h.

Member Typedef Documentation

◆ TilerT

template<class C , class D >
typedef NanoEngineTiler<C, D> NanoEngineTiler< C, D >::TilerT

This type is template argument for all Nano Objects.

Definition at line 191 of file tiler.h.

Constructor & Destructor Documentation

◆ NanoEngineTiler()

template<class C , class D >
NanoEngineTiler< C, D >::NanoEngineTiler ( D &  display)
inlineexplicitprotected

Only child classes can initialize the engine

Definition at line 184 of file tiler.h.

Member Function Documentation

◆ collision()

template<class C , class D >
bool NanoEngineTiler< C, D >::collision ( const NanoPoint p,
const NanoRect rect 
)
inline

Returns true if point is inside the rectangle area. Returns true if point is inside the rectangle area.

Parameters
p- point to check
rect- rectangle, describing the region to check with the point
Returns
true if point is inside the rectangle area.

Definition at line 353 of file tiler.h.

◆ displayPopup()

template<class C , class D >
void NanoEngineTiler< C, D >::displayPopup ( const char *  msg)
protected

prints popup message over display content prints popup message over display content

Parameters
msg- message to display

Definition at line 518 of file tiler.h.

◆ drawCallback()

template<class C , class D >
void NanoEngineTiler< C, D >::drawCallback ( TNanoEngineOnDraw  callback)
inline

Sets user-defined draw callback. This callback will be called everytime, engine needs to update display content. If user callback returns false, engine will not update that area. You always have a way to find out, which area is being updated by engine via NanoEngine<>::canvas::getOffset() and NanoEngine<>::NE_TILE_SIZE.

Warning
By default canvas in the engine is initialized with world coordinates. So graphics object with [0,0] coordinates will be placed at topleft position fo the window pointed by offset property of NanoEngine. But engine supports also local coordinates, if you need to draw some dialog, for example. In this case actual object position depends on current engine offset. Refer to worldCoordinates() and localCoordinates().
Parameters
callback- user-defined draw callback.
Note
you can change draw callback anytime you need.
See also
worldCoordinates()
localCoordinates()

Definition at line 341 of file tiler.h.

◆ getCanvas()

template<class C , class D >
C& NanoEngineTiler< C, D >::getCanvas ( )
inline

Returns canvas, used by the NanoEngine.

Definition at line 425 of file tiler.h.

◆ getDisplay()

template<class C , class D >
D& NanoEngineTiler< C, D >::getDisplay ( )
inline

Returns reference to display object.

Definition at line 433 of file tiler.h.

◆ getPosition()

template<class C , class D >
const NanoPoint& NanoEngineTiler< C, D >::getPosition ( ) const
inline

Returns current World offset

Definition at line 320 of file tiler.h.

◆ insert()

template<class C , class D >
void NanoEngineTiler< C, D >::insert ( NanoEngineObject< TilerT > &  object)
inline

Inserts new NanoEngineObject. This object will be displayed during next call to update()/draw() methods.

Parameters
objectreference to object to place to NanoEngine

Definition at line 364 of file tiler.h.

◆ localCoordinates()

template<class C , class D >
void NanoEngineTiler< C, D >::localCoordinates ( )
inline

Switches engine canvas to local coordinates system. This method can be useful to ease up drawing of some static elements on lcd display.

Warning
do not call twice subsequentally.

Definition at line 284 of file tiler.h.

◆ moveTo()

template<class C , class D >
void NanoEngineTiler< C, D >::moveTo ( const NanoPoint position)
inline

Moves engine coordinate to new position (this sets World coordinates offset).

Definition at line 302 of file tiler.h.

◆ moveToAndRefresh()

template<class C , class D >
void NanoEngineTiler< C, D >::moveToAndRefresh ( const NanoPoint position)
inline

Moves engine coordinate to new position and mark whole display for refresh (this sets World coordinates offset).

Definition at line 311 of file tiler.h.

◆ refresh() [1/4]

template<class C , class D >
void NanoEngineTiler< C, D >::refresh ( )
inline

Marks all tiles for update. Actual update will take place in display() method.

Definition at line 201 of file tiler.h.

◆ refresh() [2/4]

template<class C , class D >
void NanoEngineTiler< C, D >::refresh ( const NanoRect rect)
inline

Mark specified area in pixels for redrawing by NanoEngine. Actual update will take place in display() method.

Note
assumes that rect is in local screen coordinates

Definition at line 211 of file tiler.h.

◆ refresh() [3/4]

template<class C , class D >
void NanoEngineTiler< C, D >::refresh ( const NanoPoint point)
inline

Mark specified area in pixels for redrawing by NanoEngine. Actual update will take place in display() method.

Definition at line 220 of file tiler.h.

◆ refresh() [4/4]

template<class C , class D >
void NanoEngineTiler< C, D >::refresh ( lcdint_t  x1,
lcdint_t  y1,
lcdint_t  x2,
lcdint_t  y2 
)
inline

Mark specified area in pixels for redrawing by NanoEngine. Actual update will take place in display() method.

Definition at line 231 of file tiler.h.

◆ refreshWorld() [1/3]

template<class C , class D >
void NanoEngineTiler< C, D >::refreshWorld ( const NanoRect rect)
inline

Marks for refresh lcd area, which corresponds to specified rectangle in global (World) coordinates. If engine offset is (0,0), then this function refreshes the same area as refresh().

Definition at line 255 of file tiler.h.

◆ refreshWorld() [2/3]

template<class C , class D >
void NanoEngineTiler< C, D >::refreshWorld ( lcdint_t  x1,
lcdint_t  y1,
lcdint_t  x2,
lcdint_t  y2 
)
inline

Marks for refresh lcd area, which corresponds to specified rectangle in global (World) coordinates. If engine offset is (0,0), then this function refreshes the same area as refresh().

Definition at line 265 of file tiler.h.

◆ refreshWorld() [3/3]

template<class C , class D >
void NanoEngineTiler< C, D >::refreshWorld ( const NanoPoint point)
inline

Marks specified pixel area for redrawing by NanoEngine.

Parameters
pointpoint in global (World) coordinates

Definition at line 274 of file tiler.h.

◆ remove()

template<class C , class D >
void NanoEngineTiler< C, D >::remove ( NanoEngineObject< TilerT > &  object)
inline

Removes NanoEngineObject from the list, but doesn't destroy the object. The place occupied by this object will be refreshed during next call to update()/draw() methods.

Parameters
objectobject to remove from NanoEngine

Definition at line 379 of file tiler.h.

◆ update()

template<class C , class D >
void NanoEngineTiler< C, D >::update ( )
inline

Updates all objects. This method doesn't refresh screen content

Definition at line 412 of file tiler.h.

◆ worldCoordinates()

template<class C , class D >
void NanoEngineTiler< C, D >::worldCoordinates ( )
inline

Switches engine canvas to global (World) coordinates system. This method can be useful to create screen moving animation.

Warning
do not call twice subsequentally.

Definition at line 294 of file tiler.h.

Member Data Documentation

◆ m_display

template<class C , class D >
D& NanoEngineTiler< C, D >::m_display
protected

Reference to display object, used by NanoEngine

Definition at line 442 of file tiler.h.

◆ m_onDraw

template<class C , class D >
TNanoEngineOnDraw NanoEngineTiler< C, D >::m_onDraw
protected

Callback to call if specific tile needs to be updated

Definition at line 445 of file tiler.h.

◆ m_refreshFlags

template<class C , class D >
uint16_t NanoEngineTiler< C, D >::m_refreshFlags[NE_MAX_TILE_ROWS]
protected

Contains information on tiles to be updated. Elements of array are rows and bits are columns.

Definition at line 451 of file tiler.h.


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