aboutsummaryrefslogtreecommitdiffstats
path: root/instructables/cube_pc/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'instructables/cube_pc/main.c')
-rw-r--r--instructables/cube_pc/main.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/instructables/cube_pc/main.c b/instructables/cube_pc/main.c
new file mode 100644
index 0000000..61e4f9a
--- /dev/null
+++ b/instructables/cube_pc/main.c
@@ -0,0 +1,81 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "cube.h"
+#include "draw.h"
+#include "draw_3d.h"
+#include "effect.h"
+#include "gameoflife.h"
+#include "launch_effect.h"
+
+void *cube_updater (unsigned char rs232_cube[8][8]);
+
+int main (int argc, char **argv)
+{
+
+ if (argc < 2) {
+ fprintf(stderr, "Please indicate device to use.\n");
+ return 1;
+ }
+
+ cube_init(argv[1]);
+
+ pthread_t cube_thread;
+ int iret, i, x;
+
+ iret = pthread_create (&cube_thread, NULL, cube_updater, rs232_cube);
+
+
+ while (1)
+ {
+ for (i = 0; i < 0; i++) {
+ effect_blinky2();
+ }
+ for (i=0; i<EFFECTS_TOTAL; i++)
+ launch_effect(i);
+
+ printf("Effect: sidewaves\n");
+ sidewaves(2000,50);
+
+ printf("Effect: ripples\n");
+ ripples(2000,50);
+
+ printf("Effect: linespin\n");
+ linespin(2000,50);
+
+ printf("Effect: sinelines\n");
+ sinelines(2000,50);
+
+ printf("Effect: spheremove\n");
+ spheremove(1500,50);
+
+ printf("Effect: fireworks\n");
+ fireworks(7,50,600);
+
+ printf("Effect: gol_play\n");
+ for (i=0; i<10; i++)
+ {
+ for (x=0; x<20; x++)
+ setvoxel(rand()%4,rand()%4,rand()%4);
+
+ gol_play(50,1000);
+
+ }
+ }
+
+}
+
+void *cube_updater (unsigned char rs232_cube[8][8])
+{
+ unsigned char pushcube[8][8];
+
+
+ while (1)
+ {
+ memcpy(pushcube, rs232_cube, 64);
+ cube_push(pushcube);
+ }
+}
+
+