mgba/include/mgba-util/gui/font.h

92 lines
2.2 KiB
C
Raw Normal View History

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
#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*);
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,
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;
};
struct GUIIconMetric {
int x;
int y;
int width;
int height;
};
2015-08-27 03:11:51 +00:00
unsigned GUIFontHeight(const struct GUIFont*);
unsigned GUIFontGlyphWidth(const struct GUIFont*, uint32_t glyph);
unsigned GUIFontSpanWidth(const struct GUIFont*, const char* text);
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
ATTRIBUTE_FORMAT(printf, 6, 7)
void GUIFontPrintf(const struct GUIFont*, int x, int y, enum GUIAlignment, uint32_t color, const char* text, ...);
void GUIFontPrint(const struct GUIFont*, int x, int y, enum GUIAlignment, uint32_t color, const char* text);
void GUIFontDrawGlyph(const struct GUIFont*, int x, int y, uint32_t color, uint32_t glyph);
void GUIFontDrawIcon(const struct GUIFont*, int x, int y, enum GUIAlignment, enum GUIOrientation, uint32_t color, enum GUIIcon);
2016-01-30 22:02:35 +00:00
void GUIFontDrawIconSize(const 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
2016-12-27 05:01:55 +00:00
CXX_GUARD_END
2015-08-23 06:20:21 +00:00
#endif