Adding a base class for a QT window

This commit is contained in:
Anonymus Raccoon
2020-02-16 16:53:18 +01:00
parent 6ff4de3e0b
commit c16ce36105
24 changed files with 159 additions and 74 deletions

View File

@@ -15,24 +15,17 @@
namespace ComSquare::Renderer
{
QtSFML::QtSFML(QApplication &app, unsigned int h, unsigned int w) :
_app(app), _sfWidget(nullptr), width(w), height(h)
QtSFML::QtSFML(unsigned int h, unsigned int w) :
QtWindow(h, w), _sfWidget(nullptr)
{ }
void QtSFML::createWindow(SNES &snes, int maxFPS)
{
this->frame = new QFrame();
this->setWindowName(snes.cartridge->header.gameName);
this->frame->show();
this->_sfWidget = new QtFullSFML(snes, frame, QPoint(0, 0), QSize(this->width, this->height), maxFPS);
this->_sfWidget = std::make_unique<QtFullSFML>(snes, &_frame, QPoint(0, 0), QSize(this->_width, this->_height), maxFPS);
this->_sfWidget->show();
}
void QtSFML::setWindowName(std::string newWindowName)
{
this->frame->setWindowTitle((newWindowName + " - ComSquare").c_str());
}
void QtSFML::putPixel(unsigned y, unsigned x, uint32_t rgba)
{
this->_sfWidget->putPixel(y, x, rgba);
@@ -40,6 +33,11 @@ namespace ComSquare::Renderer
void QtSFML::drawScreen() { }
void QtSFML::setWindowName(std::string &newWindowName)
{
QtWindow::setWindowName(newWindowName);
}
QtFullSFML::QtFullSFML(SNES &snes, QWidget *parent, const QPoint &position, const QSize &size, int frameRate) :
QtWidgetSFML(parent, position, size, frameRate),
_snes(snes)