summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-09-16 00:21:09 +0000
committerIan C <ianc@noddybox.co.uk>2005-09-16 00:21:09 +0000
commitdc296ce6322ec28ca30bddc1b881b09c2998aa61 (patch)
tree43aa2315757da794f011d44a2f8266978bb39907
parentf460a00c347b44b7633366275e56a1f2b34b7fa7 (diff)
*** empty log message ***
-rw-r--r--simplegui/font.bmfbin24420 -> 19840 bytes
-rw-r--r--simplegui/test.bmx66
2 files changed, 45 insertions, 21 deletions
diff --git a/simplegui/font.bmf b/simplegui/font.bmf
index 38378e6..8ef2706 100644
--- a/simplegui/font.bmf
+++ b/simplegui/font.bmf
Binary files differ
diff --git a/simplegui/test.bmx b/simplegui/test.bmx
index aaf94c2..f0ecc48 100644
--- a/simplegui/test.bmx
+++ b/simplegui/test.bmx
@@ -13,40 +13,64 @@ Graphics SCRW,SCRH,32,60' Or HARDSYNC
font:TBitmapFont=TBitmapFont.Load("incbin::font.bmf",0)
-gui:TGUIHandler=TGUIHandler.Create()
+TGUIFont.font=font
-label1:TLabel=TLabel.Create(font,0,0,"Text 1: ")
-label2:TLabel=TLabel.Create(font,0,20,"Text 2: ")
-text1:TText=TText.Create(font,label1.w,0,"Text entry 1",20)
-text2:TText=TText.Create(font,label2.w,20,"Text entry 2",30)
+Global gui:TGUIHandler=TGUIHandler.Create()
-gui.Register(label1)
-gui.Register(label2)
-gui.Register(text1)
-gui.Register(text2)
+Global label1:TLabel=TLabel.Create(gui,0,0,"Text 1: ")
+Global label2:TLabel=TLabel.Create(gui,0,20,"Text 2: ")
+Global text1:TText=TText.Create(gui,label1.w,0,"Text entry 1",20,TextCallback)
+Global text2:TText=TText.Create(gui,label2.w,20,"Text entry 2",30)
+Global check1:TCheckbox=TCheckbox.Create(gui,400,0,"Check 1",CheckCallback)
+Global check2:TCheckbox=TCheckbox.Create(gui,400,20,"Check 2")
+Global button1:TButton=TButton.Create(gui,0,360,100,30,"Button 1",ButtonCallback)
+Global button2:TButton=TButton.Create(gui,110,360,100,30,"Quit",ButtonCallback)
SetBlend(ALPHABLEND)
-While Not KeyHit(KEY_ESCAPE)
+Global quit=False
+
+While Not KeyHit(KEY_ESCAPE) And Not quit
Cls
- If KeyHit(KEY_F1)
- gui.SetFocus(Null)
- EndIf
-
- If KeyHit(KEY_F2)
- gui.SetFocus(text1)
- EndIf
+ gui.EventLoop()
- If KeyHit(KEY_F3)
- gui.SetFocus(text2)
+ If KeyHit(KEY_MOUSERIGHT)
+ Menu()
EndIf
- gui.EventLoop()
-
Flip
FlushMem
Wend
EndGraphics
End
+
+Function TextCallback(w:TWidget)
+ GUINotify(w.Text)
+End Function
+
+Function CheckCallback(w:TWidget)
+ Local c:TCheckbox=TCheckbox(w)
+
+ check2.enabled=c.checked
+ text2.enabled=c.checked
+ button2.enabled=c.checked
+End Function
+
+Function ButtonCallback(w:TWidget)
+ If w.text="Quit"
+ quit=GUIYesNo("Really quit this really rather impressive (cough) demo?")
+ Else
+ GUINotify(w.text + " pressed")
+ EndIf
+End Function
+
+
+Function Menu()
+ Local opt:Int=GUIMenu("A long long Menu",["Option 1","Option 2","Option 3"],MouseX(),MouseY())
+
+ If opt>-1
+ GUINotify("Selected " + opt)
+ EndIf
+End Function \ No newline at end of file