Jump to content

[SOLVED] Setting Window size in code


photo

Recommended Posts

Hi, is it possible to set window size through code?

 

This forum thread indicates that we should use App::setVideoMode

 

https://developer.unigine.com/forum/topic/3550-how-to-manipulate-app-window-size/?hl=window+size#entry18743

 

But that causes a crash, as indicated by this thread:

 

https://developer.unigine.com/forum/topic/2181-solved-set-video-mode-fatal-error/?hl=setVideoMode#entry11925

 

The second thread indicates we should do this through the console.

 

However, I've used video_height, video_width, and video_mode console commands, and none of them do anything.

 

In the attached screen capture, you can see me trying out different modes, and yet the screen is still 1600x900.

 

post-1922-0-46531700-1458594705_thumb.jpg

 

Help, please?

Link to comment

Ok, I see I need to execute the video_restart command after any of those other commands.  But is there a way I can just set the initial video resolution without having to restart?

Link to comment

Hello Joseph
You can set custom videomode with console commands.
video_mode must be established to "-1" (see documentation - https://developer.unigine.com/en/docs/2.2/code/command_linein "Video settings chapter")
Also, set parameter "video_resizable" to "off"
For example, your console command could be next:
video_mode -1 && video_resizable 0 && video_width 300 && video_height 300 && video_restart (see attached screenshot)

What about methods App:: setVideoMode / restoreVideoMode:
* if you want change video-mode then you can't use it ,
* if you make your custom App (using inheritance of AppClass) then you can override this methods - we will add notices in our documentation

Sorry for inconvenience caused.

post-20-0-53569600-1458645680_thumb.png

Link to comment

Using the console commands just doesn't work very well for me.  I mean, I can get the window to resize, but I have to restart the window, which isn't ideal.  However, I discovered the command-line parameters for setting the video mode, and that seems to work just fine for me.

 

Thanks

Link to comment
×
×
  • Create New...