Skip to content

Commit

Permalink
Allow to get and set device's position.
Browse files Browse the repository at this point in the history
Small refactor to the editor's ui.
  • Loading branch information
Wolftein committed Nov 25, 2024
1 parent bd21a59 commit f5c73b7
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 24 deletions.
3 changes: 1 addition & 2 deletions Editor/Public/Core/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ namespace Editor

mImGuiBackend.Begin(Delta);
{
//ImGui::ShowDemoWindow();
mEditorUI.ShowMainWindow();
mUIMain.ShowMainWindow();
}
mImGuiBackend.End(Encoder_1);

Expand Down
5 changes: 2 additions & 3 deletions Editor/Public/Core/Application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <Aurora.Engine/Kernel.hpp>
#include "Frontend/ImGuiBackend.hpp"
#include "Frontend/EditorUI.hpp"
#include "Screen/Main.hpp"

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// [ CODE ]
Expand Down Expand Up @@ -49,7 +49,6 @@ namespace Editor
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

ImGuiBackend mImGuiBackend;

EditorUI mEditorUI;
UI::Main mUIMain;
};
}
6 changes: 3 additions & 3 deletions Editor/Public/Core/Frontend/ImGuiBackend.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Copyright (C) 2024 Aeldur contributors (see AUTHORS.md)
// Copyright (C) 2021-2024 by Agustin Alvarez. All rights reserved.
//
// This work is licensed under the terms of the AGPL-V3 license.
// This work is licensed under the terms of the MIT license.
//
// For a copy, see <https://opensource.org/license/agpl-v3>
// For a copy, see <https://opensource.org/licenses/MIT>.
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Expand Down
6 changes: 3 additions & 3 deletions Editor/Public/Core/Frontend/ImGuiBackend.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Copyright (C) 2024 Aeldur contributors (see AUTHORS.md)
// Copyright (C) 2021-2024 by Agustin Alvarez. All rights reserved.
//
// This work is licensed under the terms of the AGPL-V3 license.
// This work is licensed under the terms of the MIT license.
//
// For a copy, see <https://opensource.org/license/agpl-v3>
// For a copy, see <https://opensource.org/licenses/MIT>.
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

#pragma once
Expand Down
1 change: 1 addition & 0 deletions Editor/Public/Core/Frontend/ImGuiRenderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <Aurora.Content/Service.hpp>
#include <Aurora.Graphic/Service.hpp>
#include <imgui.h>
#include <imgui_internal.h>

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// [ CODE ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@
// [ HEADER ]
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

#include "EditorUI.hpp"
#include <iostream>
#include "Main.hpp"

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// [ CODE ]
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

namespace Editor
namespace Editor::UI
{
void EditorUI::ShowMainWindow()
void Main::ShowMainWindow()
{

ImGuiWindowFlags WindowFlags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoDecoration;
Expand All @@ -39,7 +38,7 @@ namespace Editor

ImGui::PopStyleVar(3);

if (ImGui::BeginMenuBar())
if (ImGui::BeginMainMenuBar())
{
if (ImGui::BeginMenu("File"))
{
Expand Down Expand Up @@ -98,7 +97,7 @@ namespace Editor
ImGui::EndMenu();
}

ImGui::EndMenuBar();
ImGui::EndMainMenuBar();
}

ImGuiID DockspaceID = ImGui::GetID("Dockspace");
Expand Down Expand Up @@ -166,7 +165,7 @@ namespace Editor
ImGui::End();
}

void EditorUI::ResetDocking()
void Main::ResetDocking()
{
mResetDock = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@
// [ HEADER ]
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

#include <Aurora.Base/Type.hpp>

#include <imgui.h>
#include <imgui_internal.h>
#include "Core/Frontend/ImGuiBackend.hpp"

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// [ CODE ]
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

namespace Editor
namespace Editor::UI
{
class EditorUI final
class Main final
{
public:

void ShowMainWindow();

void ResetDocking();

private:

Bool mResetDock = true;
Expand Down
15 changes: 15 additions & 0 deletions Foundation/Public/Aurora.Engine/Device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@ namespace Engine
return (SDL_GetWindowFlags(mHandle) & SDL_WINDOW_FULLSCREEN) != 0;
}

// -=(Undocumented)=-
void SetPosition(UInt16 X, UInt16 Y)
{
SDL_SetWindowPosition(mHandle, X, Y);
}

// -=(Undocumented)=-
Vector2i GetPosition() const
{
int X;
int Y;
SDL_GetWindowPosition(mHandle, AddressOf(X), AddressOf(Y));
return Vector2i(X, Y);
}

// -=(Undocumented)=-
void SetSize(UInt16 Width, UInt16 Height)
{
Expand Down

0 comments on commit f5c73b7

Please sign in to comment.