root/cafu/trunk/Ca3DE/MainCanvas.hpp

Revision 457, 3.5 KB (checked in by Carsten, 4 months ago)

Using UltraEdit's multi-line search-and-replace-in-files feature, replaced


^#ifndef _(CAFU|CF|CFS|CA)_(.*)_$
^#define _\1_\2_$

with

#ifndef CAFU_\2_INCLUDED
#define CAFU_\2_INCLUDED

and


^#ifndef _(.*)_HPP_$
^#define _\1_HPP_$

with

#ifndef CAFU_\1_HPP_INCLUDED
#define CAFU_\1_HPP_INCLUDED

Closes #91.

Line 
1/*
2=================================================================================
3This file is part of Cafu, the open-source game engine and graphics engine
4for multiplayer, cross-platform, real-time 3D action.
5Copyright (C) 2002-2012 Carsten Fuchs Software.
6
7Cafu is free software: you can redistribute it and/or modify it under the terms
8of the GNU General Public License as published by the Free Software Foundation,
9either version 3 of the License, or (at your option) any later version.
10
11Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with Cafu. If not, see <http://www.gnu.org/licenses/>.
17
18For support and more information about Cafu, visit us at <http://www.cafu.de>.
19=================================================================================
20*/
21
22#ifndef CAFU_MAIN_CANVAS_HPP_INCLUDED
23#define CAFU_MAIN_CANVAS_HPP_INCLUDED
24
25#include "Util/Util.hpp"
26#include "wx/wx.h"
27#include "wx/glcanvas.h"
28
29#if __linux__
30#define HMODULE void*
31#endif
32
33
34class MainFrameT;
35class wxGLContext;
36class ClientT;
37class ServerT;
38class SvGuiCallbT;
39class ModelManagerT;
40namespace cf { namespace GuiSys { class GuiResourcesT; } }
41namespace cf { class ConsoleI; }
42
43
44/// This class represents the Cafu main OpenGL 3D canvas.
45class MainCanvasT : public wxGLCanvas
46{
47    public:
48
49    /// The constructor.
50    MainCanvasT(MainFrameT* Parent);
51
52    /// The destructor.
53    ~MainCanvasT();
54
55
56    private:
57
58    enum InitStateT { INIT_REQUIRED, INIT_FAILED, INIT_SUCCESS };
59    enum LastMousePosT { IN_CLIENT_3D_GUI, IN_OTHER_2D_GUI };
60
61    void Initialize();
62    void TakeScreenshot() const;
63
64    void OnPaint(wxPaintEvent& PE);
65    void OnSize(wxSizeEvent& SE);
66    void OnIdle(wxIdleEvent& IE);   ///< The idle event handler runs one frame of the Cafu Engine (client and/or server).
67
68    void OnMouseMove (wxMouseEvent& ME);
69    void OnMouseWheel(wxMouseEvent& ME);
70    void OnLMouseDown(wxMouseEvent& ME);
71    void OnLMouseUp  (wxMouseEvent& ME);
72    void OnRMouseDown(wxMouseEvent& ME);
73    void OnRMouseUp  (wxMouseEvent& ME);
74
75    void OnKeyDown(wxKeyEvent& KE);
76    void OnKeyUp  (wxKeyEvent& KE);
77    void OnKeyChar(wxKeyEvent& KE);
78
79    MainFrameT*                m_Parent;
80    InitStateT                 m_InitState;     ///< Indicates whether initialization is still required, was attempted but failed, or completed successfully.
81    wxGLContext*               m_GLContext;     ///< The OpenGL rendering context that represents our app-global OpenGL state.
82    HMODULE                    m_RendererDLL;
83    ModelManagerT*             m_ModelManager;
84    cf::GuiSys::GuiResourcesT* m_GuiResources;
85    HMODULE                    m_SoundSysDLL;
86    HMODULE                    m_GameDLL;
87    ClientT*                   m_Client;
88    ServerT*                   m_Server;
89    SvGuiCallbT*               m_SvGuiCallback;
90    cf::ConsoleI*              m_ConByGuiWin;   ///< This points to an instance of cf::GuiSys::ConsoleByWindowT.
91    TimerT                     m_Timer;
92    double                     m_TotalTime;
93    LastMousePosT              m_LastMousePos;  ///< Used to prevent unwanted changes to the players heading and pitch when we're switching back from a 2D GUI to the 3D client view.
94
95    DECLARE_EVENT_TABLE()
96};
97
98#endif
Note: See TracBrowser for help on using the browser.