Jump to content

[SOLVED] Window resize flag.


photo

Recommended Posts

Hi,

I'm working on an app that requires resize the window on the fly. In docs is specified that you need to set a flag to allow the window resize when you use setWidth and setHeight functions. I know that using the function "setVideoMode" from app class i can specify the flag required (APP_INDEPENDENT_SIZE_WINDOW) , but this method restarts the window and creates another one with the new configuration. I need to avoid this restart so, researching the library i found that engine uses this function to create the first main window. Is there any way to specify the flag before the engine inits? Something like an entry parameter or a way to specify. I'm working on 2.7.3 version.

Edit: The function setVideoMode only can be used in c++, in doc specifies that the function exists in UnigineScript but the interpreter not include it and can't be called.

Thanks!

Edited by raul.salas
Link to comment

Hi silent,

Yes, i pass the next video command line options:

-video_app auto -video_vsync 0 -video_refresh 0 -video_mode 1 -video_resizable 1 -video_fullscreen 0 -video_debug 0 -video_gamma 1.0

Thanks!

Link to comment

Hi silent, 

Just create a new project and add this worldExpression node with a simple input test to change the resolution with the arrows. By default the project has the same parameters i post (video_resizable 1). Here is the node.

data.7z

Link to comment

Hi Raul,

It seems that there is a bug inside engine that always passes App::INDEPENDENT_SIZE_WINDOW flag causing window to stay at the initial width and height. engine.app.setVideoMode is not available in UnigineScript (that's another docs bug).

To workaround this issue you need to modify C++ part of the default application and call setVideoMode once in system logic that clears all the window flags:

// AppSystemLogic.cpp
#include "UnigineApp.h"

int AppSystemLogic::init() {
  Unigine::App::get()->setVideoMode(200, 200, 0); // workaround to reset flags
  
  return 1;
}

That will make code in your attachment to start work. However, resize window manually with a mouse will be impossible.

We will fix all of these issues in the upcoming SDK update.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

You can also try to patch engine sources in source/engine/framework/AppWindow.cpp. Find all strings (4 matches):

if ((app->window_flags & ~INDEPENDENT_SIZE_WINDOW) == 0)

and replace them with:

if ((app->window_flags & INDEPENDENT_SIZE_WINDOW) == 0)

In that case no workaround in system logic should be required.

Thanks!

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • silent changed the title to [SOLVED] Window resize flag.
×
×
  • Create New...