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

#constant OPTION_YES = 1
#constant OPTION_NO = 2
#constant OPTION_MAYBE = 3
option as integer = OPTION_NO
flags as integer = 0
flags = NK_WINDOW_BORDER||NK_WINDOW_MOVABLE||NK_WINDOW_TITLE||NK_WINDOW_SCALABLE
do
	// pass agk inputs to nuklear
    nk.HandleInput()

	if nk.WindowBegin("Nuklear Window - Text, Buttons & Toggles", 40, 50, 500, 240, flags)
		
		// Three buttons are created that are evenly divided over the whole
		// row. The first button is a common label button. The second one
		// is a color button. The last one is a label button with symbol.
		// The button commands return 1 when they have been pressed. If 
		// you want to react to them, you should query them with an 
		// if-statement.
		nk.LayoutRowStatic(25, 150, 3)
		nk.ButtonLabel("Label Button")
		nk.ButtonColor(MakeColor(225,128,0))
		nk.ButtonSymbolLabel(NK_SYMBOL_TRIANGLE_RIGHT, "Label+Symbol", NK_TEXT_RIGHT)
		
		// 'Label' is used for the text display. For longer texts 
		// 'LabelWrap' is suitable.
		nk.LayoutRowDynamic(20, 1)
		nk.Label("Common Label", NK_TEXT_LEFT)
		nk.LabelColored("Common Color Label", NK_TEXT_RIGHT, makecolor(255,255,0))
		nk.LayoutRowDynamic(40, 1)
		nk.LabelWrap("And a very long text can be gwraped. If this text would take several lines. However, the layout should also provide the space. There is no scrollbar to display the text completely.")
		
		// Option widgets and Checkbox widget are both toggles. While 
		// Options follows an - either or - strategy, checkboxes allow 
		// combinations. Or they stand alone and give the possibility to 
		// turn something on or off.
		nk.LayoutRowDynamic(20, 3)
		if nk.OptionLabel("YES", option = OPTION_YES) then option = OPTION_YES
		if nk.OptionLabel("NO", option = OPTION_NO) then option = OPTION_NO
		if nk.OptionLabel("MAYBE", option = OPTION_MAYBE) then option = OPTION_MAYBE

		flags = nk.CheckboxFlagsLabel("Border", flags, NK_WINDOW_BORDER)
		flags = nk.CheckboxFlagsLabel("Movable", flags, NK_WINDOW_MOVABLE)
		flags = nk.CheckboxFlagsLabel("Scalable", flags, NK_WINDOW_SCALABLE)
		flags = nk.CheckboxFlagsLabel("Closable", flags, NK_WINDOW_CLOSABLE)
		flags = nk.CheckboxFlagsLabel("Minimizable", flags, NK_WINDOW_MINIMIZABLE)
		flags = nk.CheckboxFlagsLabel("No Scrollbar", flags, NK_WINDOW_NO_SCROLLBAR)
		flags = nk.CheckboxFlagsLabel("Title", flags, NK_WINDOW_TITLE)
	endif
	nk.WindowEnd()
	
    nkSync()
loop
