restore win-origin-x and win-origin-y

This commit is contained in:
David Rose 2004-03-04 01:42:28 +00:00
parent 7753bf7e24
commit 6bc826c5a5
4 changed files with 11 additions and 0 deletions

View File

@ -89,6 +89,8 @@ class ShowBase(DirectObject.DirectObject):
# Get the default window properties.
winWidth = self.config.GetInt('win-width', 640)
winHeight = self.config.GetInt('win-height', 480)
winOriginX = self.config.GetInt('win-origin-x', -1)
winOriginY = self.config.GetInt('win-origin-y', -1)
fullscreen = self.config.GetBool('fullscreen', 0)
undecorated = self.config.GetBool('undecorated', 0)
cursorHidden = self.config.GetBool('cursor-hidden', 0)
@ -97,6 +99,8 @@ class ShowBase(DirectObject.DirectObject):
self.defaultWindowProps = WindowProperties()
self.defaultWindowProps.setOpen(1)
self.defaultWindowProps.setSize(winWidth, winHeight)
if winOriginX >= 0 and winOriginY >= 0:
self.defaultWindowProps.setOrigin(winOriginX, winOriginY)
self.defaultWindowProps.setFullscreen(fullscreen)
self.defaultWindowProps.setUndecorated(undecorated)
self.defaultWindowProps.setCursorHidden(cursorHidden)

View File

@ -30,6 +30,8 @@ ConfigureFn(config_framework) {
const int win_width = config_framework.GetInt("win-width", 640);
const int win_height = config_framework.GetInt("win-height", 480);
const int win_origin_x = config_framework.GetInt("win-origin-x", -1);
const int win_origin_y = config_framework.GetInt("win-origin-y", -1);
const bool fullscreen = config_framework.GetBool("fullscreen", false);
const bool undecorated = config_framework.GetBool("undecorated", false);
const bool cursor_hidden = config_framework.GetBool("cursor-hidden", false);

View File

@ -27,6 +27,8 @@ NotifyCategoryDecl(framework, EXPCL_FRAMEWORK, EXPTP_FRAMEWORK);
// Configure variables for framework package.
extern const int win_width;
extern const int win_height;
extern const int win_origin_x;
extern const int win_origin_y;
extern const bool fullscreen;
extern const bool undecorated;
extern const bool cursor_hidden;

View File

@ -206,6 +206,9 @@ void PandaFramework::
get_default_window_props(WindowProperties &props) {
props.set_open(true);
props.set_size(win_width, win_height);
if (win_origin_x >= 0 && win_origin_y >= 0) {
props.set_origin(win_origin_x, win_origin_y);
}
props.set_fullscreen(fullscreen);
props.set_undecorated(undecorated);
props.set_cursor_hidden(cursor_hidden);