yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
controller.cc
Go to the documentation of this file.
1#include "controller.h"
2
3#include <SDL.h>
4
5#include <memory>
6
7#include "absl/status/status.h"
8#include "absl/strings/str_format.h"
12#include "app/gui/icons.h"
13#include "app/gui/style.h"
14#include "imgui/backends/imgui_impl_sdl2.h"
15#include "imgui/backends/imgui_impl_sdlrenderer2.h"
16#include "imgui/imgui.h"
17#include "imgui/imgui_internal.h"
18
19namespace yaze {
20namespace app {
21namespace core {
22
23namespace {
24
25constexpr ImGuiWindowFlags kMainEditorFlags =
26 ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse |
27 ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_MenuBar |
28 ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoTitleBar;
29
30using ImGui::Begin;
31using ImGui::End;
32using ImGui::GetIO;
33using ImGui::NewFrame;
34using ImGui::SetNextWindowPos;
35using ImGui::SetNextWindowSize;
36
38 const ImGuiIO &io = GetIO();
39 ImGui_ImplSDLRenderer2_NewFrame();
40 ImGui_ImplSDL2_NewFrame();
41 NewFrame();
42 SetNextWindowPos(gui::kZeroPos);
43 ImVec2 dimensions(io.DisplaySize.x, io.DisplaySize.y);
44 SetNextWindowSize(dimensions, ImGuiCond_Always);
45
46 if (!Begin("##YazeMain", nullptr, kMainEditorFlags)) {
47 End();
48 return;
49 }
50}
51
53 ImGuiIO &io = ImGui::GetIO();
54 io.KeyMap[ImGuiKey_LeftSuper] = SDL_GetScancodeFromKey(SDLK_LGUI);
55 io.KeyMap[ImGuiKey_Backspace] = SDL_GetScancodeFromKey(SDLK_BACKSPACE);
56 io.KeyMap[ImGuiKey_LeftShift] = SDL_GetScancodeFromKey(SDLK_LSHIFT);
57 io.KeyMap[ImGuiKey_Enter] = SDL_GetScancodeFromKey(SDLK_RETURN);
58 io.KeyMap[ImGuiKey_UpArrow] = SDL_GetScancodeFromKey(SDLK_UP);
59 io.KeyMap[ImGuiKey_DownArrow] = SDL_GetScancodeFromKey(SDLK_DOWN);
60 io.KeyMap[ImGuiKey_LeftArrow] = SDL_GetScancodeFromKey(SDLK_LEFT);
61 io.KeyMap[ImGuiKey_RightArrow] = SDL_GetScancodeFromKey(SDLK_RIGHT);
62 io.KeyMap[ImGuiKey_Delete] = SDL_GetScancodeFromKey(SDLK_DELETE);
63 io.KeyMap[ImGuiKey_Escape] = SDL_GetScancodeFromKey(SDLK_ESCAPE);
64 io.KeyMap[ImGuiKey_Tab] = SDL_GetScancodeFromKey(SDLK_TAB);
65 io.KeyMap[ImGuiKey_LeftCtrl] = SDL_GetScancodeFromKey(SDLK_LCTRL);
66 io.KeyMap[ImGuiKey_PageUp] = SDL_GetScancodeFromKey(SDLK_PAGEUP);
67 io.KeyMap[ImGuiKey_PageDown] = SDL_GetScancodeFromKey(SDLK_PAGEDOWN);
68 io.KeyMap[ImGuiKey_Home] = SDL_GetScancodeFromKey(SDLK_HOME);
69 io.KeyMap[ImGuiKey_Space] = SDL_GetScancodeFromKey(SDLK_SPACE);
70 io.KeyMap[ImGuiKey_1] = SDL_GetScancodeFromKey(SDLK_1);
71 io.KeyMap[ImGuiKey_2] = SDL_GetScancodeFromKey(SDLK_2);
72 io.KeyMap[ImGuiKey_3] = SDL_GetScancodeFromKey(SDLK_3);
73 io.KeyMap[ImGuiKey_4] = SDL_GetScancodeFromKey(SDLK_4);
74 io.KeyMap[ImGuiKey_5] = SDL_GetScancodeFromKey(SDLK_5);
75 io.KeyMap[ImGuiKey_6] = SDL_GetScancodeFromKey(SDLK_6);
76 io.KeyMap[ImGuiKey_7] = SDL_GetScancodeFromKey(SDLK_7);
77 io.KeyMap[ImGuiKey_8] = SDL_GetScancodeFromKey(SDLK_8);
78 io.KeyMap[ImGuiKey_9] = SDL_GetScancodeFromKey(SDLK_9);
79 io.KeyMap[ImGuiKey_0] = SDL_GetScancodeFromKey(SDLK_0);
80 io.KeyMap[ImGuiKey_A] = SDL_GetScancodeFromKey(SDLK_a);
81 io.KeyMap[ImGuiKey_B] = SDL_GetScancodeFromKey(SDLK_b);
82 io.KeyMap[ImGuiKey_C] = SDL_GetScancodeFromKey(SDLK_c);
83 io.KeyMap[ImGuiKey_D] = SDL_GetScancodeFromKey(SDLK_d);
84 io.KeyMap[ImGuiKey_E] = SDL_GetScancodeFromKey(SDLK_e);
85 io.KeyMap[ImGuiKey_F] = SDL_GetScancodeFromKey(SDLK_f);
86 io.KeyMap[ImGuiKey_G] = SDL_GetScancodeFromKey(SDLK_g);
87 io.KeyMap[ImGuiKey_H] = SDL_GetScancodeFromKey(SDLK_h);
88 io.KeyMap[ImGuiKey_I] = SDL_GetScancodeFromKey(SDLK_i);
89 io.KeyMap[ImGuiKey_J] = SDL_GetScancodeFromKey(SDLK_j);
90 io.KeyMap[ImGuiKey_K] = SDL_GetScancodeFromKey(SDLK_k);
91 io.KeyMap[ImGuiKey_L] = SDL_GetScancodeFromKey(SDLK_l);
92 io.KeyMap[ImGuiKey_M] = SDL_GetScancodeFromKey(SDLK_m);
93 io.KeyMap[ImGuiKey_N] = SDL_GetScancodeFromKey(SDLK_n);
94 io.KeyMap[ImGuiKey_O] = SDL_GetScancodeFromKey(SDLK_o);
95 io.KeyMap[ImGuiKey_P] = SDL_GetScancodeFromKey(SDLK_p);
96 io.KeyMap[ImGuiKey_Q] = SDL_GetScancodeFromKey(SDLK_q);
97 io.KeyMap[ImGuiKey_R] = SDL_GetScancodeFromKey(SDLK_r);
98 io.KeyMap[ImGuiKey_S] = SDL_GetScancodeFromKey(SDLK_s);
99 io.KeyMap[ImGuiKey_T] = SDL_GetScancodeFromKey(SDLK_t);
100 io.KeyMap[ImGuiKey_U] = SDL_GetScancodeFromKey(SDLK_u);
101 io.KeyMap[ImGuiKey_V] = SDL_GetScancodeFromKey(SDLK_v);
102 io.KeyMap[ImGuiKey_W] = SDL_GetScancodeFromKey(SDLK_w);
103 io.KeyMap[ImGuiKey_X] = SDL_GetScancodeFromKey(SDLK_x);
104 io.KeyMap[ImGuiKey_Y] = SDL_GetScancodeFromKey(SDLK_y);
105 io.KeyMap[ImGuiKey_Z] = SDL_GetScancodeFromKey(SDLK_z);
106 io.KeyMap[ImGuiKey_F1] = SDL_GetScancodeFromKey(SDLK_F1);
107 io.KeyMap[ImGuiKey_F2] = SDL_GetScancodeFromKey(SDLK_F2);
108 io.KeyMap[ImGuiKey_F3] = SDL_GetScancodeFromKey(SDLK_F3);
109 io.KeyMap[ImGuiKey_F4] = SDL_GetScancodeFromKey(SDLK_F4);
110 io.KeyMap[ImGuiKey_F5] = SDL_GetScancodeFromKey(SDLK_F5);
111 io.KeyMap[ImGuiKey_F6] = SDL_GetScancodeFromKey(SDLK_F6);
112 io.KeyMap[ImGuiKey_F7] = SDL_GetScancodeFromKey(SDLK_F7);
113 io.KeyMap[ImGuiKey_F8] = SDL_GetScancodeFromKey(SDLK_F8);
114 io.KeyMap[ImGuiKey_F9] = SDL_GetScancodeFromKey(SDLK_F9);
115 io.KeyMap[ImGuiKey_F10] = SDL_GetScancodeFromKey(SDLK_F10);
116 io.KeyMap[ImGuiKey_F11] = SDL_GetScancodeFromKey(SDLK_F11);
117 io.KeyMap[ImGuiKey_F12] = SDL_GetScancodeFromKey(SDLK_F12);
118}
119
120void HandleKeyDown(SDL_Event &event, editor::EditorManager &editor) {
121 ImGuiIO &io = ImGui::GetIO();
122 io.KeysDown[event.key.keysym.scancode] = (event.type == SDL_KEYDOWN);
123 io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
124 io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
125 io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
126 io.KeySuper = ((SDL_GetModState() & KMOD_GUI) != 0);
127
128 switch (event.key.keysym.sym) {
129 case SDLK_BACKSPACE:
130 case SDLK_LSHIFT:
131 case SDLK_LCTRL:
132 case SDLK_TAB:
133 io.KeysDown[event.key.keysym.scancode] = (event.type == SDL_KEYDOWN);
134 break;
135 case SDLK_z:
136 editor.emulator().snes().SetButtonState(1, 0, true);
137 break;
138 case SDLK_a:
139 editor.emulator().snes().SetButtonState(1, 1, true);
140 break;
141 case SDLK_RSHIFT:
142 editor.emulator().snes().SetButtonState(1, 2, true);
143 break;
144 case SDLK_RETURN:
145 editor.emulator().snes().SetButtonState(1, 3, true);
146 break;
147 case SDLK_UP:
148 editor.emulator().snes().SetButtonState(1, 4, true);
149 break;
150 case SDLK_DOWN:
151 editor.emulator().snes().SetButtonState(1, 5, true);
152 break;
153 case SDLK_LEFT:
154 editor.emulator().snes().SetButtonState(1, 6, true);
155 break;
156 case SDLK_RIGHT:
157 editor.emulator().snes().SetButtonState(1, 7, true);
158 break;
159 case SDLK_x:
160 editor.emulator().snes().SetButtonState(1, 8, true);
161 break;
162 case SDLK_s:
163 editor.emulator().snes().SetButtonState(1, 9, true);
164 break;
165 case SDLK_d:
166 editor.emulator().snes().SetButtonState(1, 10, true);
167 break;
168 case SDLK_c:
169 editor.emulator().snes().SetButtonState(1, 11, true);
170 break;
171 default:
172 break;
173 }
174}
175
176void HandleKeyUp(SDL_Event &event, editor::EditorManager &editor) {
177 ImGuiIO &io = ImGui::GetIO();
178 int key = event.key.keysym.scancode;
179 IM_ASSERT(key >= 0 && key < IM_ARRAYSIZE(io.KeysDown));
180 io.KeysDown[key] = (event.type == SDL_KEYDOWN);
181 io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
182 io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
183 io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
184 io.KeySuper = ((SDL_GetModState() & KMOD_GUI) != 0);
185
186 switch (event.key.keysym.sym) {
187 case SDLK_z:
188 editor.emulator().snes().SetButtonState(1, 0, false);
189 break;
190 case SDLK_a:
191 editor.emulator().snes().SetButtonState(1, 1, false);
192 break;
193 case SDLK_RSHIFT:
194 editor.emulator().snes().SetButtonState(1, 2, false);
195 break;
196 case SDLK_RETURN:
197 editor.emulator().snes().SetButtonState(1, 3, false);
198 break;
199 case SDLK_UP:
200 editor.emulator().snes().SetButtonState(1, 4, false);
201 break;
202 case SDLK_DOWN:
203 editor.emulator().snes().SetButtonState(1, 5, false);
204 break;
205 case SDLK_LEFT:
206 editor.emulator().snes().SetButtonState(1, 6, false);
207 break;
208 case SDLK_RIGHT:
209 editor.emulator().snes().SetButtonState(1, 7, false);
210 break;
211 case SDLK_x:
212 editor.emulator().snes().SetButtonState(1, 8, false);
213 break;
214 case SDLK_s:
215 editor.emulator().snes().SetButtonState(1, 9, false);
216 break;
217 case SDLK_d:
218 editor.emulator().snes().SetButtonState(1, 10, false);
219 break;
220 case SDLK_c:
221 editor.emulator().snes().SetButtonState(1, 11, false);
222 break;
223 default:
224 break;
225 }
226}
227
228void ChangeWindowSizeEvent(SDL_Event &event) {
229 ImGuiIO &io = ImGui::GetIO();
230 io.DisplaySize.x = static_cast<float>(event.window.data1);
231 io.DisplaySize.y = static_cast<float>(event.window.data2);
232}
233
234void HandleMouseMovement(int &wheel) {
235 ImGuiIO &io = ImGui::GetIO();
236 int mouseX;
237 int mouseY;
238 const int buttons = SDL_GetMouseState(&mouseX, &mouseY);
239
240 io.DeltaTime = 1.0f / 60.0f;
241 io.MousePos = ImVec2(static_cast<float>(mouseX), static_cast<float>(mouseY));
242 io.MouseDown[0] = buttons & SDL_BUTTON(SDL_BUTTON_LEFT);
243 io.MouseDown[1] = buttons & SDL_BUTTON(SDL_BUTTON_RIGHT);
244 io.MouseDown[2] = buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE);
245 io.MouseWheel = static_cast<float>(wheel);
246}
247
248} // namespace
249
250absl::Status Controller::OnEntry(std::string filename) {
251#if defined(__APPLE__) && defined(__MACH__)
252#if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
254#elif TARGET_OS_MAC == 1
256#endif
257#elif defined(_WIN32)
259#elif defined(__linux__)
261#else
263#endif
268
269 InitializeKeymap();
271 active_ = true;
272 return absl::OkStatus();
273}
274
276 int wheel = 0;
277 SDL_Event event;
278 ImGuiIO &io = ImGui::GetIO();
279
280 while (SDL_PollEvent(&event)) {
281 switch (event.type) {
282 case SDL_KEYDOWN:
283 HandleKeyDown(event, editor_manager_);
284 break;
285 case SDL_KEYUP:
286 HandleKeyUp(event, editor_manager_);
287 break;
288 case SDL_TEXTINPUT:
289 io.AddInputCharactersUTF8(event.text.text);
290 break;
291 case SDL_MOUSEWHEEL:
292 wheel = event.wheel.y;
293 break;
294 case SDL_WINDOWEVENT:
295 switch (event.window.event) {
296 case SDL_WINDOWEVENT_CLOSE:
297 active_ = false;
298 break;
299 case SDL_WINDOWEVENT_SIZE_CHANGED:
300 ChangeWindowSizeEvent(event);
301 break;
302 default:
303 break;
304 }
305 break;
306 default:
307 break;
308 }
309 }
310
311 HandleMouseMovement(wheel);
312}
313
314absl::Status Controller::OnLoad() {
315 if (editor_manager_.quit()) {
316 active_ = false;
317 }
318#if TARGET_OS_IPHONE != 1
319 if (platform_ != Platform::kiOS) {
320 NewMasterFrame();
321 }
322#endif
324#if TARGET_OS_IPHONE != 1
325 if (platform_ != Platform::kiOS) {
326 End();
327 }
328#endif
329 return absl::OkStatus();
330}
331
334 return absl::OkStatus();
335}
336
338 ImGui::Render();
339 SDL_RenderClear(Renderer::GetInstance().renderer());
340 ImGui_ImplSDLRenderer2_RenderDrawData(ImGui::GetDrawData(),
342 SDL_RenderPresent(Renderer::GetInstance().renderer());
343}
344
346 SDL_PauseAudioDevice(audio_device_, 1);
347 SDL_CloseAudioDevice(audio_device_);
348 ImGui_ImplSDLRenderer2_Shutdown();
349 ImGui_ImplSDL2_Shutdown();
350 ImGui::DestroyContext();
351 SDL_Quit();
352}
353
355 auto sdl_flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
356 if (flags()->kUseNewImGuiInput) {
357 sdl_flags |= SDL_INIT_GAMECONTROLLER;
358 }
359
360 if (SDL_Init(sdl_flags) != 0) {
361 return absl::InternalError(
362 absl::StrFormat("SDL_Init: %s\n", SDL_GetError()));
363 } else {
364 SDL_DisplayMode displayMode;
365 SDL_GetCurrentDisplayMode(0, &displayMode);
366 int screenWidth = displayMode.w * 0.8;
367 int screenHeight = displayMode.h * 0.8;
368
369 window_ = std::unique_ptr<SDL_Window, core::SDL_Deleter>(
370 SDL_CreateWindow("Yet Another Zelda3 Editor", // window title
371 SDL_WINDOWPOS_UNDEFINED, // initial x position
372 SDL_WINDOWPOS_UNDEFINED, // initial y position
373 screenWidth, // width, in pixels
374 screenHeight, // height, in pixels
375 SDL_WINDOW_RESIZABLE),
377 if (window_ == nullptr) {
378 return absl::InternalError(
379 absl::StrFormat("SDL_CreateWindow: %s\n", SDL_GetError()));
380 }
381 }
382 return absl::OkStatus();
383}
384
388
390 IMGUI_CHECKVERSION();
391 ImGui::CreateContext();
392
393 ImGuiIO &io = ImGui::GetIO();
394 io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
395
396 if (flags()->kUseNewImGuiInput) {
397 io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
398 }
399
400 // Initialize ImGui for SDL
401 ImGui_ImplSDL2_InitForSDLRenderer(window_.get(),
403 ImGui_ImplSDLRenderer2_Init(Renderer::GetInstance().renderer());
404
405 if (flags()->kLoadSystemFonts) {
407 } else {
409 }
410
411 // Set the default style
413
414 // Build a new ImGui frame
415 ImGui_ImplSDLRenderer2_NewFrame();
416 ImGui_ImplSDL2_NewFrame();
417
418 return absl::OkStatus();
419}
420
421absl::Status Controller::LoadFontFamilies() const {
422 ImGuiIO &io = ImGui::GetIO();
423
424 static const char *KARLA_REGULAR = "Karla-Regular.ttf";
425 static const char *ROBOTO_MEDIUM = "Roboto-Medium.ttf";
426 static const char *COUSINE_REGULAR = "Cousine-Regular.ttf";
427 static const char *DROID_SANS = "DroidSans.ttf";
428 static const char *NOTO_SANS_JP = "NotoSansJP.ttf";
429 static const char *IBM_PLEX_JP = "IBMPlexSansJP-Bold.ttf";
430 static const float FONT_SIZE_DEFAULT = 14.0f;
431 static const float FONT_SIZE_DROID_SANS = 16.0f;
432 static const float ICON_FONT_SIZE = 18.0f;
433
434 // Icon configuration
435 static const ImWchar icons_ranges[] = {ICON_MIN_MD, 0xf900, 0};
436 ImFontConfig icons_config;
437 icons_config.MergeMode = true;
438 icons_config.GlyphOffset.y = 5.0f;
439 icons_config.GlyphMinAdvanceX = 13.0f;
440 icons_config.PixelSnapH = true;
441
442 // Japanese font configuration
443 ImFontConfig japanese_font_config;
444 japanese_font_config.MergeMode = true;
445 icons_config.GlyphOffset.y = 5.0f;
446 icons_config.GlyphMinAdvanceX = 13.0f;
447 icons_config.PixelSnapH = true;
448
449 // List of fonts to be loaded
450 std::vector<const char *> font_paths = {KARLA_REGULAR, ROBOTO_MEDIUM,
451 COUSINE_REGULAR, IBM_PLEX_JP};
452
453 // Load fonts with associated icon and Japanese merges
454 for (const auto &font_path : font_paths) {
455 float font_size =
456 (font_path == DROID_SANS) ? FONT_SIZE_DROID_SANS : FONT_SIZE_DEFAULT;
457
458 std::string actual_font_path;
459#ifdef __APPLE__
460#if TARGET_OS_IOS == 1
461 const std::string kBundlePath = GetBundleResourcePath();
462 actual_font_path = kBundlePath + font_path;
463#else
464 actual_font_path = absl::StrCat(GetBundleResourcePath(),
465 "Contents/Resources/font/", font_path);
466#endif
467#else
468 actual_font_path = std::filesystem::absolute(font_path).string();
469#endif
470
471 if (!io.Fonts->AddFontFromFileTTF(actual_font_path.data(), font_size)) {
472 return absl::InternalError(
473 absl::StrFormat("Failed to load font from %s", actual_font_path));
474 }
475
476 // Merge icon set
477 std::string actual_icon_font_path = "";
478 const char *icon_font_path = FONT_ICON_FILE_NAME_MD;
479#if defined(__APPLE__) && defined(__MACH__)
480#if TARGET_OS_IOS == 1
481 const std::string kIconBundlePath = GetBundleResourcePath();
482 actual_icon_font_path = kIconBundlePath + "MaterialIcons-Regular.ttf";
483#else
484 actual_icon_font_path =
485 absl::StrCat(GetBundleResourcePath(),
486 "Contents/Resources/font/MaterialIcons-Regular.ttf");
487#endif
488#else
489 actual_icon_font_path = std::filesystem::absolute(icon_font_path).string();
490#endif
491 io.Fonts->AddFontFromFileTTF(actual_icon_font_path.data(), ICON_FONT_SIZE,
492 &icons_config, icons_ranges);
493
494 // Merge Japanese font
495 std::string actual_japanese_font_path = "";
496 const char *japanese_font_path = NOTO_SANS_JP;
497#if defined(__APPLE__) && defined(__MACH__)
498#if TARGET_OS_IOS == 1
499 const std::string kJapaneseBundlePath = GetBundleResourcePath();
500 actual_japanese_font_path = kJapaneseBundlePath + japanese_font_path;
501#else
502 actual_japanese_font_path =
503 absl::StrCat(GetBundleResourcePath(), "Contents/Resources/font/",
504 japanese_font_path);
505#endif
506#else
507 actual_japanese_font_path =
508 std::filesystem::absolute(japanese_font_path).string();
509#endif
510 io.Fonts->AddFontFromFileTTF(actual_japanese_font_path.data(), 18.0f,
511 &japanese_font_config,
512 io.Fonts->GetGlyphRangesJapanese());
513 }
514
515 return absl::OkStatus();
516}
517
519 SDL_AudioSpec want, have;
520 SDL_memset(&want, 0, sizeof(want));
521 want.freq = audio_frequency_;
522 want.format = AUDIO_S16;
523 want.channels = 2;
524 want.samples = 2048;
525 want.callback = NULL; // Uses the queue
526 audio_device_ = SDL_OpenAudioDevice(NULL, 0, &want, &have, 0);
527 if (audio_device_ == 0) {
528 return absl::InternalError(
529 absl::StrFormat("Failed to open audio: %s\n", SDL_GetError()));
530 }
531 // audio_buffer_ = new int16_t[audio_frequency_ / 50 * 4];
532 audio_buffer_ = std::make_shared<int16_t>(audio_frequency_ / 50 * 4);
533 SDL_PauseAudioDevice(audio_device_, 0);
534 editor_manager_.emulator().set_audio_buffer(audio_buffer_.get());
535 editor_manager_.emulator().set_audio_device_id(audio_device_);
536 return absl::OkStatus();
537}
538
539} // namespace core
540} // namespace app
541} // namespace yaze
SDL_AudioDeviceID audio_device_
Definition controller.h:70
absl::Status CreateGuiContext()
editor::EditorManager editor_manager_
Definition controller.h:67
absl::Status LoadFontFamilies() const
absl::Status LoadAudioDevice()
absl::Status CreateSDL_Window()
std::shared_ptr< SDL_Window > window_
Definition controller.h:72
absl::Status OnEntry(std::string filename="")
editor::Editor * test_editor_
Definition controller.h:66
auto renderer() -> SDL_Renderer *
Definition controller.h:54
absl::Status CreateRenderer()
std::shared_ptr< int16_t > audio_buffer_
Definition controller.h:71
absl::Status CreateRenderer(SDL_Window *window)
Definition renderer.h:35
auto renderer() -> SDL_Renderer *
Definition renderer.h:47
static Renderer & GetInstance()
Definition renderer.h:30
The EditorManager controls the main editor window and manages the various editor classes.
void SetupScreen(std::string filename="")
auto emulator() -> emu::Emulator &
virtual absl::Status Update()=0
#define RETURN_IF_ERROR(expression)
Definition constants.h:69
void LoadSystemFonts()
#define ICON_MIN_MD
Definition icons.h:8
#define FONT_ICON_FILE_NAME_MD
Definition icons.h:6
void HandleKeyDown(SDL_Event &event, editor::EditorManager &editor)
void HandleKeyUp(SDL_Event &event, editor::EditorManager &editor)
std::string GetBundleResourcePath()
void ColorsYaze()
Definition style.cc:423
constexpr ImVec2 kZeroPos
Definition input.h:27
Definition common.cc:21
Deleter for SDL_Window and SDL_Renderer.
Definition sdl_deleter.h:13