GameAdaptor.cxx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // GameAdaptor.cxx
  3. // danmaku
  4. //
  5. // Created by Sam Jaffe on 5/22/19.
  6. // Copyright © 2019 Sam Jaffe. All rights reserved.
  7. //
  8. #include "GameAdaptor.h"
  9. //#include "game/graphics/renderer.hpp"
  10. #include "game/util/time.hpp"
  11. #include "game/util/env.hpp"
  12. #include "game/math/math_fwd.hpp"
  13. #include "vector/vector.hpp"
  14. //#include "Engine/Utilities/Logger.hpp"
  15. //#include "Game/TheGame.hpp"
  16. #include "GameAdaptor.h"
  17. void init_gl() {
  18. // Renderer::GetInstance().Clear();
  19. }
  20. void draw_screen() {
  21. static engine::timestamp lastTime = engine::clock::now();
  22. engine::timestamp now = engine::clock::now();
  23. std::chrono::duration<double> delta(now - lastTime);
  24. // Logger::Instance().debugf("RTick: %f", now - lastTime);
  25. // TheGame::GetInstance().Render();
  26. lastTime = now;
  27. }
  28. namespace env {
  29. namespace detail {
  30. extern void resize_screen(math::vec2i const&);
  31. }
  32. }
  33. void screen_resize(int width, int height) {
  34. env::detail::resize_screen(make_vector(width, height));
  35. }
  36. // flags:
  37. // alnum: 0x00000100
  38. // arrow: 0x00a00000
  39. // ?ANY: 0x00000100
  40. // CTRL: 0x00040001
  41. // LSHIFT:0x00020002
  42. // RSHIFT:0x00020004
  43. // LCMD: 0x00100008
  44. // RCMD: 0x00100010
  45. // LALT: 0x00080020
  46. // RALT: 0x00080040
  47. // FN: 0x00800000
  48. void key_down(unsigned short key) {
  49. // TheGame::GetInstance().KeyPressEvent(key);
  50. }
  51. void key_up(unsigned short key) {
  52. // TheGame::GetInstance().KeyReleaseEvent(key);
  53. }
  54. void game_deactivate() {
  55. // Env::StopClock();
  56. }
  57. void game_activate() {
  58. // Env::StartClock();
  59. }
  60. void run_game() {
  61. static engine::timestamp lastTime = engine::clock::now();
  62. engine::timestamp now = engine::clock::now();
  63. std::chrono::duration<double> delta(now - lastTime);
  64. // Logger::Instance().debugf("UTick: %f", now - lastTime);
  65. // TheGame::GetInstance().Update(now - lastTime);
  66. lastTime = now;
  67. }