Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class State final
- {
- public:
- // Add further new types here
- enum class Type
- {
- Intro,
- Menu,
- Loading
- // Etc
- };
- State(Type type) : type(type) {}
- void update() {
- switch (type)
- {
- // insert your giant switch here
- }
- }
- private:
- // Add further dispatch functions here for every type
- void dispatchIntro() {}
- void dispatchMenu() {}
- void dispatchLoading() {}
- private:
- Type type;
- };
Advertisement
Add Comment
Please, Sign In to add comment