PocketEmpires/Gfx.h

85 lines
2.1 KiB
C

#ifndef __GFX_HEADER__
#define __GFX_HEADER__
/* *************************************
* Includes
* *************************************/
#include "Global_Inc.h"
#include "System.h"
#include "Player.h"
#include "Camera.h"
#ifdef __cplusplus
extern "C"
{
#endif //__cplusplus
/* *************************************
* Defines
* *************************************/
#define X_SCREEN_RESOLUTION 84
#define Y_SCREEN_RESOLUTION 48
#define GFX_WHITE 0
#define GFX_BLACK 1
#define GFX_INVERT 2
#define GFX_GRAY 3
#define GFX_NOFLIP 0
#define GFX_FLIPH 1
#define GFX_FLIPV 2
#define GFX_FLIPHV (GFX_FLIPH | GFX_FLIPV)
#define GFX_NOROT 0
#define GFX_ROTCCW 1
#define GFX_ROTCW 3
/* *************************************
* Structs and enums
* *************************************/
typedef struct t_sprite
{
int8_t x;
int8_t y;
uint8_t w;
uint8_t h;
uint8_t rotation;
uint8_t flip;
uint8_t color;
const uint8_t* Data;
}TYPE_SPRITE;
typedef struct t_Resource TYPE_RESOURCES;
typedef struct t_Camera TYPE_CAMERA;
/* *************************************
* Global prototypes
* *************************************/
void GfxDrawSprite(TYPE_SPRITE* ptrSprite);
void GfxDrawCircle(uint16_t x, uint16_t y, uint8_t radius, int8_t color);
void GfxDrawRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, int8_t color);
void GfxFillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, int8_t color);
void GfxDrawLine(uint8_t x0, uint8_t x1, uint8_t y0, uint8_t y1, uint8_t color);
bool GfxRefreshNeeded(void);
void GfxShowKeyboard(char* str, uint8_t length);
uint8_t GfxGetWidthFromSpriteData(const uint8_t* sprData);
uint8_t GfxGetHeightFromSpriteData(const uint8_t* sprData);
bool GfxIsSpriteInsideScreenArea(TYPE_SPRITE* spr);
void GfxClearScreen(void);
#ifdef __cplusplus
void GfxPrintText_Flash(const __FlashStringHelper * str);
#endif // __cplusplus
void GfxPrintText(const char* str, uint8_t x, uint8_t y);
void GfxPrintTextFont(const char* str, const uint8_t* font, uint8_t x, uint8_t y);
void GfxInit(void);
#ifdef __cplusplus
}
#endif //__cplusplus
#endif //__GFX_HEADER__