diff --git a/src/opengl.c b/src/opengl.c index f82eaa1..3287ae9 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -1,3 +1,30 @@ +/** + * @file opengl.c + * + * @brief This file handles most of the more generic opengl functions. + * + * The main way to work with opengl in lephisto is to create glTextures and then + * use the blit functions to draw them on the screen. This system will handle + * relative and absolute positions. + * + * There are two coordinate systems: relative and absolute. + * + * Relative: + * -- Everything is drawn relative to the player, if it doesn't fit on the + * screen it is clipped. + * -- Origin (0., 0.) would be ontop of the player. + * + * Absolute: + * -- Everything is drawn in "screen coordinates". + * -- (0., 0.) is bottom left. + * -- (SCREEN_W, SCREEN_H) is top right. + * + * Note that the game actually uses a third type of coordinate for when using + * raw commands. In this third type, the (0., 0.) is actually in middle of the + * screen. (-SCREEN_W/2., -SCREEN_H/2.) is bottom left and + * (-SCREEN_W/2., -SCREEN_H/2.) is top right. + */ + #include #include #include "SDL_version.h" diff --git a/src/opengl.h b/src/opengl.h index 583d64c..4a6ae6a 100644 --- a/src/opengl.h +++ b/src/opengl.h @@ -7,15 +7,15 @@ /* Recommended for compatibility bullshit. */ #if SDL_BYTEORDER == SDL_BIG_ENDIAN -# define RMASK 0xff000000 -# define GMASK 0x00ff0000 -# define BMASK 0x0000ff00 -# define AMASK 0x000000ff +# define RMASK 0xff000000 /**< Red bit mask. */ +# define GMASK 0x00ff0000 /**< Green bit mask. */ +# define BMASK 0x0000ff00 /**< Blue bit mask. */ +# define AMASK 0x000000ff /**< Alpha bit mask. */ #else -# define RMASK 0x000000ff -# define GMASK 0x0000ff00 -# define BMASK 0x00ff0000 -# define AMASK 0xff000000 +# define RMASK 0x000000ff /**< Red bit mask. */ +# define GMASK 0x0000ff00 /**< Green bit mask. */ +# define BMASK 0x00ff0000 /**< Blue bit mask. */ +# define AMASK 0xff000000 /**< Alpha bit mask. */ #endif #define RGBAMASK RMASK,GMASK,BMASK,AMASK @@ -33,8 +33,6 @@ #define gl_has(f) (gl_screen.flags & (f)) /**< Check for the flag. */ /** - * @struct glInfo - * * @brief Store data about the current opengl environment. */ typedef struct glInfo_ { @@ -138,7 +136,7 @@ void gl_getSpriteFromDir(int* x, int* y, const glTexture* t, const double dir); void gl_screenshot(const char* filename); int SDL_savePNG(SDL_Surface* surface, const char* file); /*#if DEBUG == 1 */ -void gl_checkErr(void); +void gl_checkErr(void); /**< Hack to ignore errors when debugging. */ /*#else */ /*#define gl_checkErr() */ /*#endif */