mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-21 18:25:21 +12:00
Qt: Add screen resize
This commit is contained in:
parent
0f80d0af7a
commit
2e5ab26b46
4 changed files with 63 additions and 0 deletions
include/panda_qt
|
@ -50,6 +50,7 @@ class MainWindow : public QMainWindow {
|
|||
PressTouchscreen,
|
||||
ReleaseTouchscreen,
|
||||
ReloadUbershader,
|
||||
SetScreenSize,
|
||||
};
|
||||
|
||||
// Tagged union representing our message queue messages
|
||||
|
@ -81,6 +82,11 @@ class MainWindow : public QMainWindow {
|
|||
u16 x;
|
||||
u16 y;
|
||||
} touchscreen;
|
||||
|
||||
struct {
|
||||
u32 width;
|
||||
u32 height;
|
||||
} screenSize;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -141,4 +147,6 @@ class MainWindow : public QMainWindow {
|
|||
void loadLuaScript(const std::string& code);
|
||||
void reloadShader(const std::string& shader);
|
||||
void editCheat(u32 handle, const std::vector<uint8_t>& cheat, const std::function<void(u32)>& callback);
|
||||
|
||||
void handleScreenResize(u32 width, u32 height);
|
||||
};
|
||||
|
|
|
@ -11,11 +11,20 @@ class ScreenWidget : public QWidget {
|
|||
|
||||
public:
|
||||
ScreenWidget(QWidget* parent = nullptr);
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
// Called by the emulator thread for resizing the actual GL surface, since the emulator thread owns the GL context
|
||||
void resizeSurface(u32 width, u32 height);
|
||||
|
||||
GL::Context* getGLContext() { return glContext.get(); }
|
||||
|
||||
// Dimensions of our output surface
|
||||
u32 surfaceWidth = 0;
|
||||
u32 surfaceHeight = 0;
|
||||
WindowInfo windowInfo;
|
||||
|
||||
// Cached "previous" dimensions, used when resizing our window
|
||||
u32 previousWidth = 0;
|
||||
u32 previousHeight = 0;
|
||||
|
||||
private:
|
||||
std::unique_ptr<GL::Context> glContext = nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue