PVSnesLib  4.6.0
Documentation to code in C or ASM for the Nintendo SNES
Loading...
Searching...
No Matches
gamestates.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------------------
2
3 states.h -- definitions for SNES game states engine
4
5 Copyright (C) 2025-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
21 2. Altered source versions must be plainly marked as such, and
22 must not be misrepresented as being the original software.
23
24 3. This notice may not be removed or altered from any source
25 distribution.
26
27---------------------------------------------------------------------------------*/
33#ifndef SNES_GSTATES_INCLUDE
34#define SNES_GSTATES_INCLUDE
35
36#include <snes/snestypes.h>
37
38#define GSTA_MAX 16
48void gstaInitFunctions(u8 staidx, void *initfct, void *updfct);
49
54void gstaSetState(u8 staidx);
55
59void gstaProcess(void);
60
61#define GSTATESINIT
62#define GSTATE_DEF_END
63
70#define DECLARE_GSTATE(GSTATE_ID) extern void gstaini_##GSTATE_ID(void); extern void gstaupd_##GSTATE_ID(void)
71
76#define _GSTATEINIT(GSTATE_ID) gstaInitFunctions(GSTATE_ID, gstaini_##GSTATE_ID, gstaupd_##GSTATE_ID);
77
82#define _GSTATEDEF(GSTATE_ID) GSTATE_ID,
83
112#define gstaInitEngine() GSTATESINIT
113
114
115#endif // SNES_GSTATES_INCLUDE
void gstaProcess(void)
call game state engine for all states (gstaSetState must be called before)
void gstaSetState(u8 staidx)
Change the current game state to a new one.
void gstaInitFunctions(u8 staidx, void *initfct, void *updfct)
Initialize the game state type functions (initialize, update) of a specific state (intro,...
Custom types used by libsnes.