#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()

do
	// pass agk inputs to nuklear
    nk.HandleInput()

	if nk.WindowBegin("Nuklear Window - Sliders, Progressbars & Properties", 40, 50, 480, 240, NK_WINDOW_BORDER||NK_WINDOW_MOVABLE||NK_WINDOW_TITLE)
		
		// Two sliders are created here. The first is a float slider with 
		// a value range of 0-10.0 with a step size of 0.1.
		// The second is an integer slider with the value range 0-100 and 
		// a step size of 1.
		// Both functions return the changed value and must be filled with 
		// the current value (float_value#/int_value).
		ratio as float[1] = [0.9,0.1]
		nkLayoutRow(NK_DYNAMIC, 25, ratio)
		float_value# = nk.SliderFloat(0.0, float_value#, 10.0, 0.1)
		nk.Label(str(float_value#,2), NK_TEXT_CENTERED)
		int_value = nk.SliderInteger(0, int_value, 100, 1)
		nk.Label(str(int_value), NK_TEXT_CENTERED)
		
		// A progressbar can be changeable (NK_MODIFIABLE) or fixed 
		// (NK_FIXED). It needs the current value (int_value) and the 
		// maximum value. If it is a changeable progressbar the changed 
		// value is returned.
		nk.LayoutRowDynamic(30, 1)		
		nk.Progress(int_value, 100, NK_FIXED)
		
		// For Property widget a label is needed as well as min-, max- and the current value. At the end there is the step size for pressing the inc/dec buttons and the step size for dragging the mouse.
		float_value# = nk.PropertyFloat("The FLOAT value", 0.0, float_value#, 10.0, 0.25, 0.1)
		int_value = nk.PropertyInteger("THE INTEGER value", 0, int_value, 100, 5, 1)		
	endif
	nk.WindowEnd()
	
    nkSync()
loop
