-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtext.h
79 lines (70 loc) · 1.93 KB
/
text.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef TEXT_INCLUDED
#define TEXT_INCLUDED
#include "core.h"
#include <libdragon.h>
typedef enum {
TextEmpty,
TextNoTpak,
TextNoCartridge,
TextLoadCartridge,
TextLoadingCartridge,
TextExpansionPakRequired,
TextRetryCartridgePrompt,
TextChecksumFailed,
TextUnsupportedCartridge,
TextMenuResume,
TextMenuReset,
TextMenuChangeCart,
TextMenuOptions,
TextMenuAddPlayer,
TextMenuAddGame,
TextSplash,
TextAudioOn,
TextAudioOff,
TextEnd
} TextId;
/**
* Gets the text string with the given id code, and loads it into output.
* @param textId The text id code.
* @out output the destination string.
*/
void getText(TextId textId, string output);
/**
* Initialises text subsystem by loading sprites etc.
*/
sByte initText();
/**
* Frees resources used by the text subsystem when done.
*/
void freeText();
/**
* Draws a horizontal string of text starting at the given location.
* @param frame The id of the frame to draw on.
* @param x The x co-ordinate to start the string at.
* @param y The y co-ordinate to start the string at.
* @param scale size of the text sprites.
*/
void drawText(const display_context_t frame, const string text, const natural x, const natural y, const float scale);
/**
* Draws a horizontal string of text starting at the given location.
* @param frame The id of the frame to draw on.
* @param x The x co-ordinate to start the string at.
* @param y The y co-ordinate to start the string at.
* @param scale size of the text sprites.
* @param width width of the area available for text.
*/
void drawTextParagraph(
const display_context_t frame,
const string text,
const natural x,
const natural y,
const float scale,
const natural width
);
/**
* Calculates the length in pixels of a given string, including any sprites.
* @param text the string.
* @return the length in pixels.
*/
natural getStringWidth(const string text);
#endif