test 1 doc

Dependencies:   mbed Gamepad2

Revision:
6:00d20886e4f8
Parent:
5:928c2eee4109
Child:
7:530ca713d2b2
--- a/Platform/Platform.cpp	Fri May 22 01:26:24 2020 +0000
+++ b/Platform/Platform.cpp	Mon May 25 16:17:58 2020 +0000
@@ -1,8 +1,11 @@
 #include "Platform.h"
 
-Platform::Platform()
+Platform::Platform(int x, int y, int w, int h)
 {
-
+    _x = x;
+    _y = y;
+    _width = w;
+    _height = h;
 }
 
 Platform::~Platform()
@@ -10,30 +13,40 @@
 
 }
 
-//init
-void Platform::init()
+
+////////////////////// DRAW  //////////////////////////
+void Platform::draws(N5110 &lcd)
 {
-    x = 0;
-    y = 15;
-    width = 30;
-    height = 3;
+    lcd.drawRect(_x, _y, _width, _height, FILL_TRANSPARENT);
+    //debug prints
+    //printf("x: %i, y: %i, width: %i, height %i \n", x, y, width, height);
+}
+
+////////////////////// POSTITIONS //////////////////////////
+Vector4 Platform::get_pos()
+{
+    Vector4 pos = {_x, _y, _width, _height};
+    return pos;
 }
 
-void Platform::draw(N5110 &lcd)
+
+
+//------------------------------MAPS-----------------------------------//
+
+Platform maps[4] = {Platform(0, 15, 20, 3), Platform(64, 15, 20, 3), Platform(0, 40, 20, 3), Platform(64, 40, 20, 3)};
+
+////////////////////// DRAW MAP //////////////////////////
+void drawMap(N5110 &lcd)
 {
-    lcd.drawRect(x, y, width, height, FILL_TRANSPARENT);
-    _x = x;
-    _y = y;
-    _width = width;
-    _height = height;
-    
-    
-    //debug prints
-    printf("x: %i, y: %i, width: %i, height %i \n", x, y, width, height);
+    Vector4 coords;
+    for (int i = 0; i < 4; i++) {
+        maps[i].draws(lcd);
+        coords = maps[i].get_pos();
+        
+        //debugs
+        //printf("x: %i, y: %i,w: %i,h: %i \n",coords.x, coords.y, coords.width, coords.height);
+    }
+        //debugs
+        //printf("-----------------------------------------\n");
 }
 
-Vector3 Platform::get_plats()
-{
-    Vector3 pos = {_x, _y, _width, _height};
-    return pos;
-}
\ No newline at end of file