PVSnesLib  4.6.0
Documentation to code in C or ASM for the Nintendo SNES
Loading...
Searching...
No Matches
textfont.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------------------
2
3 Text and Variable width font text management
4
5 Copyright (C) 2026
6 Alekmaul
7
8 This software is provided 'as-is', without any express or implied
9 warranty. In no event will the authors be held liable for any
10 damages arising from the use of this software.
11
12 Permission is granted to anyone to use this software for any
13 purpose, including commercial applications, and to alter it and
14 redistribute it freely, subject to the following restrictions:
15
16 1. The origin of this software must not be misrepresented; you
17 must not claim that you wrote the original software. If you use
18 this software in a product, an acknowledgment in the product
19 documentation would be appreciated but is not required.
20 2. Altered source versions must be plainly marked as such, and
21 must not be misrepresented as being the original software.
22 3. This notice may not be removed or altered from any source
23 distribution.
24
25 VWF inspired by untoxa's GB VWF engine
26
27---------------------------------------------------------------------------------*/
28
33#ifndef SNES_VWF_INCLUDE
34#define SNES_VWF_INCLUDE
35
36#include <snes/snestypes.h>
37
38extern u8 scr_txt_font_map[0x800];
39extern u8 scr_txt_dirty;
50void consoleInitvwText(u8* fnttileadr, u8 *fntwidthadr);
51
57void consoleSetvwTextLineAddr(u8 lineidx, u16 tilevram);
58
63void consoleSetvwTextClearLine(u8 lineidx);
64
75void consoleDrawvwText(u8 lineidx, u16 xcol, u8 ycol, char *text);
76
83
96void consoleSetvwTextMapAttr(u8 mapAttr);
97
105void consoleSetvwTextBlkTile(u16 tileEntry);
106
110void consoleUpdate(void);
111
122void consoleInitText(u8 palnum, u8 palsize, u8 *tilfont, u8 *palfont);
123
void consoleInitDefaultText(u8 palnum);
131
136void consoleSetTextGfxPtr(u16 vramfont);
137
142void consoleSetTextMapPtr(u16 offsetfont);
143
148void consoleSetTextOffset(u16 offsetfont);
149
156void consoleSetTextPal(u8 palnum, u8 *palfont, u8 palsize);
157
166void consoleDrawText(u16 x, u16 y, char *fmt, ...);
167
178void consoleDrawTextMap(u16 x, u16 y, u8 *map, u8 attributes, char *fmt, ...);
179
190void consoleDrawTextMapCenter(u16 y, u16 *map, u8 attributes, char *fmt, ...);
191
192#endif // SNES_VWF_INCLUDE
Custom types used by libsnes.
void consoleDrawTextMapCenter(u16 y, u16 *map, u8 attributes, char *fmt,...)
Output formatted string on a screen, centered it (2 colors tiles mode)
void consoleInitText(u8 palnum, u8 palsize, u8 *tilfont, u8 *palfont)
Initialize the Text System.
void consoleInitDefaultText(u8 palnum)
Initialize the Text System with the font shipped in PVSNesLib.
u8 scr_txt_dirty
flag to redraw text during vblank
void consoleDrawText(u16 x, u16 y, char *fmt,...)
Output formatted string on a screen (tiles mode)
void consoleSetTextPal(u8 palnum, u8 *palfont, u8 palsize)
Change text font palette.
void consoleSetvwTextBlkTile(u16 tileEntry)
Sets the blank tile entry to reset a line.
void consoleUpdate(void)
Update current text buffer on screen.
void consoleSetvwTextMapAttr(u8 mapAttr)
Sets the high byte attr into tilemap entry.
void consoleSetTextOffset(u16 offsetfont)
Change text Background map address for display (must be BG address)
void consoleSetTextGfxPtr(u16 vramfont)
Change text graphics address (4K aligned)
void consoleDrawTextMap(u16 x, u16 y, u8 *map, u8 attributes, char *fmt,...)
Output formatted string on a screen (2 colors tiles mode)
void consolevwTextUpdate(void)
DMA all dirty line buffers to VRAM.
u8 scr_txt_font_map[0x800]
tilemap used for text display
void consoleSetTextMapPtr(u16 offsetfont)
Change text Background map address for display (must be BG address)