Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ endforeach ()
qt_add_qml_module(
Editor
NO_CACHEGEN
NO_GENERATE_QMLDIR
URI editor
QML_FILES ${QML_SOURCES}
RESOURCES ${RESOURCES}
Expand Down
30 changes: 0 additions & 30 deletions Editor/Include/Editor/Core.h

This file was deleted.

2 changes: 2 additions & 0 deletions Editor/Include/Editor/EditorEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ namespace Editor {

explicit EditorEngine(const Runtime::EngineInitParams& inParams);
};

EditorEngine& GetEditorEngine();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#include <Editor/Widget/QmlWidget.h>

namespace Editor {
class Launcher final : public QmlWidget {
class ProjectHub final : public QmlWidget {
Q_OBJECT

public:
Launcher();
ProjectHub();
};
}
7 changes: 3 additions & 4 deletions Editor/Qml/EButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts
import QtQuick.Effects

Item {
enum Style {
Expand All @@ -29,12 +28,12 @@ Item {
property int shape: EButton.Shape.Rect
signal clicked()

id: 'root'
id: root
implicitWidth: btnWidget.implicitWidth
implicitHeight: btnWidget.implicitHeight

Button {
id: 'btnWidget'
id: btnWidget
enabled: !root.disabled
onClicked: root.clicked()
leftPadding: 10
Expand Down Expand Up @@ -75,7 +74,7 @@ Item {
return focus ? ETheme.primaryFocusColor : (hovered ? ETheme.primaryHoverColor : ETheme.primaryColor);
}

color: getBackgroundColor(root.style, parent.down, parent.hovered, root.disabled)
color: getBackgroundColor(root.style, btnWidget.down, btnWidget.hovered, root.disabled)
radius: 5 + root.shape * 8
}
}
Expand Down
6 changes: 2 additions & 4 deletions Editor/Qml/EIcon.qml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Effects

Item {
property string name: ''
property int size: ETheme.iconFontSize

id: 'root'
id: root
implicitWidth: imageWidget.implicitWidth
implicitHeight: imageWidget.implicitHeight

Image {
id: 'imageWidget'
id: imageWidget
source: root.name === '' ? '' : 'Resource/Icon/%1.svg'.arg(root.name)
sourceSize.width: root.size
sourceSize.height: root.size
Expand Down
1 change: 0 additions & 1 deletion Editor/Qml/ELauncher.qml → Editor/Qml/EProjectHub.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import QtQuick
import QtQuick.Controls

Rectangle {
color: ETheme.bgColor
Expand Down
5 changes: 2 additions & 3 deletions Editor/Qml/EText.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import QtQuick
import QtQuick.Controls

Item {
enum Style {
Expand All @@ -15,7 +14,7 @@ Item {
property string href: ''
property int style: EText.Style.Content

id: 'root'
id: root
implicitWidth: textWidget.implicitWidth
implicitHeight: textWidget.implicitHeight

Expand All @@ -40,7 +39,7 @@ Item {
}
}

id: 'textWidget'
id: textWidget
text: getText(root.text, root.href, root.style)
textFormat: root.style === EText.Style.Link ? Text.RichText : Text.PlainText;
font.italic: root.style === EText.Style.Italic
Expand Down
2 changes: 1 addition & 1 deletion Editor/Qml/EWidgetSamples.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Rectangle {
color: ETheme.bgColor

ScrollView {
id: 'scrollview'
id: scrollview
anchors.fill: parent
anchors.margins: 20

Expand Down
70 changes: 0 additions & 70 deletions Editor/Src/Core.cpp

This file was deleted.

5 changes: 5 additions & 0 deletions Editor/Src/EditorEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ namespace Editor {
: Engine(inParams)
{
}

EditorEngine& GetEditorEngine()
{
return static_cast<EditorEngine&>(Runtime::EngineHolder::Get());
}
}
49 changes: 37 additions & 12 deletions Editor/Src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
#include <QApplication>

#include <Core/Cmdline.h>
#include <Editor/Core.h>
#include <Editor/QmlEngine.h>
#include <Editor/Widget/Launcher.h>
#include <Editor/Widget/ProjectHub.h>
#include <Editor/Widget/WidgetSamples.h>

#if BUILD_CONFIG_DEBUG
Expand All @@ -16,32 +15,58 @@ static ::Core::CmdlineArgValue<bool> caRunSample(
"Whether to run widget samples instead of editor");
#endif

int main(int argc, char* argv[])
static ::Core::CmdlineArgValue<std::string> caRhiType(
"rhiType", "-rhi", RHI::GetPlatformDefaultRHIAbbrString(),
"rhi abbr string, can be 'dx12' or 'vulkan'");

static ::Core::CmdlineArgValue<std::string> caProjectRoot(
"projectRoot", "-project", "",
"project root path");

static void InitializePreQtApp(int argc, char** argv)
{
Editor::Core::Get().Initialize(argc, argv);
Core::Cli::Get().Parse(argc, argv);

QApplication qtApplication(argc, argv);
Runtime::EngineInitParams params {};
params.logToFile = true;
params.gameRoot = caProjectRoot.GetValue();
params.rhiType = caRhiType.GetValue();

Runtime::EngineHolder::Load("Editor", params);
}

static void InitializePostQtApp()
{
Editor::QmlEngine::Get().Start();
}

static void Cleanup()
{
Editor::QmlEngine::Get().Stop();
Runtime::EngineHolder::Unload();
}

auto& qmlEngine = Editor::QmlEngine::Get();
qmlEngine.Start();
int main(int argc, char* argv[])
{
InitializePreQtApp(argc, argv);
QApplication qtApplication(argc, argv);
InitializePostQtApp();

Common::UniquePtr<QWidget> mainWidget;
#if BUILD_CONFIG_DEBUG
if (caRunSample.GetValue()) {
mainWidget = new Editor::WidgetSamples();
} else
#endif
if (!Editor::Core::Get().ProjectHasSet()) { // NOLINT
mainWidget = new Editor::Launcher();
if (caProjectRoot.GetValue().empty()) { // NOLINT
mainWidget = new Editor::ProjectHub();
} else {
// TODO editor main
}
mainWidget->show();

const int execRes = QApplication::exec();
qmlEngine.Stop();

mainWidget = nullptr;
Editor::Core::Get().Cleanup();
Cleanup();
return execRes;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Created by johnk on 2024/6/23.
//

#include <Editor/Widget/Launcher.h>
#include <Editor/Widget/moc_Launcher.cpp> // NOLINT
#include <Editor/Widget/ProjectHub.h>
#include <Editor/Widget/moc_ProjectHub.cpp> // NOLINT

namespace Editor {
Launcher::Launcher()
: QmlWidget("ELauncher.qml")
ProjectHub::ProjectHub()
: QmlWidget("EProjectHub.qml")
{
setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint);
setFixedSize(1024, 768);
Expand Down
10 changes: 6 additions & 4 deletions Engine/Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ if (${BUILD_TEST})
endif()

add_subdirectory(Common)
add_subdirectory(RHI)
add_subdirectory(Mirror)
add_subdirectory(Core)
add_subdirectory(Render)
add_subdirectory(Runtime)
add_subdirectory(Mirror)

add_subdirectory(RHI)
add_subdirectory(RHI-Dummy)
add_subdirectory(RHI-Vulkan)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
add_subdirectory(RHI-DirectX12)
endif()

add_subdirectory(Render)
add_subdirectory(Runtime)
add_subdirectory(Launch)
4 changes: 4 additions & 0 deletions Engine/Source/Common/Include/Common/Delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <vector>
#include <functional>

#include <Common/Utility.h>
#include <Common/Debug.h>

#define IMPL_INDEX_TO_STD_PLACEHOLDER(I) \
Expand All @@ -34,6 +35,9 @@ namespace Common {
template <typename... T>
class Delegate {
public:
NonCopyable(Delegate)
NonMovable(Delegate)

Delegate();

template <auto F> CallbackHandle BindStatic();
Expand Down
1 change: 1 addition & 0 deletions Engine/Source/Common/Include/Common/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace Common {
Path operator+(const Path& inPath) const;
Path operator+(const std::string& inPath) const;
Path operator+(const char* inPath) const;
bool operator==(const Path& inPath) const;

private:
std::filesystem::path path;
Expand Down
Loading
Loading