|
|
@@ -381,6 +381,35 @@ Platform* Platform::create(Game* game, void* attachToWindow)
|
|
|
FileSystem::setResourcePath("./");
|
|
|
Platform* platform = new Platform(game);
|
|
|
|
|
|
+ // Get window configuration
|
|
|
+
|
|
|
+ // Default values
|
|
|
+ const char *title = NULL;
|
|
|
+ int __x = 0, __y = 0, __width = 1280, __height = 800;
|
|
|
+
|
|
|
+ if (game->getConfig())
|
|
|
+ {
|
|
|
+ Properties* config = game->getConfig()->getNamespace("window", true);
|
|
|
+ if (config)
|
|
|
+ {
|
|
|
+ // Read window title.
|
|
|
+ title = config->getString("title");
|
|
|
+
|
|
|
+ // Read window rect.
|
|
|
+ int x = config->getInt("x");
|
|
|
+ if (x != 0) __x = x;
|
|
|
+
|
|
|
+ int y = config->getInt("y");
|
|
|
+ if (y != 0) __y = y;
|
|
|
+ printf("custom x = %d, y = %d\n", x, y);
|
|
|
+ int width = config->getInt("width");
|
|
|
+ if (width != 0) __width = width;
|
|
|
+
|
|
|
+ int height = config->getInt("height");
|
|
|
+ if (height != 0) __height = height;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// Get the display and initialize.
|
|
|
__display = XOpenDisplay(NULL);
|
|
|
if (__display == NULL)
|
|
|
@@ -450,12 +479,12 @@ Platform* Platform::create(Game* game, void* attachToWindow)
|
|
|
GLint winMask;
|
|
|
winMask = CWBorderPixel | CWBitGravity | CWEventMask| CWColormap;
|
|
|
|
|
|
- __window = XCreateWindow(__display, DefaultRootWindow(__display), 0, 0, 1280, 720, 0,
|
|
|
+ __window = XCreateWindow(__display, DefaultRootWindow(__display), __x, __y, __width, __height, 0,
|
|
|
visualInfo->depth, InputOutput, visualInfo->visual, winMask,
|
|
|
&winAttribs);
|
|
|
|
|
|
XMapWindow(__display, __window);
|
|
|
- XStoreName(__display, __window, "");
|
|
|
+ XStoreName(__display, __window, title ? title : "");
|
|
|
|
|
|
__context = glXCreateContext(__display, visualInfo, NULL, True);
|
|
|
if(!__context)
|