ELEC2645 (2018/19) / Mbed 2 deprecated el17aio

Dependencies:   mbed

Revision:
9:241a1a7d8527
Parent:
8:87a845b8575e
Child:
10:c33d7593a275
--- a/RosenEngine/RosenEngine.cpp	Tue Mar 12 10:53:11 2019 +0000
+++ b/RosenEngine/RosenEngine.cpp	Tue Apr 09 05:14:07 2019 +0000
@@ -13,12 +13,12 @@
 }
 
 
-// Checks if a mission has been completed and if it has return new mission number
-
-void RosenEngine::init(int ship_speed,int ship_width,int ship_height,int ship_xpos,int ship_ypos)
+void RosenEngine::init(int ship_width,int ship_height,int ship_speed,int ship_xpos,int ship_ypos)
 {
     // initialise the game parameters
-    _ship.init(ship_speed,ship_width,ship_height,ship_xpos,ship_ypos);
+    _ship.init(ship_width,ship_height,ship_speed,ship_xpos,ship_ypos);
+    _menu.init(16);
+    
     
 }
 
@@ -27,14 +27,31 @@
     Vector2D mapped_coord = pad.get_coord();
     _xjoystick = mapped_coord.x;
     _yjoystick = mapped_coord.y;
+    _d = pad.get_direction();
+   // printf("_xjoystick ,_yjoystick = %f , %f\n",_xjoystick, _yjoystick);
 }
 
 void RosenEngine::draw(N5110 &lcd)
 {
     _ship.draw_ship(lcd);
+    _weapons.draw(lcd);
 }
 
 void RosenEngine::update(Gamepad &pad)
 {
     _ship.update_ship(_xjoystick,_yjoystick);
+    _weapons.update();
 }
+void RosenEngine::get_pos()
+{
+
+    Vector2D ship_pos = _ship.get_pos();
+    ship_xpos = ship_pos.x;
+    ship_ypos = ship_pos.y;
+    ship_width = 9;
+    _weapons.init(ship_xpos, ship_ypos, ship_width);
+}
+void RosenEngine::title(N5110 &lcd)
+{
+    _menu.title(lcd,_d); 
+}
\ No newline at end of file