diff --git a/demo1.cpp b/demo1.cpp index 03bc0b2..b10dd1c 100644 --- a/demo1.cpp +++ b/demo1.cpp @@ -38,6 +38,9 @@ Player player; Sprite sprites[SPRITES]; +unsigned char floorGradient[15]; +unsigned char ceilGradient[15]; + /// For each level square says the texture index. const unsigned char levelTexture[] = { @@ -1023,8 +1026,8 @@ inline void pixelFunc(RCL_PixelInfo *pixel) } else color = pixel->isFloor ? - rgbToIndex(intensity/2,intensity,intensity/3) : - rgbToIndex(intensity,intensity/2,0); + floorGradient[RCL_clamp(intensity,0,14)] : + ceilGradient[RCL_clamp(intensity,0,14)]; putSubsampledPixel(pixel->position.x,pixel->position.y,color); } @@ -1094,6 +1097,9 @@ int main() { initGeneral(); + initGradient(floorGradient,rgbToIndex(3,7,0)); + initGradient(ceilGradient,rgbToIndex(6,2,1)); + defaultConstraints.maxHits = 8; defaultConstraints.maxSteps = 10;