Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 6:75031d14fc0d
- Parent:
- 5:54d3b36fec2c
- Child:
- 7:15543cb10a14
--- a/main.cpp Fri Feb 22 19:15:50 2019 +0000
+++ b/main.cpp Sat Feb 23 16:19:29 2019 +0000
@@ -16,22 +16,43 @@
#endif
#include "Rasturizer.h"
#include "Cube.h"
+#include "Gamepad.h"
-
+ Gamepad gamepad;
int main()
{
+
+ gamepad.init();
Rasturizer renderer;
- Cube cube(5,5, 1,10);
- cube.rotateX(0.5);
+ Cube cube1(20,0,40,15);
+ Cube cube2(-20,0,40,15);
+
int i = 0;
while(1) {
renderer.clear();
- if (i == 6)
- i = 0;
- renderer.drawFace(cube.getFace(i));
+ //if (i == 6)
+ // i = 0;
+ for (int i = 0; i < 6; i++){
+ renderer.drawFace(cube1.getFace(i));
+ }
+ for (int i = 0; i < 6; i++){
+ renderer.drawFace(cube2.getFace(i));
+ }
+
+ Vector2D coord = gamepad.get_coord();
+ cube1.translate(coord.x,0,coord.y);
+ cube2.translate(coord.x,0,coord.y);
+
+ //if(gamepad.check_event(A){
+ // cube1.rotateX(0.5);
+ // cube2.rotateX(0.5);
+ //}
+
+
+
renderer.refresh(); // refresh the LCD so the pixels appear
- wait_ms(1000/1); // this gives a refresh rate of 10 frames per second
- i++;
+ wait_ms(1000/15); // this gives a refresh rate of 10 frames per second
+ //i++;
}
}
\ No newline at end of file