emu_window.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**
  2. * Copyright (C) 2005-2012 Gekko Emulator
  3. *
  4. * @file emu_window.h
  5. * @author Neobrain
  6. * @date 2012-06-01
  7. * @brief Interface for implementing an emulator window manager
  8. *
  9. * @section LICENSE
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details at
  19. * http://www.gnu.org/copyleft/gpl.html
  20. *
  21. * Official project repository can be found at:
  22. * http://code.google.com/p/gekko-gc-emu/
  23. */
  24. #ifndef CORE_EMUWINDOW_H_
  25. #define CORE_EMUWINDOW_H_
  26. #include "common.h"
  27. //namespace input_common
  28. //{
  29. //class KeyboardInput;
  30. //}
  31. // Abstraction class used to provide an interface between emulation code and the frontend (e.g. SDL,
  32. // QGLWidget, GLFW, etc...)
  33. class EmuWindow
  34. {
  35. public:
  36. /// Data structure to store an emuwindow configuration
  37. struct Config{
  38. bool fullscreen;
  39. int res_width;
  40. int res_height;
  41. };
  42. /// Swap buffers to display the next frame
  43. virtual void SwapBuffers() = 0;
  44. /// Polls window events
  45. virtual void PollEvents() = 0;
  46. /// Makes the graphics context current for the caller thread
  47. virtual void MakeCurrent() = 0;
  48. /// Releases (dunno if this is the "right" word) the GLFW context from the caller thread
  49. virtual void DoneCurrent() = 0;
  50. /**
  51. * @brief Called from KeyboardInput constructor to notify EmuWindow about its presence
  52. * @param controller_interface Pointer to a running KeyboardInput interface
  53. */
  54. //void set_controller_interface(input_common::KeyboardInput* controller_interface) {
  55. // controller_interface_ = controller_interface;
  56. //}
  57. //input_common::KeyboardInput* controller_interface() { return controller_interface_; }
  58. Config config() { return config_; }
  59. void set_config(Config val) { config_ = val; }
  60. int client_area_width() { return client_area_width_; }
  61. void set_client_area_width(int val) { client_area_width_ = val; }
  62. int client_area_height() { return client_area_height_; }
  63. void set_client_area_height(int val) { client_area_height_ = val; }
  64. std::string window_title() { return window_title_; }
  65. void set_window_title(std::string val) { window_title_ = val; }
  66. protected:
  67. EmuWindow() : client_area_width_(640), client_area_height_(480) {
  68. char window_title[255];
  69. sprintf(window_title, "citra [%s|%s] - %s",
  70. "null-cpu",
  71. "null-renderer",
  72. __DATE__);
  73. window_title_ = window_title;
  74. }
  75. virtual ~EmuWindow() {}
  76. std::string window_title_; ///< Current window title, should be used by window impl.
  77. int client_area_width_; ///< Current client width, should be set by window impl.
  78. int client_area_height_; ///< Current client height, should be set by window impl.
  79. private:
  80. Config config_; ///< Internal configuration
  81. };
  82. #endif // CORE_EMUWINDOW_H_