summaryrefslogtreecommitdiff
path: root/include/Font.h
diff options
context:
space:
mode:
authorXavi Del Campo <xavi.dcr@tutanota.com>2020-03-03 18:39:09 +0100
committerXavi Del Campo <xavi.dcr@tutanota.com>2020-03-03 19:40:00 +0100
commit792e22676786a577b2edc0ed0ed78e51c5b38245 (patch)
tree3a5b1092af322003be3189bf6d58f362dcfe1dca /include/Font.h
parent62adc2edd17cbd39272715d29d1b4c8650ef7dde (diff)
downloadopensend-792e22676786a577b2edc0ed0ed78e51c5b38245.tar.gz
Refactoring
Diffstat (limited to 'include/Font.h')
-rw-r--r--include/Font.h78
1 files changed, 47 insertions, 31 deletions
diff --git a/include/Font.h b/include/Font.h
index 5a7d6b5..97a52ac 100644
--- a/include/Font.h
+++ b/include/Font.h
@@ -1,44 +1,60 @@
-#ifndef __FONT_HEADER__
-#define __FONT_HEADER__
+#ifndef FONT_H
+#define FONT_H
/* *************************************
* Includes
* *************************************/
-#include "Global_Inc.h"
-#include "System.h"
-#include "Gfx.h"
-#include "GameStructures.h"
#include <stdarg.h>
-
-/* *************************************
- * Defines
- * *************************************/
-
-#define FONT_DEFAULT_CHAR_SIZE 16
-#define FONT_DEFAULT_INIT_CHAR '!'
-
-/* **************************************
- * Structs and enums *
- * *************************************/
-
-/* *************************************
- * Global prototypes
- * *************************************/
-
-bool FontLoadImage(char* strPath, TYPE_FONT * ptrFont);
-void FontSetSize(TYPE_FONT * ptrFont, short size, short bitshift);
-void FontPrintText(TYPE_FONT *ptrFont, short x, short y, char* str, ...);
-void FontSetInitChar(TYPE_FONT * ptrFont, char c);
-void FontSetFlags(TYPE_FONT * ptrFont, FONT_FLAGS flags);
+#include <stdbool.h>
+
+enum
+{
+ FONT_DEFAULT_CHAR_SIZE = 16,
+ FONT_DEFAULT_INIT_CHAR = '!'
+};
+
+enum t_fontflags
+{
+ FONT_NOFLAGS,
+ FONT_CENTERED = 0x01,
+ FONT_WRAP_LINE = 0x02,
+ FONT_BLEND_EFFECT = 0x04,
+ FONT_1HZ_FLASH = 0x08,
+ FONT_2HZ_FLASH = 0x10,
+ FONT_H_CENTERED = 0x20
+};
+
+struct font
+{
+ GsSprite spr;
+ short char_spacing;
+ short char_w;
+ short char_w_bitshift;
+ short char_h;
+ char init_ch;
+ uint8_t char_per_row;
+ uint8_t max_ch_wrap;
+ enum font_flags flags;
+ short spr_w;
+ short spr_h;
+ short spr_u;
+ short spr_v;
+};
+
+bool FontLoadImage(const char *path, struct font *font);
+void FontSetSize(struct font *font, short size, short bitshift);
+void FontPrintText(struct font *font, short x, short y, char* str, ...);
+void FontSetInitChar(struct font *font, char c);
+void FontSetFlags(struct font *font, enum font_flags flags);
void FontCyclic(void);
-void FontSetSpacing(TYPE_FONT* ptrFont, short spacing);
+void FontSetSpacing(struct font *font, short spacing);
/* *************************************
* Global variables
* *************************************/
-TYPE_FONT RadioFont;
-TYPE_FONT SmallFont;
+extern struct font RadioFont;
+extern struct font SmallFont;
-#endif //__FONT_HEADER__
+#endif /* FONT_H */