@Zotoaster
Javascript can do just that. C++0x can too (VC++ 2010).
@IanM
Just watched that video. It's a technique I've used a few times before but never really considered as a serious option, mainly due to my prejudice about it not being OOP

.
However, I can see that it's a much better way of doing things, at least when hardware acceleration is used anyway.
I had this code lying around from the last time I used an immediate mode GUI:
function updateInput()
omc = msc
msc = mouseclick()
msd = msc-omc
omx = msx
omy = msy
msx = mousex()
msy = mousey()
mmz = mousemovez()
mmx = msx-omx
mmy = msy-omy
endfunction
function updateButton(x, y, w, h, t$, checked)
inButton = (msx >= x) and (msx <= x+w) and (msy >= y) and (msy <= y+h)
pressed = inButton and ((msc = 1) or (msd = -1))
box x, y, x+w+1, y+h+1, 0xFFCC0000, 0xFFCC0000, 0xFFCC0000, 0xFFCC0000
if pressed or checked
box x+1, y+1, x+w, y+h, 0xFF00FF00, 0xFF00CC00, 0xFF00FF00, 0xFF00CC00
else
if inButton
box x+1, y+1, x+w, y+h, 0xFF00CC00, 0xFF00FF00, 0xFF00CC00, 0xFF00FF00
else
box x+1, y+1, x+w, y+h, 0xFF808080, 0xFFAAAAAA, 0xFF808080, 0xFFAAAAAA
endif
endif
ink 0,0
center text x+w/2, y+h/2-7, t$
clicked = inButton and (msd = -1)
endfunction clicked
global activeTextBox = 0
function updateTextBox(x, y, w, h, t$, id)
inBox = (msx >= x) and (msx <= x+w) and (msy >= y) and (msy <= y+h)
box x, y, x+w+1, y+h+1, 0xFFCC0000, 0xFFCC0000, 0xFFCC0000, 0xFFCC0000
if inBox and msd = 1
activeTextBox = id
set entry buffer t$
endif
ink 0,0
if activeTextBox = id
if returnkey()
activeTextBox = 0
else
t$ = entry$(1)
endif
box x+1, y+1, x+w, y+h, 0xFFFFFFAA, 0xFFFFFFAA, 0xFFFFFFAA, 0xFFFFFFAA
text x+2, y+h/2-7, t$ + "_"
else
box x+1, y+1, x+w, y+h, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
text x+2, y+h/2-7, t$
endif
endfunction t$
function updateLabel(x, y, w, h, t$)
ink 0xFFFFFFFF,0
text x+2, y+h/2-7, t$
endfunction
function updateCheckBox(x, y, w, h, checked)
inBox = (msx >= x) and (msx <= x+w) and (msy >= y) and (msy <= y+h)
box x, y, x+w+1, y+h+1, 0xFFCC0000, 0xFFCC0000, 0xFFCC0000, 0xFFCC0000
if inBox and msd = 1
checked = 1-checked
endif
if inBox
box x+1, y+1, x+w, y+h, 0xFF00CC00, 0xFF00FF00, 0xFF00CC00, 0xFF00FF00
else
box x+1, y+1, x+w, y+h, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
endif
if checked
ink 0,0
line x+1, y+1, x+w, y+h
line x+1, y+h-1, x+w, y
line x+2, y+1, x+w, y+h-1
line x+2, y+h-1, x+w, y+1
line x+1, y+2, x+w-1, y+h
line x+1, y+h-2, x+w-1, y
endif
endfunction checked
global scrollbarDragId = 0
global scrollbarOffset = 0
function updateScrollBar(x, y, w, h, pos, lineCount, pageSize, id)
inScrollBar = (msx >= x) and (msx <= x+w) and (msy >= y) and (msy <= y+h)
if lineCount < pageSize then lineCount = pageSize
frac# = (pageSize*1.0)/(lineCount*1.0)
barSize = frac#*h
if pos < 0 then pos = 0
if pos > lineCount-pageSize then pos = lineCount-pageSize
if scrollbarDragId = id
barPos = msy + scrollbarOffset
if barPos < y then barPos = y
if barPos > y+h-barSize then barPos = y+h-barSize
if lineCount = pageSize
pos = 0
else
pos = (barPos-y)*(lineCount-pageSize)*1.0/(h-barSize) + 0.5
endif
if msc <> 1 then scrollbarDragId = 0
else
if lineCount = pageSize
barPos = y
else
barPos = y + pos*(h-barSize)/(lineCount-pageSize)
endif
endif
inBar = inScrollBar and (msy >= barPos) and (msy <= barPos+barSize)
if (msd = 1) and inScrollBar
if inBar
scrollbarDragId = id
scrollbarOffset = barPos-msy
else
if msy < barPos
dec pos, pageSize
else
inc pos, pageSize
endif
if pos < 0 then pos = 0
if pos > lineCount-pageSize then pos = lineCount-pageSize
endif
endif
box x, y, x+w, y+h, 0xFF8080B0, 0xFF8080B0, 0xFFFFFFFF, 0xFFFFFFFF
box x, barPos, x+w, barPos+barSize, 0xFFCCCCFF, 0xFFCCCCFF, 0xFF8080FF, 0xFF8080FF
box outline x, barPos, x+w, barPos+barSize, 0xFFCC0000
endfunction pos
It doesn't require any plugins. You just need to call 'updateInput()' once a loop, and then call 'updateXXX' to draw a control.
[b]
