#import_plugin Nuklear as nk

// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "First Nuklear Window" )
SetWindowSize( 1280, 720, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1280, 720 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 0, 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"

// basic nuklear initialization
nkInit()

new_style as String
other_style as String

// load two styles in seperates strings
OpenToRead(1,"new_style.skin"): new_style = ReadString(1): CloseFile(1) 
OpenToRead(1,"other_style.skin"): other_style = ReadString(1): CloseFile(1) 

// set the style to new_style at the beginning
nk.StyleLoadFromString(new_style)

mode as Integer = 1
do
	// pass agk inputs to nuklear
    nk.HandleInput()

	if nk.WindowBegin("Manipulate Context Style Part 2", 30, 50, 1220, 240, NK_WINDOW_BORDER||NK_WINDOW_MOVABLE||NK_WINDOW_TITLE)
		// layout for three buttons.
		nk.LayoutRowStatic(40, 260, 3)
		
		// set buttons to new_style.
		if nk.ButtonLabel("New Style") And mode = 1
			nk.StyleLoadFromString(new_style)
			mode = 0
		endif
		
		// no matter which style is currently active this button uses 
		// its own style.
		nk.ButtonLabelStyled("disabled_button", "Button Inaktive")
		
		// set buttons to other_style
		if nk.ButtonLabel("Other Style") And mode = 0
			nk.StyleLoadFromString(other_style)
			mode = 1
		endif

	endif
	nk.WindowEnd()
		
    nkSync()
loop
