I just noticed that the above example is not really understandable. Here I show how to create a small demo window. This is the first test run I had done. Without skinning.
#import_plugin Nuklear as nk
// Project: Nuklear_Test1
// Created: 2020-05-13
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Nuklear_Test1" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // 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"
nk.Init()
nk.FontStashBegin()
nk.FontStashEnd()
property as integer
op as integer
bgi as integer
bg as nk_colorf
do
nk.HandleInput()
if(nk.WindowBegin("Demo", 150, 50, 230, 250, 0x57))
nk.LayoutRowStatic(30,80,1)
if(nk.ButtonLabel("Button")) then print("Button pressed")
nk.LayoutRowDynamic(30,2)
if(nk.OptionLabel("easy", op=0)) then op = 0
if(nk.OptionLabel("hard", op=1)) then op = 1
nk.LayoutRowDynamic(22,1)
property = nk.PropertyInteger("Compression:", 0, property, 100, 10, 1)
nk.LayoutRowDynamic(20,1)
nk.Label("background: "+Hex(bgi), 17)
nk.LayoutRowDynamic(25,1)
if(nk.ComboBeginColor(bg.r*255, bg.g*255, bg.b*255, bg.a*255, nk.WidgetWidth(), 400))
nk.LayoutRowDynamic(250,1)
bgi = nk.ColorPicker(bg.r, bg.g, bg.b, bg.a, 1)
print(hex(bgi))
bg = nkColorFFromInt(bgi)
nk.LayoutRowDynamic(25,1)
bg.r = nk.PropertyFloat("#R:", 0, bg.r, 1.0, 0.01, 0.005)
bg.g = nk.PropertyFloat("#G:", 0, bg.g, 1.0, 0.01, 0.005)
bg.b = nk.PropertyFloat("#B:", 0, bg.b, 1.0, 0.01, 0.005)
bg.a = nk.PropertyFloat("#A:", 0, bg.a, 1.0, 0.01, 0.005)
nk.ComboEnd()
endif
endif
nk.WindowEnd()
Print( ScreenFPS() )
nkSync()
loop
This is the result
Share your knowledge. It\'s a way to achieve immortality.
(Tenzin Gyatso)