PVSnesLib  4.6.0
Documentation to code in C or ASM for the Nintendo SNES
Loading...
Searching...
No Matches
systems/textvwfont/src/textvwfont.c
/*---------------------------------------------------------------------------------
Simple console 'hello world' demo with variable width font
-- alekmaul
---------------------------------------------------------------------------------*/
#include <snes.h>
#include "../pvsneslibfont.inc"
//---------------------------------------------------------------------------------
int main(void)
{
// Initialize text console with our font
//vwf_set_chr_base(0x2000); // consoleSetTextGfxPtr(0x3000);
//consoleSetTextOffset(0x0100);
consoleInitvwText(&vwfpvsneslibfontWidth, &pvsneslibfont_til);
// Init background
bgSetGfxPtr(2, 0x2000);
bgSetMapPtr(2, 0x6800, SC_32x32);
setPalette(&pvsneslibfont_pal, 0*16, 16*2);
// Now Put in 16 color mode and disable Bgs except current
setMode(BG_MODE1, 0);
// Assign vram address for line 0
consoleSetvwTextLineAddr(0, 0x2100); // tileVRAM after graphics for BG
consoleSetvwTextLineAddr(1, 0x2200);
// Draw a wonderful text :P
consoleSetvwTextClearLine(0);consoleSetvwTextClearLine(1);
consoleDrawvwText(0, 12, 1, "Hello World!");
consoleDrawvwText(1, 28, 2, "Welcome to PVSnesLib:)");
// Wait for nothing :P
while (1)
{
}
return 0;
}
void bgSetGfxPtr(u8 bgNumber, u16 address)
Definition of each background address.
void bgSetDisable(u8 bgNumber)
Disable a BG in the actual SNES mode.
void bgSetMapPtr(u8 bgNumber, u16 address, u8 mapSize)
Change Background Map address.
void bgSetEnable(u8 bgNumber)
Enable a BG in the actual SNES mode.
void WaitForVBlank(void)
Waits for a VBlank interrupt.
the master include file for snes applications.
void consolevwTextUpdate(void)
DMA all dirty line buffers to VRAM.
void consoleSetTextMapPtr(u16 offsetfont)
Change text Background map address for display (must be BG address)
void setScreenOn(void)
Put screen On.
#define setPalette(palette, paletteEntry, paletteSize)
Change a palette in CGRAM.
Definition video.h:393
void setMode(u8 mode, u8 size)
Set the SNES hardware to operate in new display mode.