Implement quick&dirty approach to update window size and position
This commit is contained in:
parent
f2e39fb2f7
commit
b05b8bae8b
9 changed files with 53 additions and 8 deletions
|
|
@ -62,6 +62,14 @@ Window::~Window() {
|
|||
SDL_DestroyWindow(window_);
|
||||
}
|
||||
|
||||
void Window::resize(int width, int height) {
|
||||
SDL_SetWindowSize(window_, width, height);
|
||||
}
|
||||
|
||||
int Window::update_position(int x, int y) {
|
||||
SDL_SetWindowPosition(window_, x, y);
|
||||
}
|
||||
|
||||
EGLNativeWindowType Window::native_window() const {
|
||||
return native_window_;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ public:
|
|||
Window(int x, int y, int width, int height);
|
||||
~Window();
|
||||
|
||||
void resize(int width, int height);
|
||||
int update_position(int x, int y);
|
||||
|
||||
EGLNativeWindowType native_window() const;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -91,6 +91,15 @@ catch (std::exception &err) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void WindowCreator::update_window(EGLNativeWindowType win, int x, int y, int width, int height) {
|
||||
auto iter = windows_.find(win);
|
||||
if (iter == windows_.end())
|
||||
return;
|
||||
|
||||
iter->second->resize(width, height);
|
||||
iter->second->update_position(x, y);
|
||||
}
|
||||
|
||||
void WindowCreator::destroy_window(EGLNativeWindowType win) {
|
||||
auto iter = windows_.find(win);
|
||||
if (iter == windows_.end())
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public:
|
|||
~WindowCreator();
|
||||
|
||||
EGLNativeWindowType create_window(int x, int y, int width, int height) override;
|
||||
void update_window(EGLNativeWindowType win, int x, int y, int width, int height) override;
|
||||
void destroy_window(EGLNativeWindowType win) override;
|
||||
|
||||
DisplayInfo display_info() const override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue