diff --git a/QtGameMaker.pro b/QtGameMaker.pro index ff1e3d5..3f4a96c 100644 --- a/QtGameMaker.pro +++ b/QtGameMaker.pro @@ -161,5 +161,9 @@ FORMS += \ src/editor/widgets/actionscontainerwidget.ui RESOURCES += \ - resources_editor.qrc \ - resources_engine.qrc + src/editor/resources_editor.qrc \ + src/engine/resources_engine.qrc + +OTHER_FILES += \ + src/engine/vulkan_shader_modules/color.frag \ + src/engine/vulkan_shader_modules/color.vert diff --git a/resources_engine.qrc b/resources_engine.qrc deleted file mode 100644 index 649f10c..0000000 --- a/resources_engine.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - shader_modules/color_frag.spv - shader_modules/color_vert.spv - - diff --git a/src/editor/dialogs/addeventdialog.ui b/src/editor/dialogs/addeventdialog.ui index f42ec56..bfd4e6b 100644 --- a/src/editor/dialogs/addeventdialog.ui +++ b/src/editor/dialogs/addeventdialog.ui @@ -22,7 +22,7 @@ Dra&w - + :/qtgameengine/icons/event-draw.png:/qtgameengine/icons/event-draw.png @@ -54,7 +54,7 @@ &Step - + :/qtgameengine/icons/event-step.png:/qtgameengine/icons/event-step.png @@ -65,7 +65,7 @@ C&reate - + :/qtgameengine/icons/event-create.png:/qtgameengine/icons/event-create.png @@ -90,7 +90,7 @@ &Destroy - + :/qtgameengine/icons/event-destroy.png:/qtgameengine/icons/event-destroy.png @@ -131,7 +131,7 @@ - + diff --git a/src/editor/dialogs/backgroundpropertiesdialog.ui b/src/editor/dialogs/backgroundpropertiesdialog.ui index 0c855fe..adaee46 100644 --- a/src/editor/dialogs/backgroundpropertiesdialog.ui +++ b/src/editor/dialogs/backgroundpropertiesdialog.ui @@ -14,7 +14,7 @@ Dialog - + :/qtgameengine/icons/background-file.png:/qtgameengine/icons/background-file.png @@ -69,7 +69,7 @@ &Load Background - + :/qtgameengine/icons/open.png:/qtgameengine/icons/open.png @@ -83,7 +83,7 @@ &Save Background - + :/qtgameengine/icons/save.png:/qtgameengine/icons/save.png @@ -97,7 +97,7 @@ &Edit Background - + :/qtgameengine/icons/edit.png:/qtgameengine/icons/edit.png @@ -178,7 +178,7 @@ - + diff --git a/src/editor/dialogs/codeeditordialog.ui b/src/editor/dialogs/codeeditordialog.ui index fb771a8..f97c413 100644 --- a/src/editor/dialogs/codeeditordialog.ui +++ b/src/editor/dialogs/codeeditordialog.ui @@ -14,7 +14,7 @@ Code Editor - + :/qtgameengine/icons/script-file.png:/qtgameengine/icons/script-file.png @@ -225,7 +225,7 @@ - + :/qtgameengine/icons/ok.png:/qtgameengine/icons/ok.png @@ -237,7 +237,7 @@ - + :/qtgameengine/icons/open.png:/qtgameengine/icons/open.png @@ -249,7 +249,7 @@ - + :/qtgameengine/icons/save.png:/qtgameengine/icons/save.png @@ -261,7 +261,7 @@ - + :/qtgameengine/icons/print.png:/qtgameengine/icons/print.png @@ -276,7 +276,7 @@ false - + :/qtgameengine/icons/undo.png:/qtgameengine/icons/undo.png @@ -291,7 +291,7 @@ false - + :/qtgameengine/icons/redo.png:/qtgameengine/icons/redo.png @@ -306,7 +306,7 @@ false - + :/qtgameengine/icons/cut.png:/qtgameengine/icons/cut.png @@ -321,7 +321,7 @@ false - + :/qtgameengine/icons/copy.png:/qtgameengine/icons/copy.png @@ -333,7 +333,7 @@ - + :/qtgameengine/icons/paste.png:/qtgameengine/icons/paste.png @@ -351,7 +351,7 @@ false - + :/qtgameengine/icons/find.png:/qtgameengine/icons/find.png @@ -369,7 +369,7 @@ true - + :/qtgameengine/icons/check.png:/qtgameengine/icons/check.png @@ -388,7 +388,7 @@ - + diff --git a/src/editor/dialogs/editspritedialog.ui b/src/editor/dialogs/editspritedialog.ui index 78ef083..9291543 100644 --- a/src/editor/dialogs/editspritedialog.ui +++ b/src/editor/dialogs/editspritedialog.ui @@ -168,7 +168,7 @@ - + :/qtgameengine/icons/new.png:/qtgameengine/icons/new.png @@ -177,7 +177,7 @@ - + :/qtgameengine/icons/open.png:/qtgameengine/icons/open.png @@ -186,7 +186,7 @@ - + :/qtgameengine/icons/create-group.png:/qtgameengine/icons/create-group.png @@ -198,7 +198,7 @@ - + :/qtgameengine/icons/save.png:/qtgameengine/icons/save.png @@ -223,7 +223,7 @@ - + :/qtgameengine/icons/ok.png:/qtgameengine/icons/ok.png @@ -232,7 +232,7 @@ - + diff --git a/src/editor/dialogs/fontpropertiesdialog.ui b/src/editor/dialogs/fontpropertiesdialog.ui index 69ba919..6abdf5e 100644 --- a/src/editor/dialogs/fontpropertiesdialog.ui +++ b/src/editor/dialogs/fontpropertiesdialog.ui @@ -14,7 +14,7 @@ Font Properties - + :/qtgameengine/icons/font-file.png:/qtgameengine/icons/font-file.png @@ -220,7 +220,7 @@ - + diff --git a/src/editor/dialogs/imageeditordialog.ui b/src/editor/dialogs/imageeditordialog.ui index f52a6f6..084706c 100644 --- a/src/editor/dialogs/imageeditordialog.ui +++ b/src/editor/dialogs/imageeditordialog.ui @@ -178,7 +178,7 @@ - + :/qtgameengine/icons/new.png:/qtgameengine/icons/new.png @@ -190,7 +190,7 @@ - + :/qtgameengine/icons/save.png:/qtgameengine/icons/save.png @@ -202,7 +202,7 @@ - + :/qtgameengine/icons/arrow-left.png:/qtgameengine/icons/arrow-left.png @@ -214,7 +214,7 @@ - + :/qtgameengine/icons/arrow-right.png:/qtgameengine/icons/arrow-right.png @@ -226,7 +226,7 @@ - + :/qtgameengine/icons/ok.png:/qtgameengine/icons/ok.png @@ -238,7 +238,7 @@ - + :/qtgameengine/icons/open.png:/qtgameengine/icons/open.png @@ -247,7 +247,7 @@ - + :/qtgameengine/icons/undo.png:/qtgameengine/icons/undo.png @@ -256,7 +256,7 @@ - + :/qtgameengine/icons/redo.png:/qtgameengine/icons/redo.png @@ -307,7 +307,7 @@ - + diff --git a/src/editor/dialogs/includedfilesdialog.ui b/src/editor/dialogs/includedfilesdialog.ui index 72e0368..a4946f9 100644 --- a/src/editor/dialogs/includedfilesdialog.ui +++ b/src/editor/dialogs/includedfilesdialog.ui @@ -42,7 +42,7 @@ &Add - + :/qtgameengine/icons/add.png:/qtgameengine/icons/add.png @@ -56,7 +56,7 @@ &Change - + :/qtgameengine/icons/replace.png:/qtgameengine/icons/replace.png @@ -70,7 +70,7 @@ &Delete - + :/qtgameengine/icons/delete.png:/qtgameengine/icons/delete.png @@ -84,7 +84,7 @@ &Clear - + :/qtgameengine/icons/new.png:/qtgameengine/icons/new.png @@ -107,7 +107,7 @@ - + diff --git a/src/editor/dialogs/objectinformationdialog.ui b/src/editor/dialogs/objectinformationdialog.ui index 205fdf1..adc3514 100644 --- a/src/editor/dialogs/objectinformationdialog.ui +++ b/src/editor/dialogs/objectinformationdialog.ui @@ -14,7 +14,7 @@ Information about all Objects - + :/qtgameengine/icons/object-file.png:/qtgameengine/icons/object-file.png @@ -58,7 +58,7 @@ - + :/qtgameengine/icons/ok.png:/qtgameengine/icons/ok.png @@ -70,7 +70,7 @@ - + :/qtgameengine/icons/save.png:/qtgameengine/icons/save.png @@ -82,7 +82,7 @@ - + :/qtgameengine/icons/print.png:/qtgameengine/icons/print.png @@ -94,7 +94,7 @@ - + diff --git a/src/editor/dialogs/objectpropertiesdialog.ui b/src/editor/dialogs/objectpropertiesdialog.ui index 7f20d83..8357af7 100644 --- a/src/editor/dialogs/objectpropertiesdialog.ui +++ b/src/editor/dialogs/objectpropertiesdialog.ui @@ -14,7 +14,7 @@ Object Properties - + :/qtgameengine/icons/object-file.png:/qtgameengine/icons/object-file.png @@ -305,7 +305,7 @@ Show Information - + :/qtgameengine/icons/info.png:/qtgameengine/icons/info.png @@ -421,7 +421,7 @@ - + diff --git a/src/editor/dialogs/pathpropertiesdialog.ui b/src/editor/dialogs/pathpropertiesdialog.ui index 2bd5b28..4ef13f3 100644 --- a/src/editor/dialogs/pathpropertiesdialog.ui +++ b/src/editor/dialogs/pathpropertiesdialog.ui @@ -14,7 +14,7 @@ Path Properties - + :/qtgameengine/icons/path-file.png:/qtgameengine/icons/path-file.png @@ -412,7 +412,7 @@ - + :/qtgameengine/icons/ok.png:/qtgameengine/icons/ok.png @@ -424,7 +424,7 @@ - + :/qtgameengine/icons/undo.png:/qtgameengine/icons/undo.png @@ -436,7 +436,7 @@ - + :/qtgameengine/icons/new.png:/qtgameengine/icons/new.png @@ -448,7 +448,7 @@ - + :/qtgameengine/icons/rotate.png:/qtgameengine/icons/rotate.png @@ -460,7 +460,7 @@ - + :/qtgameengine/icons/move.png:/qtgameengine/icons/move.png @@ -472,7 +472,7 @@ - + :/qtgameengine/icons/flip-horizontal.png:/qtgameengine/icons/flip-horizontal.png @@ -484,7 +484,7 @@ - + :/qtgameengine/icons/flip-vertical.png:/qtgameengine/icons/flip-vertical.png @@ -496,7 +496,7 @@ - + :/qtgameengine/icons/rotate.png:/qtgameengine/icons/rotate.png @@ -508,7 +508,7 @@ - + :/qtgameengine/icons/scale.png:/qtgameengine/icons/scale.png @@ -520,7 +520,7 @@ - + :/qtgameengine/icons/arrow-left.png:/qtgameengine/icons/arrow-left.png @@ -532,7 +532,7 @@ - + :/qtgameengine/icons/arrow-right.png:/qtgameengine/icons/arrow-right.png @@ -544,7 +544,7 @@ - + :/qtgameengine/icons/arrow-up.png:/qtgameengine/icons/arrow-up.png @@ -556,7 +556,7 @@ - + :/qtgameengine/icons/arrow-down.png:/qtgameengine/icons/arrow-down.png @@ -568,7 +568,7 @@ - + :/qtgameengine/icons/center.png:/qtgameengine/icons/center.png @@ -586,7 +586,7 @@ true - + :/qtgameengine/icons/grid.png:/qtgameengine/icons/grid.png @@ -606,7 +606,7 @@ - + diff --git a/src/editor/dialogs/roompropertiesdialog.ui b/src/editor/dialogs/roompropertiesdialog.ui index a9788c7..2288602 100644 --- a/src/editor/dialogs/roompropertiesdialog.ui +++ b/src/editor/dialogs/roompropertiesdialog.ui @@ -14,7 +14,7 @@ Room Properties - + :/qtgameengine/icons/room-file.png:/qtgameengine/icons/room-file.png @@ -92,295 +92,296 @@ - - - - - QTabWidget::West - - - 0 - - - - &Objects - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true + + + Qt::Horizontal + + + + QTabWidget::West + + + 0 + + + + &Objects + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 683 + 333 + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - 0 - 0 - 222 - 331 - + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Object to add with left mouse: + + + + + + + + + true + + + + + + + ... + + + QToolButton::InstantPopup + + + + + + + + + Left mouse button = add<br/> + &lt;Alt&gt; = no snap<br/> + &lt;Shift&gt; = multiple<br/> + &lt;Ctrl&gt; = move<br/>Right mouse button = delete<br/> + &lt;Shift&gt; = delete all<br/> + &lt;Ctrl&gt; = popup menu + + + + + + + Delete underlaying + + + true + + + + + + + + + + + &Settings + + + + + + + + &Name: - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + lineEditName - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Object to add with left mouse: - - - - - - - - - true - - - - - - - ... - - - QToolButton::InstantPopup - - - - - - - - - Left mouse button = add<br/> + &lt;Alt&gt; = no snap<br/> + &lt;Shift&gt; = multiple<br/> + &lt;Ctrl&gt; = move<br/>Right mouse button = delete<br/> + &lt;Shift&gt; = delete all<br/> + &lt;Ctrl&gt; = popup menu - - - - - - - Delete underlaying - - - true - - - - - - - - - - - &Settings - - - - - - - - &Name: - - - lineEditName - - - - - - - - - - - - &Caption for the room: - - - lineEditCaption - - - - - - - - - - - - &Width: - - - spinBoxWidth - - - - - - - 2147483647 - - - 640 - - - - - - - &Height: - - - spinBoxHeight - - - - - - - 2147483647 - - - 480 - - - - - - - S&peed: - - - spinBoxSpeed - - - - - - - 2147483647 - - - 30 - - - - - - - - - P&ersistent - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - CreationCode - - - - :/qtgameengine/icons/script.png:/qtgameengine/icons/script.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - &Tiles - - - - - &Backgrounds - - - - - &Views - - + + + + + + + + + + &Caption for the room: + + + lineEditCaption + + + + + + + + + + + + &Width: + + + spinBoxWidth + + + + + + + 2147483647 + + + 640 + + + + + + + &Height: + + + spinBoxHeight + + + + + + + 2147483647 + + + 480 + + + + + + + S&peed: + + + spinBoxSpeed + + + + + + + 2147483647 + + + 30 + + + + + + + + + P&ersistent + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + CreationCode + + + + :/qtgameengine/icons/script.png:/qtgameengine/icons/script.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + - - - + + + &Tiles + + + + + &Backgrounds + + + + + &Views + + + + + @@ -402,13 +403,13 @@ - - + + - + :/qtgameengine/icons/ok.png:/qtgameengine/icons/ok.png @@ -420,7 +421,7 @@ - + :/qtgameengine/icons/undo.png:/qtgameengine/icons/undo.png @@ -432,7 +433,7 @@ - + :/qtgameengine/icons/new.png:/qtgameengine/icons/new.png @@ -444,7 +445,7 @@ - + :/qtgameengine/icons/arrow-right.png:/qtgameengine/icons/arrow-right.png @@ -456,7 +457,7 @@ - + :/qtgameengine/icons/sort-x.png:/qtgameengine/icons/sort-x.png @@ -468,7 +469,7 @@ - + :/qtgameengine/icons/sort-y.png:/qtgameengine/icons/sort-y.png @@ -480,7 +481,7 @@ - + :/qtgameengine/icons/lock.png:/qtgameengine/icons/lock.png @@ -492,7 +493,7 @@ - + :/qtgameengine/icons/unlock.png:/qtgameengine/icons/unlock.png @@ -510,7 +511,7 @@ true - + :/qtgameengine/icons/grid.png:/qtgameengine/icons/grid.png @@ -525,7 +526,7 @@ true - + :/qtgameengine/icons/isometric.png:/qtgameengine/icons/isometric.png @@ -608,7 +609,7 @@ - + diff --git a/src/editor/dialogs/soundpropertiesdialog.ui b/src/editor/dialogs/soundpropertiesdialog.ui index e40cde2..b0fcdd1 100644 --- a/src/editor/dialogs/soundpropertiesdialog.ui +++ b/src/editor/dialogs/soundpropertiesdialog.ui @@ -14,7 +14,7 @@ Sound Properties - + :/qtgameengine/icons/sound-file.png:/qtgameengine/icons/sound-file.png @@ -50,7 +50,7 @@ &Load Sound - + :/qtgameengine/icons/open.png:/qtgameengine/icons/open.png @@ -64,7 +64,7 @@ - + :/qtgameengine/icons/run.png:/qtgameengine/icons/run.png @@ -78,7 +78,7 @@ - + :/qtgameengine/icons/exit.png:/qtgameengine/icons/exit.png @@ -94,7 +94,7 @@ Sa&ve Sound - + :/qtgameengine/icons/save.png:/qtgameengine/icons/save.png @@ -292,7 +292,7 @@ &Edit Sound - + :/qtgameengine/icons/sound.png:/qtgameengine/icons/sound.png @@ -325,7 +325,7 @@ - + diff --git a/src/editor/dialogs/spritepropertiesdialog.ui b/src/editor/dialogs/spritepropertiesdialog.ui index 641aaea..3fd0c6d 100644 --- a/src/editor/dialogs/spritepropertiesdialog.ui +++ b/src/editor/dialogs/spritepropertiesdialog.ui @@ -14,7 +14,7 @@ Sprite Properties - + :/qtgameengine/icons/sprite-file.png:/qtgameengine/icons/sprite-file.png @@ -67,7 +67,7 @@ &Load Sprite - + :/qtgameengine/icons/open.png:/qtgameengine/icons/open.png @@ -81,7 +81,7 @@ &Save Sprite - + :/qtgameengine/icons/save.png:/qtgameengine/icons/save.png @@ -95,7 +95,7 @@ &Edit Sprite - + :/qtgameengine/icons/edit.png:/qtgameengine/icons/edit.png @@ -339,7 +339,7 @@ - + diff --git a/src/editor/dialogs/timelinepropertiesdialog.ui b/src/editor/dialogs/timelinepropertiesdialog.ui index a0f83ff..3b32b63 100644 --- a/src/editor/dialogs/timelinepropertiesdialog.ui +++ b/src/editor/dialogs/timelinepropertiesdialog.ui @@ -14,7 +14,7 @@ Time Line Properties - + :/qtgameengine/icons/timeline-file.png:/qtgameengine/icons/timeline-file.png @@ -61,7 +61,7 @@ &Add - + :/qtgameengine/icons/add.png:/qtgameengine/icons/add.png @@ -75,7 +75,7 @@ &Change - + :/qtgameengine/icons/replace.png:/qtgameengine/icons/replace.png @@ -89,7 +89,7 @@ &Delete - + :/qtgameengine/icons/delete.png:/qtgameengine/icons/delete.png @@ -103,7 +103,7 @@ &Shift - + :/qtgameengine/icons/arrow-right.png:/qtgameengine/icons/arrow-right.png @@ -117,7 +117,7 @@ C&lear - + :/qtgameengine/icons/new.png:/qtgameengine/icons/new.png @@ -131,7 +131,7 @@ D&uplicate - + :/qtgameengine/icons/copy.png:/qtgameengine/icons/copy.png @@ -158,7 +158,7 @@ S&pread - + :/qtgameengine/icons/scale.png:/qtgameengine/icons/scale.png @@ -172,7 +172,7 @@ &Merge - + :/qtgameengine/icons/merge.png:/qtgameengine/icons/merge.png @@ -201,7 +201,7 @@ Show &Information - + :/qtgameengine/icons/info.png:/qtgameengine/icons/info.png @@ -278,7 +278,7 @@ - + diff --git a/src/editor/dialogs/triggersdialog.ui b/src/editor/dialogs/triggersdialog.ui index 9c9606d..45d1ed5 100644 --- a/src/editor/dialogs/triggersdialog.ui +++ b/src/editor/dialogs/triggersdialog.ui @@ -40,7 +40,7 @@ &Load - + :/qtgameengine/icons/open.png:/qtgameengine/icons/open.png @@ -54,7 +54,7 @@ &Delete - + :/qtgameengine/icons/delete.png:/qtgameengine/icons/delete.png @@ -68,7 +68,7 @@ &Add - + :/qtgameengine/icons/add.png:/qtgameengine/icons/add.png @@ -82,7 +82,7 @@ &Clear - + :/qtgameengine/icons/new.png:/qtgameengine/icons/new.png @@ -96,7 +96,7 @@ &Save - + :/qtgameengine/icons/save.png:/qtgameengine/icons/save.png @@ -246,7 +246,7 @@ - + diff --git a/src/editor/dialogs/userdefinedconstantsdialog.ui b/src/editor/dialogs/userdefinedconstantsdialog.ui index df1486d..218bf26 100644 --- a/src/editor/dialogs/userdefinedconstantsdialog.ui +++ b/src/editor/dialogs/userdefinedconstantsdialog.ui @@ -14,7 +14,7 @@ User-Defined Constants - + :/qtgameengine/icons/constants.png:/qtgameengine/icons/constants.png @@ -39,7 +39,7 @@ &Insert - + :/qtgameengine/icons/add.png:/qtgameengine/icons/add.png @@ -53,7 +53,7 @@ &Sort - + :/qtgameengine/icons/sort.png:/qtgameengine/icons/sort.png @@ -67,7 +67,7 @@ &Delete - + :/qtgameengine/icons/delete.png:/qtgameengine/icons/delete.png @@ -81,7 +81,7 @@ &Load - + :/qtgameengine/icons/open.png:/qtgameengine/icons/open.png @@ -95,7 +95,7 @@ &Up - + :/qtgameengine/icons/arrow-up.png:/qtgameengine/icons/arrow-up.png @@ -109,7 +109,7 @@ &Add - + :/qtgameengine/icons/add.png:/qtgameengine/icons/add.png @@ -123,7 +123,7 @@ &Clear - + :/qtgameengine/icons/new.png:/qtgameengine/icons/new.png @@ -137,7 +137,7 @@ Do&wn - + :/qtgameengine/icons/arrow-down.png:/qtgameengine/icons/arrow-down.png @@ -151,7 +151,7 @@ Sa&ve - + :/qtgameengine/icons/save.png:/qtgameengine/icons/save.png @@ -174,7 +174,7 @@ - + diff --git a/icons/action.png b/src/editor/icons/action.png similarity index 100% rename from icons/action.png rename to src/editor/icons/action.png diff --git a/icons/add.png b/src/editor/icons/add.png similarity index 100% rename from icons/add.png rename to src/editor/icons/add.png diff --git a/icons/arrow-down.png b/src/editor/icons/arrow-down.png similarity index 100% rename from icons/arrow-down.png rename to src/editor/icons/arrow-down.png diff --git a/icons/arrow-left.png b/src/editor/icons/arrow-left.png similarity index 100% rename from icons/arrow-left.png rename to src/editor/icons/arrow-left.png diff --git a/icons/arrow-right.png b/src/editor/icons/arrow-right.png similarity index 100% rename from icons/arrow-right.png rename to src/editor/icons/arrow-right.png diff --git a/icons/arrow-up.png b/src/editor/icons/arrow-up.png similarity index 100% rename from icons/arrow-up.png rename to src/editor/icons/arrow-up.png diff --git a/icons/background-file.png b/src/editor/icons/background-file.png similarity index 100% rename from icons/background-file.png rename to src/editor/icons/background-file.png diff --git a/icons/background.png b/src/editor/icons/background.png similarity index 100% rename from icons/background.png rename to src/editor/icons/background.png diff --git a/icons/cascade.png b/src/editor/icons/cascade.png similarity index 100% rename from icons/cascade.png rename to src/editor/icons/cascade.png diff --git a/icons/center.png b/src/editor/icons/center.png similarity index 100% rename from icons/center.png rename to src/editor/icons/center.png diff --git a/icons/check.png b/src/editor/icons/check.png similarity index 100% rename from icons/check.png rename to src/editor/icons/check.png diff --git a/icons/code-action.png b/src/editor/icons/code-action.png similarity index 100% rename from icons/code-action.png rename to src/editor/icons/code-action.png diff --git a/icons/constants.png b/src/editor/icons/constants.png similarity index 100% rename from icons/constants.png rename to src/editor/icons/constants.png diff --git a/icons/copy.png b/src/editor/icons/copy.png similarity index 100% rename from icons/copy.png rename to src/editor/icons/copy.png diff --git a/icons/create-executable.png b/src/editor/icons/create-executable.png similarity index 100% rename from icons/create-executable.png rename to src/editor/icons/create-executable.png diff --git a/icons/create-group.png b/src/editor/icons/create-group.png similarity index 100% rename from icons/create-group.png rename to src/editor/icons/create-group.png diff --git a/icons/create.png b/src/editor/icons/create.png similarity index 100% rename from icons/create.png rename to src/editor/icons/create.png diff --git a/icons/cut.png b/src/editor/icons/cut.png similarity index 100% rename from icons/cut.png rename to src/editor/icons/cut.png diff --git a/icons/debug.png b/src/editor/icons/debug.png similarity index 100% rename from icons/debug.png rename to src/editor/icons/debug.png diff --git a/icons/delete.png b/src/editor/icons/delete.png similarity index 100% rename from icons/delete.png rename to src/editor/icons/delete.png diff --git a/icons/duplicate.png b/src/editor/icons/duplicate.png similarity index 100% rename from icons/duplicate.png rename to src/editor/icons/duplicate.png diff --git a/icons/edit.png b/src/editor/icons/edit.png similarity index 100% rename from icons/edit.png rename to src/editor/icons/edit.png diff --git a/icons/event-create.png b/src/editor/icons/event-create.png similarity index 100% rename from icons/event-create.png rename to src/editor/icons/event-create.png diff --git a/icons/event-destroy.png b/src/editor/icons/event-destroy.png similarity index 100% rename from icons/event-destroy.png rename to src/editor/icons/event-destroy.png diff --git a/icons/event-draw.png b/src/editor/icons/event-draw.png similarity index 100% rename from icons/event-draw.png rename to src/editor/icons/event-draw.png diff --git a/icons/event-step.png b/src/editor/icons/event-step.png similarity index 100% rename from icons/event-step.png rename to src/editor/icons/event-step.png diff --git a/icons/exit.png b/src/editor/icons/exit.png similarity index 100% rename from icons/exit.png rename to src/editor/icons/exit.png diff --git a/icons/export-resources.png b/src/editor/icons/export-resources.png similarity index 100% rename from icons/export-resources.png rename to src/editor/icons/export-resources.png diff --git a/icons/extension-packages-file.png b/src/editor/icons/extension-packages-file.png similarity index 100% rename from icons/extension-packages-file.png rename to src/editor/icons/extension-packages-file.png diff --git a/icons/extension-packages.png b/src/editor/icons/extension-packages.png similarity index 100% rename from icons/extension-packages.png rename to src/editor/icons/extension-packages.png diff --git a/icons/file.png b/src/editor/icons/file.png similarity index 100% rename from icons/file.png rename to src/editor/icons/file.png diff --git a/icons/find.png b/src/editor/icons/find.png similarity index 100% rename from icons/find.png rename to src/editor/icons/find.png diff --git a/icons/flip-horizontal.png b/src/editor/icons/flip-horizontal.png similarity index 100% rename from icons/flip-horizontal.png rename to src/editor/icons/flip-horizontal.png diff --git a/icons/flip-vertical.png b/src/editor/icons/flip-vertical.png similarity index 100% rename from icons/flip-vertical.png rename to src/editor/icons/flip-vertical.png diff --git a/icons/folder.png b/src/editor/icons/folder.png similarity index 100% rename from icons/folder.png rename to src/editor/icons/folder.png diff --git a/icons/font-file.png b/src/editor/icons/font-file.png similarity index 100% rename from icons/font-file.png rename to src/editor/icons/font-file.png diff --git a/icons/font.png b/src/editor/icons/font.png similarity index 100% rename from icons/font.png rename to src/editor/icons/font.png diff --git a/icons/game-information-file.png b/src/editor/icons/game-information-file.png similarity index 100% rename from icons/game-information-file.png rename to src/editor/icons/game-information-file.png diff --git a/icons/game-information.png b/src/editor/icons/game-information.png similarity index 100% rename from icons/game-information.png rename to src/editor/icons/game-information.png diff --git a/icons/global-game-settings-file.png b/src/editor/icons/global-game-settings-file.png similarity index 100% rename from icons/global-game-settings-file.png rename to src/editor/icons/global-game-settings-file.png diff --git a/icons/global-game-settings.png b/src/editor/icons/global-game-settings.png similarity index 100% rename from icons/global-game-settings.png rename to src/editor/icons/global-game-settings.png diff --git a/icons/grid.png b/src/editor/icons/grid.png similarity index 100% rename from icons/grid.png rename to src/editor/icons/grid.png diff --git a/icons/help.png b/src/editor/icons/help.png similarity index 100% rename from icons/help.png rename to src/editor/icons/help.png diff --git a/icons/import-resources.png b/src/editor/icons/import-resources.png similarity index 100% rename from icons/import-resources.png rename to src/editor/icons/import-resources.png diff --git a/icons/info.png b/src/editor/icons/info.png similarity index 100% rename from icons/info.png rename to src/editor/icons/info.png diff --git a/icons/isometric.png b/src/editor/icons/isometric.png similarity index 100% rename from icons/isometric.png rename to src/editor/icons/isometric.png diff --git a/icons/lock.png b/src/editor/icons/lock.png similarity index 100% rename from icons/lock.png rename to src/editor/icons/lock.png diff --git a/icons/merge.png b/src/editor/icons/merge.png similarity index 100% rename from icons/merge.png rename to src/editor/icons/merge.png diff --git a/icons/move.png b/src/editor/icons/move.png similarity index 100% rename from icons/move.png rename to src/editor/icons/move.png diff --git a/icons/music-file.png b/src/editor/icons/music-file.png similarity index 100% rename from icons/music-file.png rename to src/editor/icons/music-file.png diff --git a/icons/new.png b/src/editor/icons/new.png similarity index 100% rename from icons/new.png rename to src/editor/icons/new.png diff --git a/icons/object-file.png b/src/editor/icons/object-file.png similarity index 100% rename from icons/object-file.png rename to src/editor/icons/object-file.png diff --git a/icons/object.png b/src/editor/icons/object.png similarity index 100% rename from icons/object.png rename to src/editor/icons/object.png diff --git a/icons/ok.png b/src/editor/icons/ok.png similarity index 100% rename from icons/ok.png rename to src/editor/icons/ok.png diff --git a/icons/open.png b/src/editor/icons/open.png similarity index 100% rename from icons/open.png rename to src/editor/icons/open.png diff --git a/icons/paste.png b/src/editor/icons/paste.png similarity index 100% rename from icons/paste.png rename to src/editor/icons/paste.png diff --git a/icons/path-file.png b/src/editor/icons/path-file.png similarity index 100% rename from icons/path-file.png rename to src/editor/icons/path-file.png diff --git a/icons/path.png b/src/editor/icons/path.png similarity index 100% rename from icons/path.png rename to src/editor/icons/path.png diff --git a/icons/preferences.png b/src/editor/icons/preferences.png similarity index 100% rename from icons/preferences.png rename to src/editor/icons/preferences.png diff --git a/icons/print.png b/src/editor/icons/print.png similarity index 100% rename from icons/print.png rename to src/editor/icons/print.png diff --git a/icons/properties.png b/src/editor/icons/properties.png similarity index 100% rename from icons/properties.png rename to src/editor/icons/properties.png diff --git a/icons/publish-game.png b/src/editor/icons/publish-game.png similarity index 100% rename from icons/publish-game.png rename to src/editor/icons/publish-game.png diff --git a/icons/redo.png b/src/editor/icons/redo.png similarity index 100% rename from icons/redo.png rename to src/editor/icons/redo.png diff --git a/icons/rename.png b/src/editor/icons/rename.png similarity index 100% rename from icons/rename.png rename to src/editor/icons/rename.png diff --git a/icons/replace.png b/src/editor/icons/replace.png similarity index 100% rename from icons/replace.png rename to src/editor/icons/replace.png diff --git a/icons/room-file.png b/src/editor/icons/room-file.png similarity index 100% rename from icons/room-file.png rename to src/editor/icons/room-file.png diff --git a/icons/room.png b/src/editor/icons/room.png similarity index 100% rename from icons/room.png rename to src/editor/icons/room.png diff --git a/icons/rotate.png b/src/editor/icons/rotate.png similarity index 100% rename from icons/rotate.png rename to src/editor/icons/rotate.png diff --git a/icons/run.png b/src/editor/icons/run.png similarity index 100% rename from icons/run.png rename to src/editor/icons/run.png diff --git a/icons/save-as.png b/src/editor/icons/save-as.png similarity index 100% rename from icons/save-as.png rename to src/editor/icons/save-as.png diff --git a/icons/save.png b/src/editor/icons/save.png similarity index 100% rename from icons/save.png rename to src/editor/icons/save.png diff --git a/icons/scale.png b/src/editor/icons/scale.png similarity index 100% rename from icons/scale.png rename to src/editor/icons/scale.png diff --git a/icons/script-file.png b/src/editor/icons/script-file.png similarity index 100% rename from icons/script-file.png rename to src/editor/icons/script-file.png diff --git a/icons/script.png b/src/editor/icons/script.png similarity index 100% rename from icons/script.png rename to src/editor/icons/script.png diff --git a/icons/sort-x.png b/src/editor/icons/sort-x.png similarity index 100% rename from icons/sort-x.png rename to src/editor/icons/sort-x.png diff --git a/icons/sort-y.png b/src/editor/icons/sort-y.png similarity index 100% rename from icons/sort-y.png rename to src/editor/icons/sort-y.png diff --git a/icons/sort.png b/src/editor/icons/sort.png similarity index 100% rename from icons/sort.png rename to src/editor/icons/sort.png diff --git a/icons/sound-file.png b/src/editor/icons/sound-file.png similarity index 100% rename from icons/sound-file.png rename to src/editor/icons/sound-file.png diff --git a/icons/sound-file2.png b/src/editor/icons/sound-file2.png similarity index 100% rename from icons/sound-file2.png rename to src/editor/icons/sound-file2.png diff --git a/icons/sound.png b/src/editor/icons/sound.png similarity index 100% rename from icons/sound.png rename to src/editor/icons/sound.png diff --git a/icons/sprite-file.png b/src/editor/icons/sprite-file.png similarity index 100% rename from icons/sprite-file.png rename to src/editor/icons/sprite-file.png diff --git a/icons/sprite.png b/src/editor/icons/sprite.png similarity index 100% rename from icons/sprite.png rename to src/editor/icons/sprite.png diff --git a/icons/tile.png b/src/editor/icons/tile.png similarity index 100% rename from icons/tile.png rename to src/editor/icons/tile.png diff --git a/icons/timeline-file.png b/src/editor/icons/timeline-file.png similarity index 100% rename from icons/timeline-file.png rename to src/editor/icons/timeline-file.png diff --git a/icons/timeline.png b/src/editor/icons/timeline.png similarity index 100% rename from icons/timeline.png rename to src/editor/icons/timeline.png diff --git a/icons/undo.png b/src/editor/icons/undo.png similarity index 100% rename from icons/undo.png rename to src/editor/icons/undo.png diff --git a/icons/unlock.png b/src/editor/icons/unlock.png similarity index 100% rename from icons/unlock.png rename to src/editor/icons/unlock.png diff --git a/src/editor/mainwindow.ui b/src/editor/mainwindow.ui index 85deec2..94224f1 100644 --- a/src/editor/mainwindow.ui +++ b/src/editor/mainwindow.ui @@ -264,7 +264,7 @@ - + :/qtgameengine/icons/new.png:/qtgameengine/icons/new.png @@ -273,7 +273,7 @@ - + :/qtgameengine/icons/open.png:/qtgameengine/icons/open.png @@ -282,7 +282,7 @@ - + :/qtgameengine/icons/save.png:/qtgameengine/icons/save.png @@ -291,7 +291,7 @@ - + :/qtgameengine/icons/save-as.png:/qtgameengine/icons/save-as.png @@ -300,7 +300,7 @@ - + :/qtgameengine/icons/create-executable.png:/qtgameengine/icons/create-executable.png @@ -309,7 +309,7 @@ - + :/qtgameengine/icons/publish-game.png:/qtgameengine/icons/publish-game.png @@ -318,7 +318,7 @@ - + :/qtgameengine/icons/import-resources.png:/qtgameengine/icons/import-resources.png @@ -327,7 +327,7 @@ - + :/qtgameengine/icons/export-resources.png:/qtgameengine/icons/export-resources.png @@ -347,7 +347,7 @@ - + :/qtgameengine/icons/preferences.png:/qtgameengine/icons/preferences.png @@ -359,7 +359,7 @@ - + :/qtgameengine/icons/exit.png:/qtgameengine/icons/exit.png @@ -379,7 +379,7 @@ - + :/qtgameengine/icons/create.png:/qtgameengine/icons/create.png @@ -388,7 +388,7 @@ - + :/qtgameengine/icons/duplicate.png:/qtgameengine/icons/duplicate.png @@ -400,7 +400,7 @@ - + :/qtgameengine/icons/create-group.png:/qtgameengine/icons/create-group.png @@ -414,7 +414,7 @@ - + :/qtgameengine/icons/delete.png:/qtgameengine/icons/delete.png @@ -423,7 +423,7 @@ - + :/qtgameengine/icons/rename.png:/qtgameengine/icons/rename.png @@ -432,7 +432,7 @@ - + :/qtgameengine/icons/properties.png:/qtgameengine/icons/properties.png @@ -444,7 +444,7 @@ - + :/qtgameengine/icons/find.png:/qtgameengine/icons/find.png @@ -463,7 +463,7 @@ - + :/qtgameengine/icons/object-file.png:/qtgameengine/icons/object-file.png @@ -472,7 +472,7 @@ - + :/qtgameengine/icons/sprite.png:/qtgameengine/icons/sprite.png @@ -484,7 +484,7 @@ - + :/qtgameengine/icons/sound.png:/qtgameengine/icons/sound.png @@ -496,7 +496,7 @@ - + :/qtgameengine/icons/background.png:/qtgameengine/icons/background.png @@ -508,7 +508,7 @@ - + :/qtgameengine/icons/path.png:/qtgameengine/icons/path.png @@ -520,7 +520,7 @@ - + :/qtgameengine/icons/script.png:/qtgameengine/icons/script.png @@ -532,7 +532,7 @@ - + :/qtgameengine/icons/font.png:/qtgameengine/icons/font.png @@ -544,7 +544,7 @@ - + :/qtgameengine/icons/timeline.png:/qtgameengine/icons/timeline.png @@ -556,7 +556,7 @@ - + :/qtgameengine/icons/object.png:/qtgameengine/icons/object.png @@ -568,7 +568,7 @@ - + :/qtgameengine/icons/room.png:/qtgameengine/icons/room.png @@ -580,7 +580,7 @@ - + :/qtgameengine/icons/game-information.png:/qtgameengine/icons/game-information.png @@ -592,7 +592,7 @@ - + :/qtgameengine/icons/global-game-settings.png:/qtgameengine/icons/global-game-settings.png @@ -604,7 +604,7 @@ - + :/qtgameengine/icons/extension-packages.png:/qtgameengine/icons/extension-packages.png @@ -616,7 +616,7 @@ - + :/qtgameengine/icons/constants.png:/qtgameengine/icons/constants.png @@ -644,7 +644,7 @@ - + :/qtgameengine/icons/run.png:/qtgameengine/icons/run.png @@ -656,7 +656,7 @@ - + :/qtgameengine/icons/debug.png:/qtgameengine/icons/debug.png @@ -673,7 +673,7 @@ - + :/qtgameengine/icons/help.png:/qtgameengine/icons/help.png @@ -783,7 +783,7 @@ - + :/qtgameengine/icons/tile.png:/qtgameengine/icons/tile.png @@ -792,7 +792,7 @@ - + :/qtgameengine/icons/cascade.png:/qtgameengine/icons/cascade.png @@ -827,7 +827,7 @@ - + diff --git a/resources_editor.qrc b/src/editor/resources_editor.qrc similarity index 100% rename from resources_editor.qrc rename to src/editor/resources_editor.qrc diff --git a/src/editor/widgets/actionscontainerwidget.ui b/src/editor/widgets/actionscontainerwidget.ui index 6dfa5af..9c3067e 100644 --- a/src/editor/widgets/actionscontainerwidget.ui +++ b/src/editor/widgets/actionscontainerwidget.ui @@ -60,34 +60,98 @@ - - - 0 + + + QTabWidget::East - - - - 0 - 0 - 136 - 242 - - - - Page 1 + + + Move + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + ... + + + + + + + + Main1 - - - - 0 - 0 - 136 - 242 - - - - Page 2 + + + Main2 + + + + + Control + + + + + Score + + + + + Extra + + + + + Draw + + + + + Move and Room + + + + + Save, Load, and Mouse + + + + + Draw+Sprite+Background + + + + + Date + + + + + Breakout diff --git a/src/editor/widgets/roomeditwidget.h b/src/editor/widgets/roomeditwidget.h index ffaf8a3..4e3896e 100644 --- a/src/editor/widgets/roomeditwidget.h +++ b/src/editor/widgets/roomeditwidget.h @@ -5,6 +5,8 @@ #include +struct Object; + class RoomEditWidget : public QWidget { Q_OBJECT @@ -31,6 +33,9 @@ public: QPalette::ColorRole gridRole() const { return m_gridRole; } void setGridRole(QPalette::ColorRole gridRole); + const Object *selectedObject() const { return m_selectedObject; } + void setSelectedObject(const Object *object) { m_selectedObject = object; update(); } + signals: void snapXChanged(int snapX); void snapYChanged(int snapY); @@ -53,6 +58,8 @@ private: bool m_gridEnabled{true}; bool m_isometricGrid{false}; + const Object *m_selectedObject{}; + struct GridBrush { int snapX; int snapY; diff --git a/src/engine/glgamewindow.cpp b/src/engine/glgamewindow.cpp index 6cd1181..b2743c8 100644 --- a/src/engine/glgamewindow.cpp +++ b/src/engine/glgamewindow.cpp @@ -27,24 +27,10 @@ void GlGameWindow::initialize() m_program = new QOpenGLShaderProgram{this}; - const char vertexShaderSource[] = - "attribute highp vec4 posAttr;\n" - "attribute lowp vec4 colAttr;\n" - "varying lowp vec4 col;\n" - "uniform highp mat4 matrix;\n" - "void main() {\n" - " col = colAttr;\n" - " gl_Position = matrix * posAttr;\n" - "}\n"; - m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, vertexShaderSource); - - - const char fragmentShaderSource[] = - "varying lowp vec4 col;\n" - "void main() {\n" - " gl_FragColor = col;\n" - "}\n"; - m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShaderSource); + if (!m_program->addShaderFromSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qtgameengine/opengl_shaders/color.vert"))) + qFatal("could not load vertex shader"); + if (!m_program->addShaderFromSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qtgameengine/opengl_shaders/color.frag"))) + qFatal("could not load fragment shader"); m_program->link(); diff --git a/src/engine/opengl_shaders/color.frag b/src/engine/opengl_shaders/color.frag new file mode 100644 index 0000000..862c7e1 --- /dev/null +++ b/src/engine/opengl_shaders/color.frag @@ -0,0 +1,5 @@ +varying lowp vec4 col; + +void main() { + gl_FragColor = col; +} diff --git a/src/engine/opengl_shaders/color.vert b/src/engine/opengl_shaders/color.vert new file mode 100644 index 0000000..5c642fb --- /dev/null +++ b/src/engine/opengl_shaders/color.vert @@ -0,0 +1,9 @@ +attribute highp vec4 posAttr; +attribute lowp vec4 colAttr; +varying lowp vec4 col; +uniform highp mat4 matrix; + +void main() { + col = colAttr; + gl_Position = matrix * posAttr; +} diff --git a/src/engine/resources_engine.qrc b/src/engine/resources_engine.qrc new file mode 100644 index 0000000..c0479d3 --- /dev/null +++ b/src/engine/resources_engine.qrc @@ -0,0 +1,8 @@ + + + vulkan_shader_modules/color_frag.spv + vulkan_shader_modules/color_vert.spv + opengl_shaders/color.frag + opengl_shaders/color.vert + + diff --git a/shader_modules/color.frag b/src/engine/vulkan_shader_modules/color.frag similarity index 100% rename from shader_modules/color.frag rename to src/engine/vulkan_shader_modules/color.frag diff --git a/shader_modules/color.vert b/src/engine/vulkan_shader_modules/color.vert similarity index 100% rename from shader_modules/color.vert rename to src/engine/vulkan_shader_modules/color.vert diff --git a/shader_modules/color_frag.spv b/src/engine/vulkan_shader_modules/color_frag.spv similarity index 100% rename from shader_modules/color_frag.spv rename to src/engine/vulkan_shader_modules/color_frag.spv diff --git a/shader_modules/color_vert.spv b/src/engine/vulkan_shader_modules/color_vert.spv similarity index 100% rename from shader_modules/color_vert.spv rename to src/engine/vulkan_shader_modules/color_vert.spv diff --git a/src/engine/vulkangamerenderer.cpp b/src/engine/vulkangamerenderer.cpp index 1499349..c598723 100644 --- a/src/engine/vulkangamerenderer.cpp +++ b/src/engine/vulkangamerenderer.cpp @@ -20,14 +20,18 @@ static inline VkDeviceSize aligned(VkDeviceSize v, VkDeviceSize byteAlign) return (v + byteAlign - 1) & ~(byteAlign - 1); } -VulkanGameRenderer::VulkanGameRenderer(QVulkanWindow *w, bool msaa) : - m_window(w) +VulkanGameRenderer::VulkanGameRenderer(const ProjectContainer &project, QVulkanWindow *w, bool msaa) : + m_window{w}, + m_project{project} { - if (msaa) { + if (msaa) + { const QVector counts = w->supportedSampleCounts(); qDebug() << "Supported sample counts:" << counts; - for (int s = 16; s >= 4; s /= 2) { - if (counts.contains(s)) { + for (int s = 16; s >= 4; s /= 2) + { + if (counts.contains(s)) + { qDebug("Requesting sample count %d", s); m_window->setSampleCount(s); break; @@ -38,13 +42,16 @@ VulkanGameRenderer::VulkanGameRenderer(QVulkanWindow *w, bool msaa) : VkShaderModule VulkanGameRenderer::createShader(const QString &name) { - QFile file(name); - if (!file.open(QIODevice::ReadOnly)) { - qWarning("Failed to read shader %s", qPrintable(name)); - return VK_NULL_HANDLE; + QByteArray blob; + { + QFile file(name); + if (!file.open(QIODevice::ReadOnly)) + { + qWarning("Failed to read shader %s", qPrintable(name)); + return VK_NULL_HANDLE; + } + blob = file.readAll(); } - QByteArray blob = file.readAll(); - file.close(); VkShaderModuleCreateInfo shaderInfo; memset(&shaderInfo, 0, sizeof(shaderInfo)); @@ -53,7 +60,8 @@ VkShaderModule VulkanGameRenderer::createShader(const QString &name) shaderInfo.pCode = reinterpret_cast(blob.constData()); VkShaderModule shaderModule; VkResult err = m_devFuncs->vkCreateShaderModule(m_window->device(), &shaderInfo, nullptr, &shaderModule); - if (err != VK_SUCCESS) { + if (err != VK_SUCCESS) + { qWarning("Failed to create shader module: %d", err); return VK_NULL_HANDLE; } @@ -104,7 +112,7 @@ void VulkanGameRenderer::initResources() VkMemoryRequirements memReq; m_devFuncs->vkGetBufferMemoryRequirements(dev, m_buf, &memReq); - VkMemoryAllocateInfo memAllocInfo = { + VkMemoryAllocateInfo memAllocInfo { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, nullptr, memReq.size, @@ -126,7 +134,8 @@ void VulkanGameRenderer::initResources() memcpy(p, vertexData, sizeof(vertexData)); QMatrix4x4 ident; memset(m_uniformBufInfo, 0, sizeof(m_uniformBufInfo)); - for (int i = 0; i < concurrentFrameCount; ++i) { + for (int i = 0; i < concurrentFrameCount; ++i) + { const VkDeviceSize offset = vertexAllocSize + i * uniformAllocSize; memcpy(p + offset, ident.constData(), 16 * sizeof(float)); m_uniformBufInfo[i].buffer = m_buf; @@ -135,12 +144,12 @@ void VulkanGameRenderer::initResources() } m_devFuncs->vkUnmapMemory(dev, m_bufMem); - VkVertexInputBindingDescription vertexBindingDesc = { + VkVertexInputBindingDescription vertexBindingDesc { 0, // binding 5 * sizeof(float), VK_VERTEX_INPUT_RATE_VERTEX }; - VkVertexInputAttributeDescription vertexAttrDesc[] = { + VkVertexInputAttributeDescription vertexAttrDesc[] { { // position 0, // location 0, // binding @@ -176,14 +185,14 @@ void VulkanGameRenderer::initResources() if (err != VK_SUCCESS) qFatal("Failed to create descriptor pool: %d", err); - VkDescriptorSetLayoutBinding layoutBinding = { + VkDescriptorSetLayoutBinding layoutBinding { 0, // binding VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT, nullptr }; - VkDescriptorSetLayoutCreateInfo descLayoutInfo = { + VkDescriptorSetLayoutCreateInfo descLayoutInfo { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, nullptr, 0, @@ -194,8 +203,9 @@ void VulkanGameRenderer::initResources() if (err != VK_SUCCESS) qFatal("Failed to create descriptor set layout: %d", err); - for (int i = 0; i < concurrentFrameCount; ++i) { - VkDescriptorSetAllocateInfo descSetAllocInfo = { + for (int i = 0; i < concurrentFrameCount; ++i) + { + VkDescriptorSetAllocateInfo descSetAllocInfo { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, nullptr, m_descPool, @@ -235,15 +245,15 @@ void VulkanGameRenderer::initResources() qFatal("Failed to create pipeline layout: %d", err); // Shaders - VkShaderModule vertShaderModule = createShader(QStringLiteral(":/qtgameengine/shader_modules/color_vert.spv")); - VkShaderModule fragShaderModule = createShader(QStringLiteral(":/qtgameengine/shader_modules/color_frag.spv")); + VkShaderModule vertShaderModule = createShader(QStringLiteral(":/qtgameengine/vulkan_shader_modules/color_vert.spv")); + VkShaderModule fragShaderModule = createShader(QStringLiteral(":/qtgameengine/vulkan_shader_modules/color_frag.spv")); // Graphics pipeline VkGraphicsPipelineCreateInfo pipelineInfo; memset(&pipelineInfo, 0, sizeof(pipelineInfo)); pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; - VkPipelineShaderStageCreateInfo shaderStages[2] = { + VkPipelineShaderStageCreateInfo shaderStages[2] { { VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, nullptr, @@ -361,37 +371,44 @@ void VulkanGameRenderer::releaseResources() VkDevice dev = m_window->device(); - if (m_pipeline) { + if (m_pipeline) + { m_devFuncs->vkDestroyPipeline(dev, m_pipeline, nullptr); m_pipeline = VK_NULL_HANDLE; } - if (m_pipelineLayout) { + if (m_pipelineLayout) + { m_devFuncs->vkDestroyPipelineLayout(dev, m_pipelineLayout, nullptr); m_pipelineLayout = VK_NULL_HANDLE; } - if (m_pipelineCache) { + if (m_pipelineCache) + { m_devFuncs->vkDestroyPipelineCache(dev, m_pipelineCache, nullptr); m_pipelineCache = VK_NULL_HANDLE; } - if (m_descSetLayout) { + if (m_descSetLayout) + { m_devFuncs->vkDestroyDescriptorSetLayout(dev, m_descSetLayout, nullptr); m_descSetLayout = VK_NULL_HANDLE; } - if (m_descPool) { + if (m_descPool) + { m_devFuncs->vkDestroyDescriptorPool(dev, m_descPool, nullptr); m_descPool = VK_NULL_HANDLE; } - if (m_buf) { + if (m_buf) + { m_devFuncs->vkDestroyBuffer(dev, m_buf, nullptr); m_buf = VK_NULL_HANDLE; } - if (m_bufMem) { + if (m_bufMem) + { m_devFuncs->vkFreeMemory(dev, m_bufMem, nullptr); m_bufMem = VK_NULL_HANDLE; } diff --git a/src/engine/vulkangamerenderer.h b/src/engine/vulkangamerenderer.h index 83301a0..822aaa4 100644 --- a/src/engine/vulkangamerenderer.h +++ b/src/engine/vulkangamerenderer.h @@ -2,10 +2,12 @@ #include +struct ProjectContainer; + class VulkanGameRenderer : public QVulkanWindowRenderer { public: - VulkanGameRenderer(QVulkanWindow *w, bool msaa = false); + VulkanGameRenderer(const ProjectContainer &project, QVulkanWindow *w, bool msaa = false); void initResources() override; void initSwapChainResources() override; @@ -32,6 +34,8 @@ protected: VkPipelineLayout m_pipelineLayout = VK_NULL_HANDLE; VkPipeline m_pipeline = VK_NULL_HANDLE; + const ProjectContainer &m_project; + QMatrix4x4 m_proj; float m_rotation = 0.0f; }; diff --git a/src/engine/vulkangamewindow.cpp b/src/engine/vulkangamewindow.cpp index c7af166..9baace9 100644 --- a/src/engine/vulkangamewindow.cpp +++ b/src/engine/vulkangamewindow.cpp @@ -14,5 +14,5 @@ VulkanGameWindow::VulkanGameWindow(const ProjectContainer &project, QWindow *par QVulkanWindowRenderer *VulkanGameWindow::createRenderer() { - return new VulkanGameRenderer(this, true); // try MSAA, when available + return new VulkanGameRenderer{m_project, this, true}; // try MSAA, when available }