slanted-gamedev-toolz
Version:
A slanted mix of tools for your brilliant ideas in game design.
12 lines (11 loc) • 458 B
JavaScript
import { create } from "zustand";
// Create the store using the types
export const useGlobalStore = create((set) => ({
runLevel: 1,
actions: {
setRunLevel: (n) => set({ runLevel: n }),
increaseRunLevel: () => set((state) => ({ runLevel: state.runLevel + 1 })),
},
}));
export const useGlobalStoreActions = () => useGlobalStore((state) => state.actions);
export const useRunLevel = () => useGlobalStore((state) => state.runLevel);