diff --git a/QtGameMaker.pro b/QtGameMaker.pro index d0c0f19..83db83c 100644 --- a/QtGameMaker.pro +++ b/QtGameMaker.pro @@ -27,6 +27,7 @@ INCLUDEPATH += \ HEADERS += \ src/closeeventfilter.h \ src/editor/dialogs/genericcodeeditordialog.h \ + src/editor/dialogs/transparentbackgroundsettingsdialog.h \ src/editor/editorguiutils.h \ src/editor/roomscene.h \ src/editor/widgets/actiondragwidget.h \ @@ -88,6 +89,7 @@ HEADERS += \ SOURCES += \ src/closeeventfilter.cpp \ src/editor/dialogs/genericcodeeditordialog.cpp \ + src/editor/dialogs/transparentbackgroundsettingsdialog.cpp \ src/editor/editorguiutils.cpp \ src/editor/roomscene.cpp \ src/editor/widgets/actiondragwidget.cpp \ @@ -146,6 +148,7 @@ SOURCES += \ src/projectserialization.cpp FORMS += \ + src/editor/dialogs/transparentbackgroundsettingsdialog.ui \ src/editor/mainwindow.ui \ src/editor/dialogs/addeventdialog.ui \ src/editor/dialogs/backgroundpropertiesdialog.ui \ diff --git a/src/editor/dialogs/globalgamesettingsdialog.ui b/src/editor/dialogs/globalgamesettingsdialog.ui index 5e409ea..f9dbe95 100644 --- a/src/editor/dialogs/globalgamesettingsdialog.ui +++ b/src/editor/dialogs/globalgamesettingsdialog.ui @@ -330,7 +330,7 @@ - RadioButton + 1600x1200 diff --git a/src/editor/dialogs/preferencesdialog.ui b/src/editor/dialogs/preferencesdialog.ui index e412bb5..2b6291a 100644 --- a/src/editor/dialogs/preferencesdialog.ui +++ b/src/editor/dialogs/preferencesdialog.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 300 + 634 + 614 @@ -16,24 +16,439 @@ + + 0 + - General + &General + + + + + + + CheckBox + + + + + + + CheckBox + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + CheckBox + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + TextLabel + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + CheckBox + + + + + + + CheckBox + + + + + + + CheckBox + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + CheckBox + + + + + + + CheckBox + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + + + + + + + CheckBox + + + + + + + CheckBox + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + TextLabel + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + CheckBox + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + - Forms + &Forms + + + + + GroupBox + + + + + + CheckBox + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + GroupBox + + + + + + CheckBox + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + TextLabel + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + GroupBox + + + + + + CheckBox + + + + + + + CheckBox + + + + + + + CheckBox + + + + + + + + + CheckBox + + + + + + + ... + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + - Scripts and Code + &Scripts and Code - Editors + &Editors diff --git a/src/editor/dialogs/roompropertiesdialog.ui b/src/editor/dialogs/roompropertiesdialog.ui index d3fa9ae..840c358 100644 --- a/src/editor/dialogs/roompropertiesdialog.ui +++ b/src/editor/dialogs/roompropertiesdialog.ui @@ -101,7 +101,7 @@ QTabWidget::West - 0 + 1 @@ -133,8 +133,8 @@ 0 0 - 419 - 333 + 402 + 297 @@ -326,7 +326,7 @@ - CreationCode + C&reationCode @@ -402,8 +402,8 @@ 0 0 - 459 - 482 + 473 + 478 diff --git a/src/editor/dialogs/transparentbackgroundsettingsdialog.cpp b/src/editor/dialogs/transparentbackgroundsettingsdialog.cpp new file mode 100644 index 0000000..392644f --- /dev/null +++ b/src/editor/dialogs/transparentbackgroundsettingsdialog.cpp @@ -0,0 +1,11 @@ +#include "transparentbackgroundsettingsdialog.h" +#include "ui_transparentbackgroundsettingsdialog.h" + +TransparentBackgroundSettingsDialog::TransparentBackgroundSettingsDialog(QWidget *parent) : + QDialog{parent}, + m_ui{std::make_unique()} +{ + m_ui->setupUi(this); +} + +TransparentBackgroundSettingsDialog::~TransparentBackgroundSettingsDialog() = default; diff --git a/src/editor/dialogs/transparentbackgroundsettingsdialog.h b/src/editor/dialogs/transparentbackgroundsettingsdialog.h new file mode 100644 index 0000000..3d6fbe7 --- /dev/null +++ b/src/editor/dialogs/transparentbackgroundsettingsdialog.h @@ -0,0 +1,19 @@ +#pragma once + +#include + +#include + +namespace Ui { class TransparentBackgroundSettingsDialog; } + +class TransparentBackgroundSettingsDialog : public QDialog +{ + Q_OBJECT + +public: + explicit TransparentBackgroundSettingsDialog(QWidget *parent = nullptr); + ~TransparentBackgroundSettingsDialog() override; + +private: + const std::unique_ptr m_ui; +}; diff --git a/src/editor/dialogs/transparentbackgroundsettingsdialog.ui b/src/editor/dialogs/transparentbackgroundsettingsdialog.ui new file mode 100644 index 0000000..24fd2d7 --- /dev/null +++ b/src/editor/dialogs/transparentbackgroundsettingsdialog.ui @@ -0,0 +1,68 @@ + + + TransparentBackgroundSettingsDialog + + + + 0 + 0 + 400 + 300 + + + + Transparent Background Settings + + + + + 30 + 240 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + buttonBox + accepted() + TransparentBackgroundSettingsDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + TransparentBackgroundSettingsDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/editor/mainwindow.cpp b/src/editor/mainwindow.cpp index 97e1135..0e60e31 100644 --- a/src/editor/mainwindow.cpp +++ b/src/editor/mainwindow.cpp @@ -24,6 +24,7 @@ #include "dialogs/objectpropertiesdialog.h" #include "dialogs/roompropertiesdialog.h" #include "dialogs/objectinformationdialog.h" +#include "dialogs/transparentbackgroundsettingsdialog.h" #include "dialogs/gameinformationdialog.h" #include "dialogs/globalgamesettingsdialog.h" #include "dialogs/extensionpackagesdialog.h" @@ -103,6 +104,7 @@ MainWindow::MainWindow(const QString &filePath, QWidget *parent) : connect(m_ui->actionProperties, &QAction::triggered, this, &MainWindow::showProperties); connect(m_ui->actionFindResource, &QAction::triggered, this, &MainWindow::findResource); connect(m_ui->actionShowObjectInformation, &QAction::triggered, this, &MainWindow::showObjectInformation); + connect(m_ui->actionTransparentBackgroundSettings, &QAction::triggered, this, &MainWindow::transparentBackgroundSettings); connect(m_ui->actionCreateSprite, &QAction::triggered, this, &MainWindow::createFor); connect(m_ui->actionCreateSound, &QAction::triggered, this, &MainWindow::createFor); connect(m_ui->actionCreateBackground, &QAction::triggered, this, &MainWindow::createFor); @@ -714,6 +716,12 @@ void MainWindow::showObjectInformation() openOrActivateWindow(m_objectInformationWindow, m_project); } +void MainWindow::transparentBackgroundSettings() +{ + TransparentBackgroundSettingsDialog dialog{this}; + dialog.exec(); +} + template void MainWindow::createFor() { diff --git a/src/editor/mainwindow.h b/src/editor/mainwindow.h index 6b2a2f1..3052dcf 100644 --- a/src/editor/mainwindow.h +++ b/src/editor/mainwindow.h @@ -56,6 +56,7 @@ private slots: void showProperties(); void findResource(); void showObjectInformation(); + void transparentBackgroundSettings(); private: template void createFor(); diff --git a/src/editor/mainwindow.ui b/src/editor/mainwindow.ui index 84c59bf..132b8cf 100644 --- a/src/editor/mainwindow.ui +++ b/src/editor/mainwindow.ui @@ -61,7 +61,7 @@ 0 0 1366 - 20 + 23 @@ -112,6 +112,7 @@ + @@ -831,6 +832,11 @@ Ta&bbed view + + + &Transparent Background Settings + + diff --git a/src/projectcontainer.h b/src/projectcontainer.h index b3554ab..f70d9ca 100644 --- a/src/projectcontainer.h +++ b/src/projectcontainer.h @@ -12,6 +12,7 @@ struct GlobalGameSettings { + // Graphics settings bool startInFullscreenMode{}; struct FixedScale { int percent{100}; @@ -32,11 +33,57 @@ struct GlobalGameSettings bool displayCursor{true}; bool freezeWhenFocusLost{}; bool disableScreensaver{true}; - struct Resolution { + // Resolution settings + struct ScreenSetting { + enum class ColorDepth { + NoChange, + _16bit, + _32bit + }; + ColorDepth colorDepth; + enum class Resolution { + NoChange, + _320x240, + _640x480, + _800x600, + _1024x768, + _1280x1024, + _1600x1200 + }; + Resolution resolution; + enum class Frequency { + NoChange, + _60, + _70, + _85, + _100, + _120 + }; + Frequency frequency; }; - std::optional resolution; + std::optional screenSetting; bool vsync{}; + + // Other settings + bool letEscEndGame{true}; + bool treatCloseButtonAsEsc{true}; + bool letF1ShowGameInformation{true}; + bool letF4SwitchBetweenScreenModes{true}; + bool letF5SaveF6LoadGame{true}; + bool letF9TakeScreenshot{true}; + enum class Priority { + Normal, High, Highest + }; + Priority priority; + int major{1}; + int minor{}; + int release{}; + int build{}; + QString company; + QString product; + QString copyright; + QString description; }; struct Sprite diff --git a/src/projectserialization.cpp b/src/projectserialization.cpp index f6e0416..86dac7b 100644 --- a/src/projectserialization.cpp +++ b/src/projectserialization.cpp @@ -15,8 +15,23 @@ QDataStream &operator<<(QDataStream &ds, const GlobalGameSettings &globalGameSet << globalGameSettings.displayCursor << globalGameSettings.freezeWhenFocusLost << globalGameSettings.disableScreensaver - << globalGameSettings.resolution - << globalGameSettings.vsync; + << globalGameSettings.screenSetting + << globalGameSettings.vsync + << globalGameSettings.letEscEndGame + << globalGameSettings.treatCloseButtonAsEsc + << globalGameSettings.letF1ShowGameInformation + << globalGameSettings.letF4SwitchBetweenScreenModes + << globalGameSettings.letF5SaveF6LoadGame + << globalGameSettings.letF9TakeScreenshot + << globalGameSettings.priority + << globalGameSettings.major + << globalGameSettings.minor + << globalGameSettings.release + << globalGameSettings.build + << globalGameSettings.company + << globalGameSettings.product + << globalGameSettings.copyright + << globalGameSettings.description; return ds; } @@ -33,8 +48,23 @@ QDataStream &operator>>(QDataStream &ds, GlobalGameSettings &globalGameSettings) >> globalGameSettings.displayCursor >> globalGameSettings.freezeWhenFocusLost >> globalGameSettings.disableScreensaver - >> globalGameSettings.resolution - >> globalGameSettings.vsync; + >> globalGameSettings.screenSetting + >> globalGameSettings.vsync + >> globalGameSettings.letEscEndGame + >> globalGameSettings.treatCloseButtonAsEsc + >> globalGameSettings.letF1ShowGameInformation + >> globalGameSettings.letF4SwitchBetweenScreenModes + >> globalGameSettings.letF5SaveF6LoadGame + >> globalGameSettings.letF9TakeScreenshot + >> globalGameSettings.priority + >> globalGameSettings.major + >> globalGameSettings.minor + >> globalGameSettings.release + >> globalGameSettings.build + >> globalGameSettings.company + >> globalGameSettings.product + >> globalGameSettings.copyright + >> globalGameSettings.description; return ds; } @@ -78,17 +108,19 @@ QDataStream &operator>>(QDataStream &ds, GlobalGameSettings::FullScale &fullScal return ds; } -QDataStream &operator<<(QDataStream &ds, const GlobalGameSettings::Resolution &resolution) +QDataStream &operator<<(QDataStream &ds, const GlobalGameSettings::ScreenSetting &screenSetting) { - Q_UNUSED(resolution); - //ds << resolution.; + ds << screenSetting.colorDepth + << screenSetting.resolution + << screenSetting.frequency; return ds; } -QDataStream &operator>>(QDataStream &ds, GlobalGameSettings::Resolution &resolution) +QDataStream &operator>>(QDataStream &ds, GlobalGameSettings::ScreenSetting &screenSetting) { - Q_UNUSED(resolution); - //ds >> resolution.; + ds >> screenSetting.colorDepth + >> screenSetting.resolution + >> screenSetting.frequency; return ds; } diff --git a/src/projectserialization.h b/src/projectserialization.h index 3e97a6c..9e20c22 100644 --- a/src/projectserialization.h +++ b/src/projectserialization.h @@ -12,8 +12,8 @@ QDataStream &operator<<(QDataStream &ds, const GlobalGameSettings::KeepAspectRat QDataStream &operator>>(QDataStream &ds, GlobalGameSettings::KeepAspectRatio &keepAspectRatio); QDataStream &operator<<(QDataStream &ds, const GlobalGameSettings::FullScale &fullScale); QDataStream &operator>>(QDataStream &ds, GlobalGameSettings::FullScale &fullScale); -QDataStream &operator<<(QDataStream &ds, const GlobalGameSettings::Resolution &resolution); -QDataStream &operator>>(QDataStream &ds, GlobalGameSettings::Resolution &resolution); +QDataStream &operator<<(QDataStream &ds, const GlobalGameSettings::ScreenSetting &screenSetting); +QDataStream &operator>>(QDataStream &ds, GlobalGameSettings::ScreenSetting &screenSetting); QDataStream &operator<<(QDataStream &ds, const Sprite &sprite); QDataStream &operator>>(QDataStream &ds, Sprite &sprite); QDataStream &operator<<(QDataStream &ds, const Sound &sound);