adapted from: qt-wgpu-skel: * 751408ea92268a16a6931862cb00e8dbccb4e47e replace custom FFI with Diplomat * 46ce52c2bf2f8ab76a68c284a2f70556a29d7c3b reduce the unsafe part to the GPU initialization * 784e99b31c4ae3ab0f97ec26045511d00683d66b move the GPU initialization out of the bridge
29 lines
548 B
C++
29 lines
548 B
C++
#pragma once
|
|
|
|
#include <QWidget>
|
|
|
|
#include "Core.hpp"
|
|
|
|
class Viewport : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit Viewport(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
|
~Viewport() override;
|
|
QPaintEngine* paintEngine() const override;
|
|
|
|
void setView(RedrawArgs new_args);
|
|
|
|
protected:
|
|
bool event(QEvent* event) override;
|
|
void paintEvent(QPaintEvent* event) override;
|
|
void resizeEvent(QResizeEvent* event) override;
|
|
|
|
private:
|
|
std::unique_ptr<Core> core;
|
|
RedrawArgs args = {};
|
|
|
|
void recreate();
|
|
void updateSize();
|
|
};
|