mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-10 12:29:01 +00:00
Advances to having a selected machine actually run.
Albeit, invisibly.
This commit is contained in:
parent
e2ceb77501
commit
fdc234ed3b
@ -123,6 +123,7 @@ SOURCES += \
|
|||||||
\
|
\
|
||||||
main.cpp \
|
main.cpp \
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
|
scantargetwidget.cpp \
|
||||||
timer.cpp
|
timer.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
@ -247,6 +248,7 @@ HEADERS += \
|
|||||||
../../Storage/Tape/Parsers/*.hpp \
|
../../Storage/Tape/Parsers/*.hpp \
|
||||||
\
|
\
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
|
scantargetwidget.h \
|
||||||
timer.h
|
timer.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
|
@ -4,6 +4,16 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
// "Calling QSurfaceFormat::setDefaultFormat() before constructing the
|
||||||
|
// QApplication instance is mandatory on some platforms ... when an
|
||||||
|
// OpenGL core profile context is requested."
|
||||||
|
QSurfaceFormat format;
|
||||||
|
format.setVersion(3, 2);
|
||||||
|
format.setProfile(QSurfaceFormat::CoreProfile);
|
||||||
|
format.setDepthBufferSize(0);
|
||||||
|
format.setStencilBufferSize(0);
|
||||||
|
QSurfaceFormat::setDefaultFormat(format);
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
|
@ -137,19 +137,19 @@ void MainWindow::launchMachine() {
|
|||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
Machine::Error error;
|
Machine::Error error;
|
||||||
std::unique_ptr<Machine::DynamicMachine> machine(Machine::MachineForTargets(targets, rom_fetcher, error));
|
machine.reset(Machine::MachineForTargets(targets, rom_fetcher, error));
|
||||||
|
|
||||||
switch(error) {
|
switch(error) {
|
||||||
default: {
|
default: {
|
||||||
ui->missingROMsBox->setVisible(false);
|
ui->missingROMsBox->setVisible(false);
|
||||||
uiPhase = UIPhase::RunningMachine;
|
uiPhase = UIPhase::RunningMachine;
|
||||||
|
|
||||||
// TODO: Install the OpenGL scan target.
|
// Supply the scan target.
|
||||||
// This is subject to having created an OpenGL context.
|
// TODO: in the future, hypothetically, deal with non-scan producers.
|
||||||
// const auto scan_producer = machine->scan_producer();
|
const auto scan_producer = machine->scan_producer();
|
||||||
// if(scan_producer) {
|
if(scan_producer) {
|
||||||
// scan_producer->set_scan_target(&scanTarget);
|
scan_producer->set_scan_target(ui->openGLWidget->getScanTarget());
|
||||||
// }
|
}
|
||||||
|
|
||||||
// If this is a timed machine, start up the timer.
|
// If this is a timed machine, start up the timer.
|
||||||
const auto timedMachine = machine->timed_machine();
|
const auto timedMachine = machine->timed_machine();
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include "../../Analyser/Static/StaticAnalyser.hpp"
|
#include "../../Analyser/Static/StaticAnalyser.hpp"
|
||||||
#include "../../Machines/Utility/MachineForTarget.hpp"
|
#include "../../Machines/Utility/MachineForTarget.hpp"
|
||||||
#include "../../Outputs/OpenGL/ScanTarget.hpp"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class MainWindow; }
|
namespace Ui { class MainWindow; }
|
||||||
@ -43,8 +42,8 @@ class MainWindow : public QMainWindow {
|
|||||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
void dropEvent(QDropEvent* event) override;
|
void dropEvent(QDropEvent* event) override;
|
||||||
|
|
||||||
// Output.
|
// Ongoing state.
|
||||||
Outputs::Display::OpenGL::ScanTarget scanTarget;
|
std::unique_ptr<Machine::DynamicMachine> machine;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void open();
|
void open();
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>MainWindow</string>
|
<string>MainWindow</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QOpenGLWidget" name="openGLWidget">
|
<widget class="ScanTargetWidget" name="openGLWidget">
|
||||||
<widget class="QPlainTextEdit" name="missingROMsBox">
|
<widget class="QPlainTextEdit" name="missingROMsBox">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
@ -60,6 +60,13 @@ Please drag and drop the following over this window:
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>ScanTargetWidget</class>
|
||||||
|
<extends>QOpenGLWidget</extends>
|
||||||
|
<header>scantargetwidget.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
21
OSBindings/Qt/scantargetwidget.cpp
Normal file
21
OSBindings/Qt/scantargetwidget.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "scantargetwidget.h"
|
||||||
|
|
||||||
|
ScanTargetWidget::ScanTargetWidget(QWidget *parent) : QOpenGLWidget(parent) {}
|
||||||
|
ScanTargetWidget::~ScanTargetWidget() {}
|
||||||
|
|
||||||
|
void ScanTargetWidget::initializeGL() {
|
||||||
|
scanTarget = std::make_unique<Outputs::Display::OpenGL::ScanTarget>(defaultFramebufferObject());
|
||||||
|
glClearColor(0.5, 0.5, 1.0, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScanTargetWidget::paintGL() {
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScanTargetWidget::resizeGL(int w, int h) {
|
||||||
|
glViewport(0,0,w,h);
|
||||||
|
}
|
||||||
|
|
||||||
|
Outputs::Display::OpenGL::ScanTarget *ScanTargetWidget::getScanTarget() {
|
||||||
|
return scanTarget.get();
|
||||||
|
}
|
27
OSBindings/Qt/scantargetwidget.h
Normal file
27
OSBindings/Qt/scantargetwidget.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef SCANTARGETWIDGET_H
|
||||||
|
#define SCANTARGETWIDGET_H
|
||||||
|
|
||||||
|
#include <QOpenGLWidget>
|
||||||
|
|
||||||
|
#include "../../Outputs/OpenGL/ScanTarget.hpp"
|
||||||
|
|
||||||
|
class ScanTargetWidget : public QOpenGLWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScanTargetWidget(QWidget *parent = nullptr);
|
||||||
|
~ScanTargetWidget();
|
||||||
|
|
||||||
|
Outputs::Display::OpenGL::ScanTarget *getScanTarget();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void initializeGL() override;
|
||||||
|
void resizeGL(int w, int h) override;
|
||||||
|
void paintGL() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// This should be created only once there's an OpenGL context. So it
|
||||||
|
// can't be done at creation time.4
|
||||||
|
std::unique_ptr<Outputs::Display::OpenGL::ScanTarget> scanTarget;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SCANTARGETWIDGET_H
|
Loading…
Reference in New Issue
Block a user