| 1 | /* |
|---|
| 2 | ================================================================================= |
|---|
| 3 | This file is part of Cafu, the open-source game engine and graphics engine |
|---|
| 4 | for multiplayer, cross-platform, real-time 3D action. |
|---|
| 5 | Copyright (C) 2002-2012 Carsten Fuchs Software. |
|---|
| 6 | |
|---|
| 7 | Cafu is free software: you can redistribute it and/or modify it under the terms |
|---|
| 8 | of the GNU General Public License as published by the Free Software Foundation, |
|---|
| 9 | either version 3 of the License, or (at your option) any later version. |
|---|
| 10 | |
|---|
| 11 | Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|---|
| 12 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|---|
| 13 | PURPOSE. See the GNU General Public License for more details. |
|---|
| 14 | |
|---|
| 15 | You should have received a copy of the GNU General Public License |
|---|
| 16 | along with Cafu. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | |
|---|
| 18 | For support and more information about Cafu, visit us at <http://www.cafu.de>. |
|---|
| 19 | ================================================================================= |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | /**************************************/ |
|---|
| 23 | /*** ***/ |
|---|
| 24 | /*** Cafu Engine ***/ |
|---|
| 25 | /*** ***/ |
|---|
| 26 | /*** Dass ich erkenne, was die Welt ***/ |
|---|
| 27 | /*** im Innersten zusammenhält. ***/ |
|---|
| 28 | /*** (Faust) ***/ |
|---|
| 29 | /*** ***/ |
|---|
| 30 | /**************************************/ |
|---|
| 31 | |
|---|
| 32 | #ifndef CAFU_APP_CAFU_HPP_INCLUDED |
|---|
| 33 | #define CAFU_APP_CAFU_HPP_INCLUDED |
|---|
| 34 | |
|---|
| 35 | #include "wx/app.h" |
|---|
| 36 | #include "wx/display.h" |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | namespace cf { class CompositeConsoleT; } |
|---|
| 40 | namespace cf { class ConsoleFileT; } |
|---|
| 41 | namespace cf { class ConsoleStringBufferT; } |
|---|
| 42 | class MainFrameT; |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | /// This class represents the Cafu Engine application. |
|---|
| 46 | class AppCafuT : public wxApp |
|---|
| 47 | { |
|---|
| 48 | public: |
|---|
| 49 | |
|---|
| 50 | AppCafuT(); |
|---|
| 51 | ~AppCafuT(); |
|---|
| 52 | |
|---|
| 53 | /// Returns the composite console that is also available via the global Console pointer. |
|---|
| 54 | cf::CompositeConsoleT& GetConComposite() const; |
|---|
| 55 | |
|---|
| 56 | /// Returns the console that buffers all output. |
|---|
| 57 | cf::ConsoleStringBufferT& GetConBuffer() const { return *m_ConBuffer; } |
|---|
| 58 | |
|---|
| 59 | // /// Returns the console that logs all output into a file (can be NULL if not used). |
|---|
| 60 | // cf::ConsoleFileT& GetConFile() const { return *m_ConFile; } |
|---|
| 61 | |
|---|
| 62 | /// Returns whether we successfully set a custom video mode (screen resolution) during initialization. |
|---|
| 63 | bool IsCustomVideoMode() const { return m_IsCustomVideoMode; } |
|---|
| 64 | |
|---|
| 65 | /// This method returns the current video mode, which may be identical to the desktops video mode |
|---|
| 66 | /// (in which case the mode as not switched at all at app init), or any custom mode. |
|---|
| 67 | const wxVideoMode& GetCurrentMode() const { return m_CurrentMode; } |
|---|
| 68 | |
|---|
| 69 | /// Returns the main frame of the Cafu application. |
|---|
| 70 | MainFrameT* GetMainFrame() const { return m_MainFrame; } |
|---|
| 71 | |
|---|
| 72 | bool OnInit(); |
|---|
| 73 | int OnExit(); |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | private: |
|---|
| 77 | |
|---|
| 78 | void OnInitCmdLine(wxCmdLineParser& Parser); |
|---|
| 79 | bool OnCmdLineParsed(wxCmdLineParser& Parser); |
|---|
| 80 | |
|---|
| 81 | wxLocale* m_Locale; |
|---|
| 82 | cf::ConsoleStringBufferT* m_ConBuffer; ///< The console that buffers all output. |
|---|
| 83 | cf::ConsoleFileT* m_ConFile; ///< The console that logs all output into a file (can be NULL if not used). |
|---|
| 84 | bool m_IsCustomVideoMode; ///< Whether we successfully set a custom video mode (screen resolution) during initialization. |
|---|
| 85 | wxVideoMode m_CurrentMode; ///< The video mode that we're currently using. |
|---|
| 86 | MainFrameT* m_MainFrame; ///< The Cafu application main frame. |
|---|
| 87 | }; |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | /// This macro provides the wxGetApp() function which returns a reference to our AppCafuT instance. |
|---|
| 91 | DECLARE_APP(AppCafuT) |
|---|
| 92 | |
|---|
| 93 | #endif |
|---|