Update general.hpp

This commit is contained in:
Miloslav Číž 2018-10-02 15:18:05 +02:00
parent 65efb399e2
commit 25a7430081

View file

@ -14,11 +14,11 @@
#include "stdio.h" // for debugging raycastlibg #include "stdio.h" // for debugging raycastlibg
#define RCL_VERTICAL_FOV RCL_UNITS_PER_SQUARE /* redefine camera vertical FOV: #define RCL_VERTICAL_FOV RCL_UNITS_PER_SQUARE /* Redefine camera vertical FOV:
RCL_UNITS_PER_SQUARE would normally mean RCL_UNITS_PER_SQUARE would normally mean
360 degrees, but it's not an actual 360 degrees, but it's not an actual
angle, just linear approximation, so angle, just linear approximation, so
this is okay */ this is okay. */
#define RCL_PIXEL_FUNCTION pixelFunc #define RCL_PIXEL_FUNCTION pixelFunc
/* ^ This has to be defined to the name of the function that will render /* ^ This has to be defined to the name of the function that will render
pixels. */ pixels. */
@ -29,7 +29,7 @@
Pokitto::Core pokitto; Pokitto::Core pokitto;
#ifndef FPS #ifndef FPS
#define FPS 30 #define FPS 255
#endif #endif
#ifndef PLAYER_SPEED #ifndef PLAYER_SPEED
@ -70,7 +70,7 @@ Pokitto::Core pokitto;
#define TRANSPARENT_COLOR 0x8f ///< Transparent color for sprites and GUI. #define TRANSPARENT_COLOR 0x8f ///< Transparent color for sprites and GUI.
#define HUE(c) (c * 16 + 8) ///< Gives a middle color of given hue (0 to 15). #define HUE(c) (c * 16 + 8) ///< Gives a middle color of given hue (0 to 15).
RCL_Unit zBuffer[SUBSAMPLED_WIDTH]; ///< 1D z-buffer for visibility determination. RCL_Unit zBuffer[SUBSAMPLED_WIDTH]; ///< 1D z-buffer for visibility determination.
@ -202,7 +202,7 @@ void initPalette()
Adds given intensity to a color. Adds given intensity to a color.
@param color input color @param color input color
@param intensity intensity to add, 3 bit (0 to 7) @param intensity intensity to add, can be negative, will be clamped
@return new color @return new color
*/ */
inline uint8_t addIntensity(uint8_t color, int16_t intensity) inline uint8_t addIntensity(uint8_t color, int16_t intensity)
@ -236,7 +236,7 @@ inline uint8_t sampleImage(const unsigned char *image, RCL_Unit x, RCL_Unit y)
/** /**
Draws a scaled sprite on screen in an optimized way. The sprite has to be Draws a scaled sprite on screen in an optimized way. The sprite has to be
square in resolution. square in resolution for that.
*/ */
void inline drawSpriteSquare(const unsigned char *sprite, int16_t x, int16_t y, RCL_Unit depth, int16_t size, int16_t intensity) void inline drawSpriteSquare(const unsigned char *sprite, int16_t x, int16_t y, RCL_Unit depth, int16_t size, int16_t intensity)
{ {
@ -298,6 +298,10 @@ void drawImage(const unsigned char *image, int16_t x, int16_t y)
} }
} }
/**
General player class stuffed with everything the demos need. You'll probably
want to write your own.
*/
class Player class Player
{ {
public: public:
@ -411,6 +415,10 @@ public:
} }
}; };
/**
Sprite class, again just bare minimum to fit the needs. Prefer writing your
own.
*/
class Sprite class Sprite
{ {
public: public: