Cafu Engine
AppCafu.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 /**************************************/
8 /*** ***/
9 /*** Cafu Engine ***/
10 /*** ***/
11 /*** Dass ich erkenne, was die Welt ***/
12 /*** im Innersten zusammenhält. ***/
13 /*** (Faust) ***/
14 /*** ***/
15 /**************************************/
16 
17 #ifndef CAFU_APP_CAFU_HPP_INCLUDED
18 #define CAFU_APP_CAFU_HPP_INCLUDED
19 
20 #include "GameInfo.hpp"
21 #include "Templates/Array.hpp"
22 #include "wx/app.h"
23 #include "wx/display.h"
24 
25 
26 namespace cf { class CompositeConsoleT; }
27 namespace cf { class ConsoleFileT; }
28 namespace cf { class ConsoleStringBufferT; }
29 class MainFrameT;
30 
31 
32 /// This class represents the Cafu Engine application.
33 class AppCafuT : public wxApp
34 {
35  public:
36 
37  AppCafuT();
38  ~AppCafuT();
39 
40  /// Returns the composite console that is also available via the global Console pointer.
42 
43  /// Returns the console that buffers all output.
44  cf::ConsoleStringBufferT& GetConBuffer() const { return *m_ConBuffer; }
45 
46  // /// Returns the console that logs all output into a file (can be NULL if not used).
47  // cf::ConsoleFileT& GetConFile() const { return *m_ConFile; }
48 
49  /// Returns whether we successfully set a custom video mode (screen resolution) during initialization.
50  bool IsCustomVideoMode() const { return m_IsCustomVideoMode; }
51 
52  /// This method returns the current video mode, which may be identical to the desktops video mode
53  /// (in which case the mode as not switched at all at app init), or any custom mode.
54  const wxVideoMode& GetCurrentMode() const { return m_CurrentMode; }
55 
56  /// Returns the main frame of the Cafu application.
57  MainFrameT* GetMainFrame() const { return m_MainFrame; }
58 
59  bool OnInit();
60  int OnExit();
61 
62 
63  private:
64 
65  void OnInitCmdLine(wxCmdLineParser& Parser);
66  bool OnCmdLineParsed(wxCmdLineParser& Parser);
67 
68  wxLocale* m_Locale;
69  cf::ConsoleStringBufferT* m_ConBuffer; ///< The console that buffers all output.
70  cf::ConsoleFileT* m_ConFile; ///< The console that logs all output into a file (can be NULL if not used).
71  ArrayT<GameInfoT> m_AllGameInfos; ///< The game infos for all games/MODs known and available to us.
72  GameInfoT m_GameInfo; ///< The info of the game that was elected to run (one of those in m_AllGameInfos).
73  bool m_IsCustomVideoMode; ///< Whether we successfully set a custom video mode (screen resolution) during initialization.
74  wxVideoMode m_CurrentMode; ///< The video mode that we're currently using.
75  MainFrameT* m_MainFrame; ///< The Cafu application main frame.
76 };
77 
78 
79 /// This macro provides the wxGetApp() function which returns a reference to our AppCafuT instance.
80 DECLARE_APP(AppCafuT)
81 
82 #endif
const wxVideoMode & GetCurrentMode() const
This method returns the current video mode, which may be identical to the desktops video mode (in whi...
Definition: AppCafu.hpp:54
This class implements the ConsoleI interface by writing the console output into a text file...
Definition: ConsoleFile.hpp:18
MainFrameT * GetMainFrame() const
Returns the main frame of the Cafu application.
Definition: AppCafu.hpp:57
cf::CompositeConsoleT & GetConComposite() const
Returns the composite console that is also available via the global Console pointer.
Definition: AppCafu.cpp:205
cf::ConsoleStringBufferT & GetConBuffer() const
Returns the console that buffers all output.
Definition: AppCafu.hpp:44
bool IsCustomVideoMode() const
Returns whether we successfully set a custom video mode (screen resolution) during initialization...
Definition: AppCafu.hpp:50
This class encapsulates information about a game.
Definition: GameInfo.hpp:14
This class represents the Cafu Engine application.
Definition: AppCafu.hpp:33
This class implements the ConsoleI interface as a composite console by sending all output to its atta...
Definition: ConsoleComposite.hpp:18
This class represents the Cafu main frame.
Definition: MainFrame.hpp:18
This class implements the ConsoleI interface by printing the console output to stdout.
Definition: ConsoleStringBuffer.hpp:16