ELEC2645 (2019/20)
/
ELEC2645_Project_el18jb
test 1 doc
Platform/Platform.cpp@5:928c2eee4109, 2020-05-22 (annotated)
- Committer:
- joebarhouch
- Date:
- Fri May 22 01:26:24 2020 +0000
- Revision:
- 5:928c2eee4109
- Child:
- 6:00d20886e4f8
Platform classes for map design;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joebarhouch | 5:928c2eee4109 | 1 | #include "Platform.h" |
joebarhouch | 5:928c2eee4109 | 2 | |
joebarhouch | 5:928c2eee4109 | 3 | Platform::Platform() |
joebarhouch | 5:928c2eee4109 | 4 | { |
joebarhouch | 5:928c2eee4109 | 5 | |
joebarhouch | 5:928c2eee4109 | 6 | } |
joebarhouch | 5:928c2eee4109 | 7 | |
joebarhouch | 5:928c2eee4109 | 8 | Platform::~Platform() |
joebarhouch | 5:928c2eee4109 | 9 | { |
joebarhouch | 5:928c2eee4109 | 10 | |
joebarhouch | 5:928c2eee4109 | 11 | } |
joebarhouch | 5:928c2eee4109 | 12 | |
joebarhouch | 5:928c2eee4109 | 13 | //init |
joebarhouch | 5:928c2eee4109 | 14 | void Platform::init() |
joebarhouch | 5:928c2eee4109 | 15 | { |
joebarhouch | 5:928c2eee4109 | 16 | x = 0; |
joebarhouch | 5:928c2eee4109 | 17 | y = 15; |
joebarhouch | 5:928c2eee4109 | 18 | width = 30; |
joebarhouch | 5:928c2eee4109 | 19 | height = 3; |
joebarhouch | 5:928c2eee4109 | 20 | } |
joebarhouch | 5:928c2eee4109 | 21 | |
joebarhouch | 5:928c2eee4109 | 22 | void Platform::draw(N5110 &lcd) |
joebarhouch | 5:928c2eee4109 | 23 | { |
joebarhouch | 5:928c2eee4109 | 24 | lcd.drawRect(x, y, width, height, FILL_TRANSPARENT); |
joebarhouch | 5:928c2eee4109 | 25 | _x = x; |
joebarhouch | 5:928c2eee4109 | 26 | _y = y; |
joebarhouch | 5:928c2eee4109 | 27 | _width = width; |
joebarhouch | 5:928c2eee4109 | 28 | _height = height; |
joebarhouch | 5:928c2eee4109 | 29 | |
joebarhouch | 5:928c2eee4109 | 30 | |
joebarhouch | 5:928c2eee4109 | 31 | //debug prints |
joebarhouch | 5:928c2eee4109 | 32 | printf("x: %i, y: %i, width: %i, height %i \n", x, y, width, height); |
joebarhouch | 5:928c2eee4109 | 33 | } |
joebarhouch | 5:928c2eee4109 | 34 | |
joebarhouch | 5:928c2eee4109 | 35 | Vector3 Platform::get_plats() |
joebarhouch | 5:928c2eee4109 | 36 | { |
joebarhouch | 5:928c2eee4109 | 37 | Vector3 pos = {_x, _y, _width, _height}; |
joebarhouch | 5:928c2eee4109 | 38 | return pos; |
joebarhouch | 5:928c2eee4109 | 39 | } |