Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 969 vs 970 for /trunk/Source Code/Editor/Editor.cpp

Diff revisions: vs.
  @@ -24,13 +24,12 @@
24 24 namespace {
25 25 bool show_test_window = true;
26 26 bool show_another_window = false;
27 - ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
28 -
29 27 };
30 28
31 29 Editor::Editor(PlatformContext& context)
32 30 : PlatformContextComponent(context),
33 31 _running(false),
32 + _activeWindowGUID(-1),
34 33 _editorTimer(Time::ADD_TIMER("Main Editor Timer")),
35 34 _editorUpdateTimer(Time::ADD_TIMER("Editor Update Timer")),
36 35 _editorRenderTimer(Time::ADD_TIMER("Editor Render Timer"))
  @@ -120,6 +119,7 @@
120 119 _mainWindow->addEventListener(WindowEvent::GAINED_FOCUS, [this](const DisplayWindow::WindowEventArgs& args) { OnFocus(args._flag);});
121 120 _mainWindow->addEventListener(WindowEvent::RESIZED_INTERNAL, [this](const DisplayWindow::WindowEventArgs& args) { OnSize(args.x, args.y);});
122 121 _mainWindow->addEventListener(WindowEvent::TEXT, [this](const DisplayWindow::WindowEventArgs& args) { OnUTF8(args._text);});
122 + _activeWindowGUID = _mainWindow->getGUID();
123 123
124 124 vec2<I32> size(_mainWindow->getDimensions());
125 125
  @@ -228,7 +228,7 @@
228 228 static float f = 0.0f;
229 229 ImGui::Text("Hello, world!");
230 230 ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
231 - ImGui::ColorEdit3("clear color", (float*)&clear_color);
231 + ImGui::ColorEdit4("clear color", _mainWindow->clearColour()._v);
232 232 if (ImGui::Button("Test Window")) show_test_window ^= 1;
233 233 if (ImGui::Button("Another Window")) show_another_window ^= 1;
234 234 ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
  @@ -271,7 +271,7 @@
271 271 return true;
272 272 }
273 273
274 - // Needs to be rendered immediately. *IM*GUI. IMGUI::NewFrae invalidates this data
274 + // Needs to be rendered immediately. *IM*GUI. IMGUI::NewFrame invalidates this data
275 275 void Editor::renderDrawList(ImDrawData* pDrawData, I64 windowGUID)
276 276 {
277 277 // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
  @@ -282,7 +282,12 @@
282 282 return;
283 283 }
284 284
285 - bool switchWindow = windowGUID != _mainWindow->getGUID();
285 + I64 previousGUID = -1;
286 + bool switchWindow = windowGUID != _activeWindowGUID;
287 + if (switchWindow) {
288 + previousGUID = _activeWindowGUID;
289 + _activeWindowGUID = windowGUID;
290 + }
286 291
287 292 pDrawData->ScaleClipRects(io.DisplayFramebufferScale);
288 293
  @@ -305,7 +310,7 @@
305 310
306 311 if (switchWindow) {
307 312 GFX::SwitchWindowCommand switchWindowCmd;
308 - switchWindowCmd.windowGUID = windowGUID;
313 + switchWindowCmd.windowGUID = _activeWindowGUID;
309 314 GFX::AddSwitchWindow(buffer, switchWindowCmd);
310 315 }
311 316
  @@ -335,7 +340,7 @@
335 340
336 341 if (switchWindow) {
337 342 GFX::SwitchWindowCommand switchWindowCmd;
338 - switchWindowCmd.windowGUID = _mainWindow->getGUID();
343 + switchWindowCmd.windowGUID = previousGUID;
339 344 GFX::AddSwitchWindow(buffer, switchWindowCmd);
340 345 }
341 346