Guest User

Untitled

a guest
Sep 3rd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. class State final
  2. {
  3. public:
  4.     // Add further new types here
  5.     enum class Type
  6.     {
  7.         Intro,
  8.         Menu,
  9.         Loading
  10.         // Etc
  11.     };
  12.  
  13.     State(Type type) : type(type) {}
  14.  
  15.     void update() {
  16.         switch (type)
  17.         {
  18.             // insert your giant switch here
  19.         }
  20.     }
  21.  
  22. private:
  23.     // Add further dispatch functions here for every type
  24.     void dispatchIntro() {}
  25.     void dispatchMenu() {}
  26.     void dispatchLoading() {}
  27.  
  28. private:
  29.     Type type;
  30. };
Advertisement
Add Comment
Please, Sign In to add comment