2015-08-23 06:20:21 +00:00
|
|
|
/* Copyright (c) 2013-2015 Jeffrey Pfau
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef GUI_FONT_H
|
|
|
|
#define GUI_FONT_H
|
|
|
|
|
2016-12-31 01:00:22 +00:00
|
|
|
#include <mgba-util/common.h>
|
2015-08-23 06:20:21 +00:00
|
|
|
|
2016-12-27 05:01:55 +00:00
|
|
|
CXX_GUARD_START
|
|
|
|
|
2015-08-23 06:20:21 +00:00
|
|
|
struct GUIFont;
|
|
|
|
struct GUIFont* GUIFontCreate(void);
|
|
|
|
void GUIFontDestroy(struct GUIFont*);
|
|
|
|
|
2016-01-09 08:54:18 +00:00
|
|
|
enum GUIAlignment {
|
|
|
|
GUI_ALIGN_LEFT = 1,
|
|
|
|
GUI_ALIGN_HCENTER = 3,
|
|
|
|
GUI_ALIGN_RIGHT = 2,
|
|
|
|
|
|
|
|
GUI_ALIGN_TOP = 4,
|
|
|
|
GUI_ALIGN_VCENTER = 12,
|
|
|
|
GUI_ALIGN_BOTTOM = 8,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum GUIOrientation {
|
|
|
|
GUI_ORIENT_0,
|
|
|
|
GUI_ORIENT_90_CCW,
|
|
|
|
GUI_ORIENT_180,
|
|
|
|
GUI_ORIENT_270_CCW,
|
|
|
|
|
|
|
|
GUI_ORIENT_VMIRROR,
|
|
|
|
GUI_ORIENT_HMIRROR,
|
|
|
|
|
|
|
|
GUI_ORIENT_90_CW = GUI_ORIENT_270_CCW,
|
|
|
|
GUI_ORIENT_270_CW = GUI_ORIENT_90_CCW
|
|
|
|
};
|
|
|
|
|
|
|
|
enum GUIIcon {
|
|
|
|
GUI_ICON_BATTERY_FULL,
|
|
|
|
GUI_ICON_BATTERY_HIGH,
|
|
|
|
GUI_ICON_BATTERY_HALF,
|
|
|
|
GUI_ICON_BATTERY_LOW,
|
|
|
|
GUI_ICON_BATTERY_EMPTY,
|
|
|
|
GUI_ICON_SCROLLBAR_THUMB,
|
|
|
|
GUI_ICON_SCROLLBAR_TRACK,
|
|
|
|
GUI_ICON_SCROLLBAR_BUTTON,
|
|
|
|
GUI_ICON_CURSOR,
|
|
|
|
GUI_ICON_POINTER,
|
|
|
|
GUI_ICON_BUTTON_CIRCLE,
|
|
|
|
GUI_ICON_BUTTON_CROSS,
|
|
|
|
GUI_ICON_BUTTON_TRIANGLE,
|
|
|
|
GUI_ICON_BUTTON_SQUARE,
|
|
|
|
GUI_ICON_BUTTON_HOME,
|
2020-08-18 03:17:39 +00:00
|
|
|
GUI_ICON_STATUS_FAST_FORWARD,
|
|
|
|
GUI_ICON_STATUS_MUTE,
|
2021-05-02 23:37:00 +00:00
|
|
|
GUI_ICON_LEFT,
|
|
|
|
GUI_ICON_UP,
|
|
|
|
GUI_ICON_RIGHT,
|
|
|
|
GUI_ICON_DOWN,
|
2021-09-06 23:54:40 +00:00
|
|
|
GUI_ICON_9SLICE_EMPTY_NW,
|
|
|
|
GUI_ICON_9SLICE_EMPTY_N,
|
|
|
|
GUI_ICON_9SLICE_EMPTY_NE,
|
|
|
|
GUI_ICON_9SLICE_EMPTY_W,
|
|
|
|
GUI_ICON_9SLICE_EMPTY_E,
|
|
|
|
GUI_ICON_9SLICE_EMPTY_SW,
|
|
|
|
GUI_ICON_9SLICE_EMPTY_S,
|
|
|
|
GUI_ICON_9SLICE_EMPTY_SE,
|
|
|
|
GUI_ICON_9SLICE_FILLED_NW,
|
|
|
|
GUI_ICON_9SLICE_FILLED_N,
|
|
|
|
GUI_ICON_9SLICE_FILLED_NE,
|
|
|
|
GUI_ICON_9SLICE_FILLED_W,
|
|
|
|
GUI_ICON_9SLICE_FILLED_C,
|
|
|
|
GUI_ICON_9SLICE_FILLED_E,
|
|
|
|
GUI_ICON_9SLICE_FILLED_SW,
|
|
|
|
GUI_ICON_9SLICE_FILLED_S,
|
|
|
|
GUI_ICON_9SLICE_FILLED_SE,
|
|
|
|
GUI_ICON_9SLICE_CAP_NNW,
|
|
|
|
GUI_ICON_9SLICE_CAP_NWW,
|
|
|
|
GUI_ICON_9SLICE_CAP_NNE,
|
|
|
|
GUI_ICON_9SLICE_CAP_NEE,
|
|
|
|
GUI_ICON_9SLICE_CAP_SSW,
|
|
|
|
GUI_ICON_9SLICE_CAP_SWW,
|
|
|
|
GUI_ICON_9SLICE_CAP_SSE,
|
|
|
|
GUI_ICON_9SLICE_CAP_SEE,
|
2021-09-09 21:28:15 +00:00
|
|
|
GUI_ICON_9SLICE_FILL_ONLY_NW,
|
|
|
|
GUI_ICON_9SLICE_FILL_ONLY_N,
|
|
|
|
GUI_ICON_9SLICE_FILL_ONLY_NE,
|
|
|
|
GUI_ICON_9SLICE_FILL_ONLY_W,
|
|
|
|
GUI_ICON_9SLICE_FILL_ONLY_C,
|
|
|
|
GUI_ICON_9SLICE_FILL_ONLY_E,
|
|
|
|
GUI_ICON_9SLICE_FILL_ONLY_SW,
|
|
|
|
GUI_ICON_9SLICE_FILL_ONLY_S,
|
|
|
|
GUI_ICON_9SLICE_FILL_ONLY_SE,
|
|
|
|
GUI_ICON_BACKSPACE,
|
|
|
|
GUI_ICON_KBD_SHIFT,
|
|
|
|
GUI_ICON_CAPSLOCK,
|
2022-01-06 06:10:01 +00:00
|
|
|
GUI_ICON_TEXT_CURSOR,
|
2016-01-09 08:54:18 +00:00
|
|
|
GUI_ICON_MAX,
|
2015-08-23 06:20:21 +00:00
|
|
|
};
|
|
|
|
|
2015-08-23 07:57:22 +00:00
|
|
|
struct GUIFontGlyphMetric {
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
struct {
|
|
|
|
int top;
|
|
|
|
int right;
|
|
|
|
int bottom;
|
|
|
|
int left;
|
|
|
|
} padding;
|
|
|
|
};
|
|
|
|
|
2016-01-09 08:54:18 +00:00
|
|
|
struct GUIIconMetric {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
};
|
|
|
|
|
2021-09-06 23:54:40 +00:00
|
|
|
enum GUI9SliceStyle {
|
|
|
|
GUI_9SLICE_FILLED,
|
|
|
|
GUI_9SLICE_EMPTY,
|
|
|
|
GUI_9SLICE_EMPTY_CAPPED,
|
2021-09-09 21:28:15 +00:00
|
|
|
GUI_9SLICE_FILL_ONLY,
|
2021-09-06 23:54:40 +00:00
|
|
|
};
|
|
|
|
|
2015-08-27 03:11:51 +00:00
|
|
|
unsigned GUIFontHeight(const struct GUIFont*);
|
2015-08-27 04:41:49 +00:00
|
|
|
unsigned GUIFontGlyphWidth(const struct GUIFont*, uint32_t glyph);
|
|
|
|
unsigned GUIFontSpanWidth(const struct GUIFont*, const char* text);
|
2022-01-06 06:10:01 +00:00
|
|
|
unsigned GUIFontSpanCountWidth(const struct GUIFont*, const char* text, size_t len);
|
2016-02-01 04:09:50 +00:00
|
|
|
void GUIFontIconMetrics(const struct GUIFont*, enum GUIIcon icon, unsigned* w, unsigned* h);
|
2015-08-23 06:20:21 +00:00
|
|
|
|
2015-08-31 05:20:46 +00:00
|
|
|
ATTRIBUTE_FORMAT(printf, 6, 7)
|
2021-03-28 04:46:20 +00:00
|
|
|
void GUIFontPrintf(struct GUIFont*, int x, int y, enum GUIAlignment, uint32_t color, const char* text, ...);
|
|
|
|
void GUIFontPrint(struct GUIFont*, int x, int y, enum GUIAlignment, uint32_t color, const char* text);
|
|
|
|
void GUIFontDrawGlyph(struct GUIFont*, int x, int y, uint32_t color, uint32_t glyph);
|
|
|
|
void GUIFontDrawIcon(struct GUIFont*, int x, int y, enum GUIAlignment, enum GUIOrientation, uint32_t color, enum GUIIcon);
|
|
|
|
void GUIFontDrawIconSize(struct GUIFont* font, int x, int y, int w, int h, uint32_t color, enum GUIIcon icon);
|
2015-08-23 06:20:21 +00:00
|
|
|
|
2021-03-25 02:10:56 +00:00
|
|
|
#ifdef __SWITCH__
|
|
|
|
void GUIFontDrawSubmit(struct GUIFont* font);
|
|
|
|
#endif
|
|
|
|
|
2021-09-06 23:54:40 +00:00
|
|
|
void GUIFontDraw9Slice(struct GUIFont*, int x, int y, int width, int height, uint32_t color, enum GUI9SliceStyle style);
|
|
|
|
|
2016-12-27 05:01:55 +00:00
|
|
|
CXX_GUARD_END
|
|
|
|
|
2015-08-23 06:20:21 +00:00
|
|
|
#endif
|