obs-app.hpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /******************************************************************************
  2. Copyright (C) 2013 by Hugh Bailey <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #pragma once
  15. #include <wx/app.h>
  16. #include <wx/window.h>
  17. #include <util/util.hpp>
  18. class OBSAppBase : public wxApp {
  19. public:
  20. virtual ~OBSAppBase();
  21. };
  22. class OBSApp : public OBSAppBase {
  23. ConfigFile globalConfig;
  24. TextLookup textLookup;
  25. wxWindow *mainWindow;
  26. bool InitGlobalConfig();
  27. bool InitGlobalConfigDefaults();
  28. bool InitConfigDefaults();
  29. bool InitLocale();
  30. bool InitOBSBasic();
  31. void GetFPSCommon(uint32_t &num, uint32_t &den) const;
  32. void GetFPSInteger(uint32_t &num, uint32_t &den) const;
  33. void GetFPSFraction(uint32_t &num, uint32_t &den) const;
  34. void GetFPSNanoseconds(uint32_t &num, uint32_t &den) const;
  35. public:
  36. virtual bool OnInit();
  37. virtual int OnExit();
  38. inline wxWindow *GetMainWindow() const {return mainWindow;}
  39. inline config_t GlobalConfig() const {return globalConfig;}
  40. inline const char *GetString(const char *lookupVal) const
  41. {
  42. return textLookup.GetString(lookupVal);
  43. }
  44. void GetConfigFPS(uint32_t &num, uint32_t &den) const;
  45. const char *GetRenderModule() const;
  46. };
  47. wxDECLARE_APP(OBSApp);
  48. inline config_t GetGlobalConfig() {return wxGetApp().GlobalConfig();}
  49. #define Str(lookupVal) wxGetApp().GetString(lookupVal)
  50. #define WXStr(lookupVal) wxString(Str(lookupVal), wxConvUTF8)