Simulant  21.12-194
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
kos_window.h
1 #pragma once
2 
3 /* This is the window implementation for the Dreamcast using KallistiOS */
4 
5 #include <kos.h>
6 
7 #include "window.h"
8 #include "platform.h"
9 
10 #include "threads/mutex.h"
11 
12 namespace smlt {
13 
14 class KOSWindow : public Window {
15 public:
16  static Window::ptr create(Application* app) {
17  return Window::create<KOSWindow>(app);
18  }
19 
20  KOSWindow() = default;
21 
22  void set_title(const std::string&) override {} // No-op
23  void cursor_position(int32_t&, int32_t&) override {} // No-op
24  void show_cursor(bool) override {} // No-op
25  void lock_cursor(bool) override {} // No-op
26 
27  void swap_buffers() override;
28  void destroy_window() override;
29  void check_events() override;
30 
31  void initialize_input_controller(InputState &controller) override;
32 
33  std::shared_ptr<SoundDriver> create_sound_driver(const std::string& from_config) override;
34 
35 private:
36  bool _init_window() override;
37  bool _init_renderer(Renderer* renderer) override;
38 
39  void probe_vmus();
40 
41  void render_screen(Screen* screen, const uint8_t* data) override;
42 
43  /* Name, to port/unit combo. This only includes VMUs we've seen during the last probe */
44 
45  thread::Mutex vmu_mutex_;
46  std::unordered_map<std::string, std::pair<int, int>> vmu_lookup_;
47 
48  float time_since_last_vmu_check_ = 0.0f;
49 };
50 
51 }
smlt::Application
Definition: application.h:167
smlt
Definition: animation.cpp:25
smlt::Window
Definition: window.h:65
smlt::Screen
Definition: screen.h:20
smlt::Renderer
Definition: renderer.h:40
smlt::InputState
Definition: input_state.h:150
smlt::KOSWindow
Definition: kos_window.h:14
smlt::thread::Mutex
Definition: mutex.h:25