Game
⚠️
This page is under construction.
Game is the main class that represents the game itself. It contains all the game's configuration and LiveGames
Public Properties
preference
the Preference instance
Preference<GamePreference>
- See GamePreference
game.preference.setPreference("autoForward", true);
Public Methods
constructor
config: DeepPartial<GameConfig>
- The game's configuration, see GameConfig
useComponent<T extends keyof ComponentsTypes>
For ComponentsTypes, see ComponentsTypes
key: T
- The key of the component to usecomponents: ComponentsTypes[T]
- The component configuration, see ComponentsTypes
getLiveGame
return: LiveGame
- the LiveGame instance
configure
Assign a new configuration to the game
const { game } = useGame();
useEffect(() => {
game.configure({
app: {
debug: true,
logger: true,
},
player: {
ratioUpdateInterval: 0, // update the player size immediately
/* cursor */
cursor: "cursor.jpeg",
cursorHeight: 60,
cursorWidth: 60,
}
});
}, []);