The screen layer (see screen.h).
More...
#include <snes.h>
#include <snes/input.h>
#include <snes/vramqueue.h>
#include "screen.h"
|
| #define | FADE_SPEED 1 |
| | Frames between two brightness steps: 16 steps, so 16 images a fade.
|
|
| static void | fade (u8 direction) |
| | Run a fade a step per image. Never the blocking fadeIn()/fadeOut(): the pump must not freeze during a transition.
|
| static void | primePads (void) |
| | Take the pads as they are now as "already held": a key held over a screen change does not count.
|
| static void | pump (void) |
| | Run the pump. A rule of the layer: nothing waits without calling it.
|
| static void | readPads (void) |
| | Read both pads; the old words become the "before".
|
| 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.
|
|
| static void(* | close_fn )(void) |
| | The hook of the screen on display, or 0.
|
| static u16 | held0 |
| | Pad words of this image and of the one before (the edges come from the pair).
|
| static u16 | held1 |
| static u16 | prev0 |
| static u16 | prev1 |
| static void(* | pump_fn )(void) |
| | The function run on every image, or 0.
|
| 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.
|
The screen layer (see screen.h).
◆ FADE_SPEED
Frames between two brightness steps: 16 steps, so 16 images a fade.
◆ fade()
| void fade |
( |
u8 | direction | ) |
|
|
static |
Run a fade a step per image. Never the blocking fadeIn()/fadeOut(): the pump must not freeze during a transition.
◆ primePads()
Take the pads as they are now as "already held": a key held over a screen change does not count.
◆ pump()
Run the pump. A rule of the layer: nothing waits without calling it.
◆ readPads()
Read both pads; the old words become the "before".
◆ 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()
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()
Display on, non-blocking fade-in; a key already held does not count.
◆ screenWait()
Wait frames images or START; 1 if START cut it short.
◆ close_fn
| void(* close_fn) (void) |
( |
void | | ) |
|
|
static |
The hook of the screen on display, or 0.
◆ held0
Pad words of this image and of the one before (the edges come from the pair).
◆ held1
◆ prev0
◆ prev1
◆ pump_fn
| void(* pump_fn) (void) |
( |
void | | ) |
|
|
static |
The function run on every image, or 0.
◆ screen_fade_frames
Images the last fade took (16 at speed 1), for the tests.
◆ screen_fade_skip
1: the fades are skipped (long tests). 0 by default. A test may poke it.