summaryrefslogtreecommitdiffstats
path: root/src/pixelfunc.h
blob: 3b5ba6d69513031afc5932877ee44d209ede9cbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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 drawDoom();
void draw();
RCL_Unit heightAt(int16_t x, int16_t y);
void pixelFunc(RCL_PixelInfo *p);

/* end raycastlib */

#endif