OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
screen.h File Reference

The screen layer: what every screen outside the round needs. More...

#include <snes.h>

Go to the source code of this file.

Macros

#define SCREEN_LOAD_CHUNK   2048
 Largest piece screenLoad() queues in one entry.
#define SCREEN_VBLANK_BUDGET   3072
 VBlank budget, in bytes of vramQueueCost(), that screenLoad() keeps to.

Functions

void screenClose (void)
 Non-blocking fade-out, display off, then the close hook.
void screenFadeSkip (u16 on)
 1: skip the fades; 0: play them for real.
void screenFrame (void)
 One image of a lit screen: VBlank, queue flush, pump, pads.
void screenLoad (const u8 *src, u16 addr, u16 size, u16 step)
 Upload a block to VRAM through the queue, in pieces that keep to SCREEN_VBLANK_BUDGET.
u16 screenPressed (u16 keys, u16 both)
 Keys newly pressed this image, among keys; both also reads pad 2.
void screenSetClose (void(*fn)(void))
 Hook run by screenClose(): undoes what the screen set up. One shot.
void screenSetPump (void(*fn)(void))
 Function run on EVERY image: fades, waits, loads and frames. No state is passed.
void screenShow (void)
 Display on, non-blocking fade-in; a key already held does not count.
u16 screenWait (u16 frames)
 Wait frames images or START; 1 if START cut it short.

Variables

u16 screen_fade_frames
 Images the last fade took (16 at speed 1), for the tests.
u16 screen_fade_skip
 1: the fades are skipped (long tests). 0 by default. A test may poke it.

Detailed Description

The screen layer: what every screen outside the round needs.

A screen is one function xxxRun(): compose with the display off, screenShow(), loop on screenFrame() + screenPressed(), screenClose(). The layer owns what they share, so no screen repeats it: the VBlank wait, the VRAM queue's flush, the fades, the pad's edges, and the pump, the one function the game wants run on every image whatever the screen is doing (its sound driver, its counters).

Macro Definition Documentation

◆ SCREEN_LOAD_CHUNK

#define SCREEN_LOAD_CHUNK   2048

Largest piece screenLoad() queues in one entry.

◆ SCREEN_VBLANK_BUDGET

#define SCREEN_VBLANK_BUDGET   3072

VBlank budget, in bytes of vramQueueCost(), that screenLoad() keeps to.

Function Documentation

◆ screenClose()

void screenClose ( void )

Non-blocking fade-out, display off, then the close hook.

◆ screenFadeSkip()

void screenFadeSkip ( u16 on)

1: skip the fades; 0: play them for real.

◆ screenFrame()

void screenFrame ( void )

One image of a lit screen: VBlank, queue flush, pump, pads.

◆ screenLoad()

void screenLoad ( const u8 * src,
u16 addr,
u16 size,
u16 step )

Upload a block to VRAM through the queue, in pieces that keep to SCREEN_VBLANK_BUDGET.

◆ screenPressed()

u16 screenPressed ( u16 keys,
u16 both )

Keys newly pressed this image, among keys; both also reads pad 2.

◆ screenSetClose()

void screenSetClose ( void(* fn )(void))

Hook run by screenClose(): undoes what the screen set up. One shot.

◆ screenSetPump()

void screenSetPump ( void(* fn )(void))

Function run on EVERY image: fades, waits, loads and frames. No state is passed.

◆ screenShow()

void screenShow ( void )

Display on, non-blocking fade-in; a key already held does not count.

◆ screenWait()

u16 screenWait ( u16 frames)

Wait frames images or START; 1 if START cut it short.

Variable Documentation

◆ screen_fade_frames

u16 screen_fade_frames
extern

Images the last fade took (16 at speed 1), for the tests.

◆ screen_fade_skip

u16 screen_fade_skip
extern

1: the fades are skipped (long tests). 0 by default. A test may poke it.