OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
text.h
Go to the documentation of this file.
1
10
11#ifndef OPENSNES_TEXT_H
12#define OPENSNES_TEXT_H
13
14#include <snes/types.h>
15
26
33
42#define TEXT_DEFAULT_TILEMAP_ADDR 0x3800
44#define TEXT_DEFAULT_FONT_TILE 0
46#define TEXT_DEFAULT_PALETTE 0
54#define TEXT_MAP_ROWS 32
55
74void textInit(u16 tilemap_addr, u16 font_tile, u8 palette);
75
84void textLoadFont(u16 vram_addr);
85
97void textLoadFont4bpp(u16 vram_addr);
98
107extern u8 cursor_x;
108extern u8 cursor_y;
109inline void textSetPos(u8 x, u8 y) {
110 cursor_x = x & 31;
111 cursor_y = y & (TEXT_MAP_ROWS - 1);
112}
113
119
125
133void textPutChar(char c);
134
140void textPrint(const char *str);
141
149void textPrintAt(u8 x, u8 y, const char *str);
150
156void textPrintU16(u16 value);
157
164void textPrintHex(u16 value, u8 digits);
165
169void textClear(void);
170
179void textClearRect(u8 x, u8 y, u8 w, u8 h);
180
195void textFlush(void);
196
219void textModeInit(void);
220
221#endif /* OPENSNES_TEXT_H */
u8 palette[]
static u16 c
Definition main.c:157
unsigned short u16
16-bit unsigned integer (0 to 65535)
Definition types.h:53
unsigned char u8
8-bit unsigned integer (0 to 255)
Definition types.h:47
Text rendering configuration.
Definition text.h:19
u8 map_width
Definition text.h:24
u16 font_tile
Definition text.h:21
u8 priority
Definition text.h:23
u16 tilemap_addr
Definition text.h:20
u8 palette
Definition text.h:22
u8 cursor_y
void textLoadFont(u16 vram_addr)
Load font tiles to VRAM.
void textLoadFont4bpp(u16 vram_addr)
Load font as 4bpp tiles for Mode 1 BGs.
u8 cursor_x
Set cursor position.
void textModeInit(void)
Initialize text display mode — one-call setup for text-based examples.
void textClear(void)
Clear entire tilemap with spaces.
TextConfig text_config
Default text configuration.
void textPrintAt(u8 x, u8 y, const char *str)
Print a string at specific position.
void textClearRect(u8 x, u8 y, u8 w, u8 h)
Clear a rectangular region (fills with spaces).
void textInit(u16 tilemap_addr, u16 font_tile, u8 palette)
Initialize the text rendering system.
void textFlush(void)
Request tilemap DMA transfer to VRAM (rarely needed).
void textPrintU16(u16 value)
Print an unsigned integer.
void textSetPos(u8 x, u8 y)
Definition text.h:109
void textPutChar(char c)
Print a single character at cursor position.
void textPrintHex(u16 value, u8 digits)
Print an unsigned integer in hexadecimal.
void textPrint(const char *str)
Print a string at cursor position.
#define TEXT_MAP_ROWS
Tilemap buffer height in rows.
Definition text.h:54
u8 textGetX(void)
Get current cursor X position.
u8 textGetY(void)
Get current cursor Y position.
OpenSNES Standard Types.