#include "pixelfunc.h" RCL_Camera camera; static int dx = 1; static int dy = 0; static int dr = 1; static int frame = 0; void pixelFunc(RCL_PixelInfo *p) { int c = GxEPD_WHITE; if (p->isWall) { c = GxEPD_BLACK; } if (displayPtr != nullptr) { displayPtr->drawPixel(p->position.x, p->position.y, c); } } RCL_Unit heightAt(int16_t x, int16_t y) { int32_t index = y * LEVEL_W + x; if (index < 0 || (index >= LEVEL_W * LEVEL_H)) return RCL_UNITS_PER_SQUARE * 2; return level[y * LEVEL_W + x] * RCL_UNITS_PER_SQUARE * 2; } void draw() { RCL_RayConstraints c; RCL_initRayConstraints(&c); c.maxHits = 1; c.maxSteps = 100; RCL_renderSimple(camera,heightAt,0,0,c); } void drawDoom() { RCL_initCamera(&camera); camera.position.x = 2 * RCL_UNITS_PER_SQUARE; camera.position.y = 2 * RCL_UNITS_PER_SQUARE; camera.direction = 0; camera.resolution.x = SCREEN_W; camera.resolution.y = SCREEN_H; for (int i = 0; i < 100; ++i) { draw(); if (rand() % 100 == 0) { dr = 1 - rand() % 3; } camera.height = RCL_UNITS_PER_SQUARE + RCL_sin(frame * 16) / 2; frame++; } }