Skip to content

Commit c923e37

Browse files
Merge pull request #393 from FlyAndNotDown/master
Feat: Misc Update
2 parents 0d4d060 + ddca340 commit c923e37

File tree

30 files changed

+1317
-806
lines changed

30 files changed

+1317
-806
lines changed

CMake/Common.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
set(CMAKE_CXX_STANDARD 20)
2-
set(CMAKE_UNITY_BUILD ON)
3-
41
option(BUILD_EDITOR "Build Explosion editor" ON)
52
option(CI "Build in CI" OFF)
3+
option(USE_UNITY_BUILD "Use unity build" OFF)
4+
5+
set(CMAKE_CXX_STANDARD 20)
6+
set(CMAKE_UNITY_BUILD ${USE_UNITY_BUILD})
67

78
get_cmake_property(GENERATOR_IS_MULTI_CONFIG GENERATOR_IS_MULTI_CONFIG)
89
if (${GENERATOR_IS_MULTI_CONFIG})

Editor/Qml/EFloatInput.qml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import QtQuick
2+
import QtQuick.Controls
3+
import QtQuick.Controls.Basic
4+
5+
ETextField {
6+
property double from: 0.0
7+
property double to: 1.0
8+
9+
id: root
10+
implicitWidth: 100
11+
12+
validator: DoubleValidator {
13+
bottom: root.from
14+
top: root.to
15+
}
16+
}

Editor/Qml/ENumberInput.qml renamed to Editor/Qml/EIntegerInput.qml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ Item {
2424
id: textField
2525
implicitWidth: 40
2626
text: spinBox.textFromValue(spinBox.value)
27+
readOnly: !root.editable
2728
validator: spinBox.validator
29+
onAccepted: {
30+
root.value = spinBox.valueFromText(displayText, Qt.locale())
31+
}
2832
}
2933

3034
down.indicator: Rectangle {
@@ -33,7 +37,7 @@ Item {
3337
implicitWidth: 25
3438
implicitHeight: textField.implicitHeight
3539
radius: 5
36-
color: spinBox.down.hovered ? ETheme.secondaryBgColor : ETheme.primaryBgColor
40+
color: spinBox.down.hovered ? ETheme.primaryColor : ETheme.primaryBgColor
3741

3842
EIcon {
3943
name: 'minus'
@@ -47,7 +51,7 @@ Item {
4751
implicitWidth: 25
4852
implicitHeight: textField.implicitHeight
4953
radius: 5
50-
color: spinBox.up.hovered ? ETheme.secondaryBgColor : ETheme.primaryBgColor
54+
color: spinBox.up.hovered ? ETheme.primaryColor : ETheme.primaryBgColor
5155

5256
EIcon {
5357
name: 'add'

Editor/Qml/ETextField.qml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import QtQuick.Controls
33
import QtQuick.Controls.Basic
44

55
Item {
6+
readonly property string displayText: textField.displayText
67
property string placeHolderText: ''
78
property int wrapMode: TextInput.NoWrap
89
property string text: textField.text
10+
property bool readOnly: textField.readOnly
911
property var validator: null
1012

1113
signal accepted()
@@ -27,6 +29,7 @@ Item {
2729
font.pixelSize: ETheme.contentFontSize
2830
font.family: ETheme.fontFamily
2931
wrapMode: root.wrapMode
32+
readOnly: root.readOnly
3033
validator: root.validator
3134
onAccepted: root.accepted()
3235

Editor/Qml/ETheme.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ QtObject {
66
property color bgColor: Qt.color('#212121')
77
property color primaryBgColor: Qt.color('#3a3939')
88
property color primaryColor: Qt.color('#e74c3c')
9-
property color primaryHoverColor: Qt.color('#ce4d40')
9+
property color primaryHoverColor: Qt.color('#f55b4b')
1010
property color primaryFocusColor: Qt.color('#c0392b')
1111
property color primaryDisabledColor: Qt.color('#4b4a49')
1212
property color secondaryColor: Qt.color('#d58845')
13-
property color secondaryHoverColor: Qt.color('#d58845')
13+
property color secondaryHoverColor: Qt.color('#ec9d58')
1414
property color secondaryFocusColor: Qt.color('#9b6a40')
1515
property color secondaryBgColor: Qt.color('#8e8e8e')
1616
property color disabledColor: Qt.color('#676563')

Editor/Qml/EWidgetSamples.qml

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Rectangle {
147147

148148
RowLayout {
149149
Layout.leftMargin: 5
150-
Layout.topMargin: 35
150+
Layout.topMargin: 15
151151

152152
EText {
153153
text: 'Texts'
@@ -196,7 +196,7 @@ Rectangle {
196196

197197
RowLayout {
198198
Layout.leftMargin: 5
199-
Layout.topMargin: 35
199+
Layout.topMargin: 15
200200

201201
EText {
202202
text: 'Icons'
@@ -276,7 +276,7 @@ Rectangle {
276276

277277
RowLayout {
278278
Layout.leftMargin: 5
279-
Layout.topMargin: 35
279+
Layout.topMargin: 15
280280
EText {
281281
text: 'Switches'
282282
style: EText.Style.Title1
@@ -317,7 +317,7 @@ Rectangle {
317317

318318
RowLayout {
319319
Layout.leftMargin: 5
320-
Layout.topMargin: 35
320+
Layout.topMargin: 15
321321
EText {
322322
text: 'TextInput'
323323
style: EText.Style.Title1
@@ -393,9 +393,9 @@ Rectangle {
393393

394394
RowLayout {
395395
Layout.leftMargin: 5
396-
Layout.topMargin: 35
396+
Layout.topMargin: 15
397397
EText {
398-
text: 'NumberInput'
398+
text: 'IntegerInput'
399399
style: EText.Style.Title1
400400
}
401401
}
@@ -404,7 +404,7 @@ Rectangle {
404404
Layout.margins: 5
405405

406406
RowLayout {
407-
ENumberInput {}
407+
EIntegerInput {}
408408

409409
EText {
410410
Layout.leftMargin: 5
@@ -413,7 +413,7 @@ Rectangle {
413413
}
414414

415415
RowLayout {
416-
ENumberInput {
416+
EIntegerInput {
417417
from: 0
418418
to: 10
419419
}
@@ -423,6 +423,43 @@ Rectangle {
423423
text: 'Limit 0-10'
424424
}
425425
}
426+
427+
RowLayout {
428+
EIntegerInput {
429+
editable: true
430+
}
431+
432+
EText {
433+
Layout.leftMargin: 5
434+
text: 'Editable'
435+
}
436+
}
437+
}
438+
439+
RowLayout {
440+
Layout.leftMargin: 5
441+
Layout.topMargin: 15
442+
EText {
443+
text: 'FloatInput'
444+
style: EText.Style.Title1
445+
}
446+
}
447+
448+
ColumnLayout {
449+
Layout.margins: 5
450+
451+
RowLayout {
452+
EFloatInput {
453+
onAccepted: {
454+
console.log('value accepted, value=' + text)
455+
}
456+
}
457+
458+
EText {
459+
Layout.leftMargin: 5
460+
text: 'Default'
461+
}
462+
}
426463
}
427464
}
428465
}

Editor/Src/Main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <QApplication>
66

77
#include <Core/Cmdline.h>
8+
#include <Runtime/Engine.h>
89
#include <Editor/QmlEngine.h>
910
#include <Editor/Widget/Editor.h>
1011
#include <Editor/Widget/ProjectHub.h>

Editor/Src/Widget/GraphicsSampleWidget.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Created by Kindem on 2025/3/16.
33
//
44

5+
#include <QResizeEvent>
6+
57
#include <Common/Time.h>
68
#include <Editor/Widget/GraphicsSampleWidget.h>
79
#include <Editor/Widget/moc_GraphicsSampleWidget.cpp> // NOLINT
@@ -26,7 +28,7 @@ namespace Editor {
2628
RecreateSwapChain(width(), height());
2729

2830
Render::ShaderCompileOptions shaderCompileOptions;
29-
shaderCompileOptions.includePaths = {"../Shader/Engine"};
31+
shaderCompileOptions.includeDirectories = {"../Shader/Engine"};
3032
shaderCompileOptions.byteCodeType = GetDevice().GetGpu().GetInstance().GetRHIType() == RHI::RHIType::directX12 ? Render::ShaderByteCodeType::dxil : Render::ShaderByteCodeType::spirv;
3133
shaderCompileOptions.withDebugInfo = static_cast<bool>(BUILD_CONFIG_DEBUG); // NOLINT
3234

Editor/Src/Widget/GraphicsWidget.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <Editor/Widget/GraphicsWidget.h>
66
#include <Editor/Widget/moc_GraphicsWidget.cpp> // NOLINT
7+
#include <Render/RenderModule.h>
78

89
namespace Editor {
910
GraphicsWidget::GraphicsWidget(QWidget* inParent)

Engine/Source/Common/Include/Common/Container.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ namespace Common {
2626
template <typename T> static size_t SwapWithLastAndDelete(std::vector<T>& vector, size_t index);
2727
template <typename T> static std::vector<T> GetIntersection(const std::vector<T>& lhs, const std::vector<T>& rhs);
2828
template <typename T> static std::vector<T> GetDifferences(const std::vector<T>& lhs, const std::vector<T>& rhs);
29+
template <typename T> static std::vector<T> Combine(const std::vector<T>& lhs, const std::vector<T>& rhs);
2930
};
3031

3132
class SetUtils {
@@ -335,6 +336,15 @@ namespace Common {
335336
return result;
336337
}
337338

339+
template <typename T>
340+
std::vector<T> VectorUtils::Combine(const std::vector<T>& lhs, const std::vector<T>& rhs)
341+
{
342+
std::vector<T> result;
343+
result.insert(result.end(), lhs.begin(), lhs.end());
344+
result.insert(result.end(), rhs.begin(), rhs.end());
345+
return result;
346+
}
347+
338348
template <typename T>
339349
std::unordered_set<T> SetUtils::GetIntersection(const std::unordered_set<T>& lhs, const std::unordered_set<T>& rhs)
340350
{
@@ -669,7 +679,7 @@ namespace Common {
669679
} else if constexpr (std::is_copy_assignable_v<T>) {
670680
TypedMemory(i) = TypedMemory(i + 1);
671681
} else {
672-
Assert(false);
682+
QuickFail();
673683
}
674684
}
675685
InplaceDestruct(size - 1);
@@ -699,7 +709,7 @@ namespace Common {
699709
} else if constexpr (std::is_copy_assignable_v<T>) {
700710
TypedMemory(inIndex) = TypedMemory(size - 1);
701711
} else {
702-
Assert(false);
712+
QuickFail();
703713
}
704714
InplaceDestruct(size - 1);
705715
size--;
@@ -934,15 +944,15 @@ namespace Common {
934944
} else if constexpr (std::is_copy_constructible_v<T>) {
935945
InplaceConstruct(i, TypedMemory(i - 1));
936946
} else {
937-
Assert(false);
947+
QuickFail();
938948
}
939949
} else {
940950
if constexpr (std::is_move_assignable_v<T>) {
941951
TypedMemory(i) = std::move(TypedMemory(i - 1));
942952
} else if constexpr (std::is_copy_assignable_v<T>) {
943953
TypedMemory(i) = TypedMemory(i - 1);
944954
} else {
945-
Assert(false);
955+
QuickFail();
946956
}
947957
}
948958
}

0 commit comments

Comments
 (0)