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
player.h
1
/*
2
MIT License
3
4
Copyright (c) 2021, 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
*/
24
25
#pragma once
26
27
#include "game_basic.h"
28
#include "sprites.h"
29
30
31
class
Player
:
public
NanoFixedSprite
<GraphicsEngine::TilerT>
32
{
33
public
:
34
explicit
Player
(
const
NanoPoint
&pos);
35
36
void
draw
()
override
;
37
38
void
move(uint8_t direction);
39
40
void
reset();
41
42
uint8_t getCoins();
43
44
private
:
45
/* The variable is used for player animation *
46
* The graphics defined for the hero has 2 images *
47
* for each direction. So, the variable is either *
48
* 0 or 1. */
49
uint8_t playerAnimation = 0;
50
51
/* Timestamp when playerAnimation was changed last time */
52
uint16_t playerAnimationTs = 0;
53
54
/* Number of coins collected */
55
uint8_t goldCollection = 0;
56
57
};
58
59
_NanoPoint
Definition:
point.h:39
Player::draw
void draw() override
Player
Definition:
player.h:31
NanoFixedSprite
Definition:
sprite.h:91
examples
wio_terminal
lode_runner
src
player.h
Generated by
1.8.13