summaryrefslogtreecommitdiffstats
path: root/src/pixelfunc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pixelfunc.h')
-rw-r--r--src/pixelfunc.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/pixelfunc.h b/src/pixelfunc.h
new file mode 100644
index 0000000..4316679
--- /dev/null
+++ b/src/pixelfunc.h
@@ -0,0 +1,51 @@
+#ifndef PIXEL_FUNC_H
+#define PIXEL_FUNC_H
+
+/* raycastlib */
+
+#define RCL_COMPUTE_FLOOR_DEPTH 0 // turn off what we don't need
+#define RCL_COMPUTE_CEILING_DEPTH 0
+#define RCL_PIXEL_FUNCTION pixelFunc // set our pixel function
+#include "raycastlib.h"
+#include "castRay.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <Watchy.h>
+
+#define SCREEN_W 100
+#define SCREEN_H 100
+
+#define PIXELS_TOTAL ((SCREEN_W + 1) * (SCREEN_H + 1))
+#define LEVEL_W 20
+#define LEVEL_H 15
+
+const int8_t level[LEVEL_W * LEVEL_H] = // here 1 means wall, 0 floor
+{
+/* 11 13 15 17 19
+ 0 1 2 3 4 5 6 7 8 9 10 12 14 16 18 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0, // 0
+ 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0, // 1
+ 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0, // 2
+ 1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0, // 3
+ 0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,1,0,0, // 4
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, // 5
+ 1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0, // 6
+ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0, // 7
+ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,1, // 8
+ 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0, // 9
+ 0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1, // 10
+ 0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,1,1,0,0,1, // 11
+ 0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0, // 12
+ 0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0, // 13
+ 0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0 // 14
+};
+
+void run_doom();
+void draw();
+RCL_Unit heightAt(int16_t x, int16_t y);
+void pixelFunc(RCL_PixelInfo *p);
+
+/* end raycastlib */
+
+#endif