Some small helpers to draw strings and sprites dealing with left-to-right/right-to-left.

This commit is contained in:
Juanjo
2012-12-31 11:25:18 +01:00
committed by pelya
parent 9fa95981fc
commit b792189e59
2 changed files with 112 additions and 0 deletions

View File

@@ -171,6 +171,17 @@ int GetCharacterHeight(FontSize size);
/** Height of characters in the large (#FS_MONO) font. */
#define FONT_HEIGHT_MONO (GetCharacterHeight(FS_MONO))
int InitTempMargin(int left, int right, bool to_end_line);
void AddSpace(int space, int &here, bool to_end_line);
void UpdateMarginEnd(int end, int &margin, bool to_end_line);
void UpdateMarginWidth(int adding, int &margin, bool to_end_line);
void UpdateMarginsEnd(int end, int &left, int &right, bool to_end_line);
void UpdateMarginsWidth(int width, int &left, int &right, bool to_end_line);
void DrawString2(int left, int right, int top, int &margin, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false);
void DrawSprite2(int width, int left, int right, int top, int &margin, SpriteID img, PaletteID pal, bool to_end_line = false, SubSprite *sub = NULL);
extern DrawPixelInfo *_cur_dpi;
TextColour GetContrastColour(uint8 background);