fixed linker and syscall
git-svn-id: svn://kolibrios.org@9063 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -9,40 +9,67 @@ const (
|
||||
BtnExit=1;
|
||||
)
|
||||
|
||||
func RedrawAll(bar_pos int){
|
||||
os.Redraw(1)
|
||||
os.Window(500,250,420,200, "Test Golang")
|
||||
os.DrawLine(32, 80, 150, 80, colors.Green)
|
||||
os.CreateButton(32, 128, 80, 30, Btn1, colors.Blue);
|
||||
os.CreateButton(300, 128, 80, 30, Btn2, colors.Blue);
|
||||
os.WriteText(32,128, 0x11000000 | colors.White," <- ")
|
||||
os.WriteText(320,128, 0x11000000 | colors.White," -> ")
|
||||
os.DrawBar(bar_pos, 90, 100, 30, colors.Red);
|
||||
type Button struct { // structure gui button
|
||||
label string
|
||||
x int
|
||||
y int
|
||||
id int
|
||||
}
|
||||
|
||||
func Load() {
|
||||
func NewButton() Button {
|
||||
object := Button{"Text",0,0,Btn1} // default data
|
||||
return object
|
||||
}
|
||||
|
||||
func (button *Button) make() {
|
||||
os.CreateButton(button.x, button.y, len(button.label)*15, 30, button.id, colors.Blue);
|
||||
os.WriteText(button.x,button.y, 0x11000000 | colors.White, button.label)
|
||||
}
|
||||
|
||||
func RedrawAll(bar_pos int){
|
||||
os.Redraw(1)
|
||||
os.Window(500,250,420,200, "Example GoLang")
|
||||
os.DrawLine(32, 80, 150, 80, colors.Green)
|
||||
os.DrawBar(bar_pos, 90, 100, 30, colors.Red);
|
||||
|
||||
b1 := NewButton()
|
||||
b1.label = " <- "
|
||||
b1.x = 32
|
||||
b1.y = 128
|
||||
b1.id = Btn1
|
||||
b1.make()
|
||||
|
||||
b2 := NewButton()
|
||||
b2.label = " -> "
|
||||
b2.x = 310
|
||||
b2.y = 128
|
||||
b2.id = Btn2
|
||||
b2.make()
|
||||
}
|
||||
|
||||
func Main() {
|
||||
var pos = 160;
|
||||
//time := os.GetTime()
|
||||
//os.DebugOutStr("Time: ")
|
||||
//os.DebugOutHex(time)
|
||||
var pos=32;
|
||||
for true {
|
||||
switch os.Event() {
|
||||
case os.EVENT_REDRAW:
|
||||
case os.EVENT_REDRAW:
|
||||
RedrawAll(pos)
|
||||
break
|
||||
case os.EVENT_BUTTON:
|
||||
switch os.GetButtonID() {
|
||||
case Btn1:
|
||||
pos-=32
|
||||
RedrawAll(pos)
|
||||
break
|
||||
case Btn2:
|
||||
pos+=32
|
||||
RedrawAll(pos);
|
||||
break
|
||||
case BtnExit:
|
||||
os.Exit()
|
||||
}
|
||||
switch os.GetButtonID() {
|
||||
case Btn1:
|
||||
pos-=32
|
||||
RedrawAll(pos)
|
||||
break
|
||||
case Btn2:
|
||||
pos+=32
|
||||
RedrawAll(pos);
|
||||
break
|
||||
case BtnExit:
|
||||
os.Exit()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user