Skip to content

Commit

Permalink
Allow modifying window geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthayhurst committed Dec 27, 2023
1 parent 42d692e commit 523bea1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/ammonite/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,27 @@ namespace ammonite {
useIcons(iconPaths, pngFiles.size());
}

void setWindowGeometry(int width, int height, int xPos, int yPos) {
//Don't allow setting window geometry for fullscreen windows
if (isFullscreen) {
return;
}

//Update the geometry of the window
glfwSetWindowPos(windowPtr, xPos, yPos);
glfwSetWindowSize(windowPtr, width, height);
}

void getWindowGeometry(int* width, int* height, int* xPos, int* yPos) {
//Don't allow querying window geometry for fullscreen windows
if (isFullscreen) {
return;
}

glfwGetWindowSize(windowPtr, width, height);
glfwGetWindowPos(windowPtr, xPos, yPos);
}

bool getFullscreen() {
return isFullscreen;
}
Expand Down
3 changes: 3 additions & 0 deletions src/ammonite/window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ namespace ammonite {
void useIcon(const char* iconPath);
void useIconDir(const char* iconDirPath);

void setWindowGeometry(int width, int height, int xPos, int yPos);
void getWindowGeometry(int* width, int* height, int* xPos, int* yPos);

bool getFullscreen();
GLFWmonitor* getFullscreenMonitor();
int getMonitors(GLFWmonitor*** monitorsPtr);
Expand Down

0 comments on commit 523bea1

Please sign in to comment.