+ int value[2];
+ /* Uncomment when multiple windows are supported
+ if(positionUse) {
+ value[0] = x;
+ value[1] = y;
+ if (screen_set_window_property_iv(sWindow, SCREEN_PROPERTY_POSITION, value)) {
+ screen_destroy_window(sWindow);
+ fgError("Could not set window position");
+ return;
+ }
+ }*/
+
+ if(sizeUse) {
+ /* Uncomment when multiple windows are supported
+ value[0] = w;
+ value[1] = h;
+ */
+ //TEMP until ^^ is uncommented
+ if (screen_get_window_property_iv(sWindow, SCREEN_PROPERTY_BUFFER_SIZE, value)) {
+ screen_destroy_window(sWindow);
+ fgError("Could not get window mode");
+ return;
+ }
+ } else {
+ /* From PlatformBlackBerry in GamePlay3d */
+ screen_display_t display;
+ if (screen_get_window_property_pv(sWindow, SCREEN_PROPERTY_DISPLAY, (void**)&display)) {
+ screen_destroy_window(sWindow);
+ fgError("Could not get window display");
+ return;
+ }
+
+ screen_display_mode_t displayMode;
+ if (screen_get_display_property_pv(display, SCREEN_PROPERTY_MODE, (void**)&displayMode)) {
+ screen_destroy_window(sWindow);
+ fgError("Could not get display mode");
+ return;
+ }
+
+ if (screen_get_window_property_iv(sWindow, SCREEN_PROPERTY_BUFFER_SIZE, value)) {
+ screen_destroy_window(sWindow);
+ fgError("Could not get window mode");
+ return;
+ }
+
+ /* Adjust buffer sizes based on rotation */
+ if ((orientation == 0) || (orientation == 180))
+ {
+ if (((displayMode.width > displayMode.height) && (value[0] < value[1])) ||
+ ((displayMode.width < displayMode.height) && (value[0] > value[1])))
+ {
+ int tmp = value[1];
+ value[1] = value[0];
+ value[0] = tmp;
+ }
+ }
+ else if ((orientation == 90) || (orientation == 270))
+ {
+ if (((displayMode.width > displayMode.height) && (value[0] > value[1])) ||
+ ((displayMode.width < displayMode.height) && (value[0] < value[1])))
+ {
+ int tmp = value[1];
+ value[1] = value[0];
+ value[0] = tmp;
+ }
+ }
+ else
+ {
+ screen_destroy_window(sWindow);
+ fgError("Unexpected rotation angle");
+ return;
+ }
+ }
+
+ /* Set rotation if usage allows it */
+ if (screen_set_window_property_iv(sWindow, SCREEN_PROPERTY_ROTATION, &orientation)) {
+ screen_destroy_window(sWindow);
+ fgError("Could not set window rotation");
+ return;
+ }
+ window->State.pWState.originalRotation = orientation;
+
+ /* Set buffer sizes */
+ if (screen_set_window_property_iv(sWindow, SCREEN_PROPERTY_BUFFER_SIZE, value)) {