You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.4 KiB
58 lines
1.4 KiB
/** |
|
* @file text_render.hpp |
|
* |
|
* Text rendering. |
|
*/ |
|
#pragma once |
|
|
|
#include <cstdint> |
|
|
|
#include <SDL.h> |
|
|
|
#include "DiabloUI/ui_item.h" |
|
#include "engine.h" |
|
|
|
namespace devilution { |
|
|
|
enum GameFontTables : uint8_t { |
|
GameFontSmall, |
|
GameFontMed, |
|
GameFontBig, |
|
}; |
|
|
|
enum text_color : uint8_t { |
|
COL_WHITE, |
|
COL_BLUE, |
|
COL_RED, |
|
COL_GOLD, |
|
COL_BLACK, |
|
}; |
|
|
|
extern const uint8_t gbFontTransTbl[256]; |
|
extern const uint8_t fontframe[3][128]; |
|
extern const uint8_t fontkern[3][68]; |
|
|
|
extern std::optional<CelSprite> pPanelText; |
|
extern std::optional<CelSprite> pMedTextCels; |
|
extern std::optional<CelSprite> BigTGold_cel; |
|
|
|
extern std::optional<CelSprite> pSPentSpn2Cels; |
|
|
|
void InitText(); |
|
void FreeText(); |
|
|
|
/** |
|
* @brief Print letter to the given buffer |
|
* @param out The buffer to print to |
|
* @param sx Backbuffer offset |
|
* @param sy Backbuffer offset |
|
* @param nCel Number of letter in Windows-1252 |
|
* @param col text_color color value |
|
*/ |
|
void PrintChar(const CelOutputBuffer &out, int sx, int sy, int nCel, text_color col); |
|
int GetLineWidth(const char *text, GameFontTables size = GameFontSmall); |
|
void WordWrapGameString(char *text, size_t width, size_t size = GameFontSmall); |
|
void DrawString(const CelOutputBuffer &out, const char *text, const SDL_Rect &rect, uint16_t flags = 0, bool drawTextCursor = false); |
|
int PentSpn2Spin(); |
|
|
|
} // namespace devilution
|
|
|