Cafu Engine
CompClient.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_GUISYS_COMPONENT_CLIENT_HPP_INCLUDED
8 #define CAFU_GUISYS_COMPONENT_CLIENT_HPP_INCLUDED
9 
10 #include "GuiSys/CompBase.hpp"
11 
12 
13 class ClientT;
14 
15 
16 /// This component connects the Cafu game client to the GUI window that houses it.
18 {
19  public:
20 
21  /// The constructor.
23 
24  /// The copy constructor.
25  /// @param Comp The component to create a copy of.
27 
28  void SetClient(ClientT* Cl);
29 
30  // Base class overrides.
31  ComponentClientT* Clone() const;
32  const char* GetName() const { return "Client"; }
33  void Render() const;
34  bool OnInputEvent(const CaKeyboardEventT& KE);
35  bool OnInputEvent(const CaMouseEventT& ME, float PosX, float PosY);
36  void OnClockTickEvent(float t);
37 
38  // The TypeSys related declarations for this class.
39  const cf::TypeSys::TypeInfoT* GetType() const { return &TypeInfo; }
40  static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params);
41  static const cf::TypeSys::TypeInfoT TypeInfo;
42 
43 
44  private:
45 
46  // The Lua API methods of this class.
47  static const luaL_Reg MethodsList[]; ///< The list of Lua methods for this class.
48  static int toString(lua_State* LuaState); ///< Returns a string representation of this object.
49 
50  ClientT* m_Client;
51  float m_LastFrameTime;
52 };
53 
54 #endif
ComponentClientT * Clone() const
The virtual copy constructor.
Definition: CompClient.cpp:58
const char * GetName() const
Returns the name of this component.
Definition: CompClient.hpp:32
This struct describes a mouse event.
Definition: OpenGLWindow.hpp:185
This is the base class for the components that a window is composed/aggregated of.
Definition: CompBase.hpp:51
This component connects the Cafu game client to the GUI window that houses it.
Definition: CompClient.hpp:17
ComponentClientT()
The constructor.
Definition: CompClient.cpp:36
This struct describes a keyboard event.
Definition: OpenGLWindow.hpp:20
void Render() const
This method implements the graphical output of this component.
Definition: CompClient.cpp:64
Definition: Client.hpp:24
bool OnInputEvent(const CaKeyboardEventT &KE)
This method handles keyboard input events.
Definition: CompClient.cpp:71
Definition: TypeSys.hpp:52
This class keeps type information (about an entity class that occurs in the game).
Definition: TypeSys.hpp:79
void OnClockTickEvent(float t)
This method handles clock-tick events.
Definition: CompClient.cpp:83