mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-22 22:45:52 +00:00
Cleaning up and making the debugger resize well
This commit is contained in:
@@ -131,8 +131,6 @@ add_executable(ComSquare
|
||||
sources/Renderer/QtRenderer/QtWidgetSFML.hpp
|
||||
ui/cpu.ui
|
||||
resources/appResources.qrc
|
||||
sources/Renderer/QtRenderer/QtWindow.cpp
|
||||
sources/Renderer/QtRenderer/QtWindow.hpp
|
||||
sources/Utility/Utility.hpp)
|
||||
|
||||
target_compile_definitions(ComSquare PUBLIC DEBUGGER_ENABLED)
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "../CPU/CPU.hpp"
|
||||
#include "../Renderer/SFRenderer.hpp"
|
||||
#include "../SNES.hpp"
|
||||
#include "../Renderer/QtRenderer/QtWindow.hpp"
|
||||
#include "../../ui/ui_cpu.h"
|
||||
|
||||
namespace ComSquare::Debugger
|
||||
|
||||
@@ -16,14 +16,17 @@
|
||||
namespace ComSquare::Renderer
|
||||
{
|
||||
QtSFML::QtSFML(unsigned int h, unsigned int w) :
|
||||
QtWindow(h, w), _sfWidget(nullptr)
|
||||
{ }
|
||||
_window(), _sfWidget(nullptr)
|
||||
{
|
||||
this->_window.resize(w, h);
|
||||
}
|
||||
|
||||
void QtSFML::createWindow(SNES &snes, int maxFPS)
|
||||
{
|
||||
this->setWindowName(snes.cartridge->header.gameName);
|
||||
this->_sfWidget = std::make_unique<QtFullSFML>(snes, &_frame, QPoint(0, 0), QSize(this->_width, this->_height), maxFPS);
|
||||
this->_sfWidget->show();
|
||||
this->_sfWidget = std::make_unique<QtFullSFML>(snes, &_window, QPoint(0, 0), QSize(this->_window.width(), this->_window.height()), maxFPS);
|
||||
this->_sfWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
this->_window.show();
|
||||
}
|
||||
|
||||
void QtSFML::putPixel(unsigned y, unsigned x, uint32_t rgba)
|
||||
@@ -35,7 +38,7 @@ namespace ComSquare::Renderer
|
||||
|
||||
void QtSFML::setWindowName(std::string &newWindowName)
|
||||
{
|
||||
QtWindow::setWindowName(newWindowName);
|
||||
this->_window.setWindowTitle((newWindowName + " - ComSquare").c_str());
|
||||
}
|
||||
|
||||
QtFullSFML::QtFullSFML(SNES &snes, QWidget *parent, const QPoint &position, const QSize &size, int frameRate) :
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#include <QtWidgets/QWidget>
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include "../IRenderer.hpp"
|
||||
#include "../SFRenderer.hpp"
|
||||
#include "QtWidgetSFML.hpp"
|
||||
#include "QtWindow.hpp"
|
||||
|
||||
namespace ComSquare::Renderer
|
||||
{
|
||||
@@ -29,8 +29,10 @@ namespace ComSquare::Renderer
|
||||
};
|
||||
|
||||
//! @brief A SFML renderer inside a QT window.
|
||||
class QtSFML : public IRenderer, public QtWindow {
|
||||
class QtSFML : public IRenderer {
|
||||
private:
|
||||
//! @brief The main window that the app reside on.
|
||||
QMainWindow _window;
|
||||
//! @brief The SFML widget.
|
||||
std::unique_ptr<QtFullSFML> _sfWidget = nullptr;
|
||||
public:
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
//
|
||||
// Created by anonymus-raccoon on 2/16/20.
|
||||
//
|
||||
|
||||
#include "QtWindow.hpp"
|
||||
#include <QIcon>
|
||||
|
||||
namespace ComSquare::Renderer
|
||||
{
|
||||
QtWindow::QtWindow(unsigned int height, unsigned int width) :
|
||||
_frame(), _width(width), _height(height)
|
||||
{
|
||||
this->_frame.setWindowIcon(QIcon(":/resources/Logo.png"));
|
||||
this->_frame.show();
|
||||
}
|
||||
|
||||
void QtWindow::setWindowName(std::string &newWindowName)
|
||||
{
|
||||
this->_frame.setWindowTitle((newWindowName + " - ComSquare").c_str());
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// Created by anonymus-raccoon on 2/16/20.
|
||||
//
|
||||
|
||||
#ifndef COMSQUARE_QTWINDOW_HPP
|
||||
#define COMSQUARE_QTWINDOW_HPP
|
||||
|
||||
|
||||
#include <QtWidgets/QFrame>
|
||||
|
||||
namespace ComSquare::Renderer
|
||||
{
|
||||
class QtWindow {
|
||||
protected:
|
||||
//! @brief The SFML frame.
|
||||
QFrame _frame;
|
||||
//! @brief The _width of the window.
|
||||
unsigned int _width;
|
||||
//! @brief The _height of the window.
|
||||
unsigned int _height;
|
||||
public:
|
||||
//! @brief Set a new name to the window, if there is already a name it will be overwrite.
|
||||
//! @param newWindowName new title for the window.
|
||||
void setWindowName(std::string &newWindowName);
|
||||
//! @brief Constructor that return a SFML renderer inside a QT window.
|
||||
//! @param height _height of the window.
|
||||
//! @param width _width of the window.
|
||||
QtWindow(unsigned int height, unsigned int width);
|
||||
QtWindow(const QtWindow &) = delete;
|
||||
QtWindow &operator=(const QtWindow &) = delete;
|
||||
~QtWindow() = default;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //COMSQUARE_QTWINDOW_HPP
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>422</width>
|
||||
<height>399</height>
|
||||
<width>420</width>
|
||||
<height>405</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -21,152 +21,133 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QTextBrowser" name="logger">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>30</y>
|
||||
<width>200</width>
|
||||
<height>305</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="loggerLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>0</y>
|
||||
<width>200</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Instructions History</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="formLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>211</width>
|
||||
<height>361</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="accumulatorLabel">
|
||||
<property name="text">
|
||||
<string>Accumulator</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="accumulatorLineEdit">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="programBankRegisterLabel">
|
||||
<property name="text">
|
||||
<string>Program Bank</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="programBankRegisterLineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="programCounterLabel">
|
||||
<property name="text">
|
||||
<string>Program Counter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="programCounterLineEdit"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="directBankLabel">
|
||||
<property name="text">
|
||||
<string>Direct Bank</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="directBankLineEdit"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="directPageLabel">
|
||||
<property name="text">
|
||||
<string>Direct Page</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="directPageLineEdit"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="stackPointerLabel">
|
||||
<property name="text">
|
||||
<string>Stack Pointer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="stackPointerLineEdit"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="xIndexLabel">
|
||||
<property name="text">
|
||||
<string>X Index</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="xIndexLineEdit"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="yIndexLabel">
|
||||
<property name="text">
|
||||
<string>Y Index</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLineEdit" name="yIndexLineEdit"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="flagsLabel">
|
||||
<property name="text">
|
||||
<string>Flags</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLineEdit" name="flagsLineEdit"/>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="emulationModeLabel">
|
||||
<property name="text">
|
||||
<string>Emulation mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="emulationModeCheckBox">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="accumulatorLabel">
|
||||
<property name="text">
|
||||
<string>Accumulator</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="accumulatorLineEdit">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="programBankRegisterLabel">
|
||||
<property name="text">
|
||||
<string>Program Bank</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="programBankRegisterLineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="programCounterLabel">
|
||||
<property name="text">
|
||||
<string>Program Counter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="programCounterLineEdit"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="directBankLabel">
|
||||
<property name="text">
|
||||
<string>Direct Bank</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="directBankLineEdit"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="directPageLabel">
|
||||
<property name="text">
|
||||
<string>Direct Page</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="directPageLineEdit"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="stackPointerLabel">
|
||||
<property name="text">
|
||||
<string>Stack Pointer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="stackPointerLineEdit"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="xIndexLabel">
|
||||
<property name="text">
|
||||
<string>X Index</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="xIndexLineEdit"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="yIndexLabel">
|
||||
<property name="text">
|
||||
<string>Y Index</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLineEdit" name="yIndexLineEdit"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="flagsLabel">
|
||||
<property name="text">
|
||||
<string>Flags</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLineEdit" name="flagsLineEdit"/>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="emulationModeLabel">
|
||||
<property name="text">
|
||||
<string>Emulation mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="emulationModeCheckBox">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="loggerLabel">
|
||||
<property name="text">
|
||||
<string>Instructions History</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QTextBrowser" name="logger"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="minimumSize">
|
||||
|
||||
Reference in New Issue
Block a user