Cafu Engine
ClientState.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_CLIENT_STATE_HPP_INCLUDED
8 #define CAFU_CLIENT_STATE_HPP_INCLUDED
9 
10 
11 struct CaKeyboardEventT;
12 struct CaMouseEventT;
13 
14 
15 /// This is the base class for the concrete classes that implement the states of the client.
16 /// It is part of the State pattern (see the GoF book) that we employ to manage the states of the client:
17 /// "It defines the interface for encapsulating the behaviour that is associated with a certain state of the client."
19 {
20  public:
21 
22  /// The virtual destructor.
23  virtual ~ClientStateT() { }
24 
25  /// Returns some client-specific, unique ID for this state.
26  virtual int GetID() const=0;
27 
28  // These are the methods that implement the state-specific behaviour.
29  // The client will forward all calls to its own methods to these methods of the current state.
30  virtual bool ProcessInputEvent(const CaKeyboardEventT& KE)=0;
31  virtual bool ProcessInputEvent(const CaMouseEventT& ME)=0;
32  virtual void Render(float FrameTime)=0;
33  virtual void MainLoop(float FrameTime)=0;
34 };
35 
36 #endif
This struct describes a mouse event.
Definition: OpenGLWindow.hpp:185
virtual ~ClientStateT()
The virtual destructor.
Definition: ClientState.hpp:23
This struct describes a keyboard event.
Definition: OpenGLWindow.hpp:20
virtual int GetID() const =0
Returns some client-specific, unique ID for this state.
This is the base class for the concrete classes that implement the states of the client.
Definition: ClientState.hpp:18