Posted: 3rd Nov 2021 13:54
Hello, MadBit and Guys.

Is it a standard specification of nuklear GUI that nkSysc() does not support fullscreen by SetWindowSize(x, y, 1)?

+ Code Snippet
// Project: fullscreen_with_nk 
// Created: 2021-11-03

// plugins
#import_plugin Nuklear as nk

// show all errors
SetErrorMode(2)

//
#option_explicit

//
#constant WINDOW_W 1024
#constant WINDOW_H 768
#constant FPS_MAX 30
#constant KEY_F4 115

// set window properties
SetWindowTitle( "fullscreen" )
SetWindowSize( WINDOW_W, WINDOW_H, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( WINDOW_W, WINDOW_H ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( FPS_MAX, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts

#insert "Nuklear.agc"
nkInit()

global flg_winfull as integer
flg_winfull = 0

CreateBgImage()

do
	nk.HandleInput()
    // anything nk script ...

    //Print( ScreenFPS() )
    Print("Press F4 key.")
    ToogleWindowSize()
    nkSync()
loop


function ToogleWindowSize()
	if GetRawKeyReleased(KEY_F4)
		if flg_winfull = 0
			flg_winfull = 1
			SetWindowSize(WINDOW_W, WINDOW_H, 1)
		else
			flg_winfull = 0
			SetWindowSize(WINDOW_W, WINDOW_H, 0)
		endif
	endif
endfunction


function CreateBgImage()
	cr as integer
	cr = MakeColor(0, 0, 255)
	
	DrawBox(0, 0, WINDOW_W, WINDOW_H, cr, cr, cr, cr, 1)
	Render()
	GetImage(1, 0, 0, WINDOW_W, WINDOW_H)
	CreateSprite(1, 1)
	SetSpritePosition(1, 0, 0)
endfunction
Posted: 5th Nov 2021 10:04
Hello,
sorry for the late reply.
The default behaviour of the plugin is that the virtual resolution changes to match the window size.
This means that if you have a Full HD monitor and then switch to Fullscreen, the virtual resolution changes to 1920x1080.
If you do not want this, you should call the command nk.FixedVirtualResolution(1) after nkInit. Then the virtual resolution remains at 1024x768 or what you have set.
Posted: 5th Nov 2021 12:00
Thank you.
It now works as intended.