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
sprite.h
Go to the documentation of this file.
1
/*
2
MIT License
3
4
Copyright (c) 2018-2019, Alexey Dynda
5
6
Permission is hereby granted, free of charge, to any person obtaining a copy
7
of this software and associated documentation files (the "Software"), to deal
8
in the Software without restriction, including without limitation the rights
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
copies of the Software, and to permit persons to whom the Software is
11
furnished to do so, subject to the following conditions:
12
13
The above copyright notice and this permission notice shall be included in all
14
copies or substantial portions of the Software.
15
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
SOFTWARE.
23
*/
28
#ifndef _NANO_SPRITE_H_
29
#define _NANO_SPRITE_H_
30
31
#include "
canvas/point.h
"
32
#include "
canvas/rect.h
"
33
#include "object.h"
34
#include "
lcd_hal/io.h
"
35
45
template
<
class
T>
class
NanoSprite
:
public
NanoObject
<T>
46
{
47
public
:
55
NanoSprite
(
const
NanoPoint
&pos,
const
NanoPoint
&size,
const
uint8_t *bitmap)
56
:
NanoObject
<T>(pos, size)
57
, m_bitmap(bitmap)
58
{
59
}
60
61
void
draw
()
override
62
{
63
this->
getTiler
().getCanvas().drawBitmap1(this->
getRect
().p1.x, this->getRect().
p1
.
y
, this->
getRect
().
width
(),
64
this->
getRect
().
height
(), this->
getBitmap
());
65
}
66
70
void
setBitmap
(
const
uint8_t *bitmap)
71
{
72
m_bitmap = bitmap;
73
}
74
79
const
uint8_t *
getBitmap
()
80
{
81
return
m_bitmap;
82
}
83
84
private
:
85
const
uint8_t *m_bitmap;
86
};
87
91
template
<
class
T>
class
NanoFixedSprite
:
public
NanoSprite
<T>
92
{
93
public
:
94
using
NanoSprite<T>::NanoSprite
;
95
};
96
101
#endif
NanoSprite::setBitmap
void setBitmap(const uint8_t *bitmap)
Definition:
sprite.h:70
_NanoPoint
Definition:
point.h:39
NanoSprite
Definition:
sprite.h:45
_NanoRect::height
lcdint_t height() const
Definition:
rect.h:69
point.h
NanoObject::getRect
const NanoRect & getRect() const
Definition:
object.h:232
io.h
_NanoPoint::y
lcdint_t y
Definition:
point.h:44
rect.h
NanoObject
Definition:
object.h:49
NanoEngineObject::getTiler
T & getTiler()
Definition:
tiler.h:148
_NanoRect::width
lcdint_t width() const
Definition:
rect.h:51
_NanoRect::p1
NanoPoint p1
Definition:
rect.h:45
NanoSprite::NanoSprite
NanoSprite(const NanoPoint &pos, const NanoPoint &size, const uint8_t *bitmap)
Definition:
sprite.h:55
NanoSprite::getBitmap
const uint8_t * getBitmap()
Definition:
sprite.h:79
NanoSprite::draw
void draw() override
Definition:
sprite.h:61
NanoFixedSprite
Definition:
sprite.h:91
src
v2
nano_engine
sprite.h
Generated by
1.8.13