Immediate Mode GUI

Previous topic - Next topic

MrTAToad

#15
This is a quick test program showing horizontal & vertical bar values being displayed with static text boxes.  Clicking on the button updates the progress bar.

And this example program looks like :

Code (glbasic) Select
// --------------------------------- //
// Project: TestIMGui
// Start: Thursday, December 22, 2011
// IDE Version: 10.209

LOCAL imGui AS TIMGui_Base
LOCAL win1%,win2%,win3%,win4%,win5%,win6%,win7%,win8%,win9%,winA%,winB%,winC%
LOCAL itemID1%,itemID2%,itemID3%,itemID4%,itemID5%,itemID6%,itemID7%,itemID8%,itemID9%,itemIDA%,itemIDB%,itemIDC%,itemIDD%,itemIDE%
LOCAL horzPos%,vertPos%,buttText%,overText%,prog%

LOADSPRITE "Media/Untitled.png",0

imGui.Initialise()
win1%=imGui.CreateWindow("test",0,0,300,300,0,"Test Window 1",RGB(200,200,200),RGB(128,128,128),RGB(255,0,0),FLAGS_WINDOW_USECLOSEICON%+FLAGS_WINDOW_USEMINIMUSEICON%+FLAGS_WINDOW_USERESTOREICON%+FLAGS_WINDOW_SYSTEMAREA%)
itemID6%=imGui.CreateSlider(win1%,FALSE,0,0,80,RGB(128,128,128),100,0.0,0)
itemID7%=imGui.CreateSlider(win1%,TRUE,0,17,80,RGB(128,128,128),100,0.0,0)
itemID1%=imGui.CreateButton(win1%,32,32,32,32,0,"Example",RGB(200,200,200),RGB(128,128,128),FLAGS_TEXT_LEFTALIGN%)
imGui.CreateStaticText(win1%,40,100,0,"Slider Positions :",0,0)
horzPos%=imGui.CreateStaticText(win1%,0,116,0,"-/-",0,FLAGS_TEXT_LEFTALIGN%)
vertPos%=imGui.CreateStaticText(win1%,100,116,0,"-/-",0,FLAGS_TEXT_LEFTALIGN%)
buttText%=imGui.CreateStaticText(win1%,0,132,0,"-",100,FLAGS_TEXT_LEFTALIGN%)
overText%=imGui.CreateStaticText(win1%,0,160,0,"-",100,FLAGS_TEXT_LEFTALIGN%)
prog%=imGui.CreateProgress(win1%,0,200,0,0,RGB(255,0,0),0,FLAGS_PROGRESS_DISPLAYPERCENTAGE%)
imGui.SetSystemText(win1%,"This is a test")

SYSTEMPOINTER TRUE
WHILE TRUE
imGui.Process()
SHOWSCREEN

// Update horizontal values
imGui.SetStaticText(win1%,horzPos%,FORMAT$(2,2,imGui.GetSliderRailValue(win1%,itemID6%))+"/"+FORMAT$(2,2,imGui.GetSliderValue(win1%,itemID6%)))
imGui.SetStaticText(win1%,vertPos%,FORMAT$(2,2,imGui.GetSliderRailValue(win1%,itemID7%))+"/"+FORMAT$(2,2,imGui.GetSliderValue(win1%,itemID7%)))

IF imGui.IsButtonPressed(win1%,itemID1%)
imGui.SetStaticText(win1%,buttText%,"Button ID "+itemID1%+" is pressed")
imGui.Progress_StepIt(win1%,prog%)
ELSE
imGui.SetStaticText(win1%,buttText%,"Button ID "+itemID1%+" is not pressed")
ENDIF

imGui.SetStaticText(win1%,overText%,"But Focus : "+imGui.IsItemFocus(win1%,itemID1%)+" H Slider : "+imGui.IsItemFocus(win1%,itemID6%))
WEND


As you can see it should be easy enough to use :)

[attachment deleted by admin]

Schranz0r

not bad!!
I like it!
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard