2020-05-03 11:30:20 +02:00
|
|
|
package kernel
|
2020-11-12 01:57:05 +01:00
|
|
|
|
2020-05-03 11:30:20 +02:00
|
|
|
import "os"
|
2020-11-12 01:43:46 +01:00
|
|
|
import "colors"
|
2020-05-03 11:30:20 +02:00
|
|
|
|
2020-11-12 01:43:46 +01:00
|
|
|
const (
|
|
|
|
Btn1=2;
|
|
|
|
Btn2=3;
|
|
|
|
BtnExit=1;
|
|
|
|
)
|
|
|
|
|
|
|
|
func RedrawAll(bar_pos int){
|
2021-07-12 14:28:41 +02:00
|
|
|
os.Redraw(1)
|
|
|
|
os.Window(500,250,420,200, "Test Golang")
|
2020-11-12 01:43:46 +01:00
|
|
|
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);
|
2021-07-12 14:28:41 +02:00
|
|
|
os.WriteText(32,128, 0x11000000 | colors.White," <- ")
|
|
|
|
os.WriteText(320,128, 0x11000000 | colors.White," -> ")
|
|
|
|
os.DrawBar(bar_pos, 90, 100, 30, colors.Red);
|
2020-11-12 01:43:46 +01:00
|
|
|
}
|
2020-05-03 11:30:20 +02:00
|
|
|
|
|
|
|
func Load() {
|
2021-07-12 14:28:41 +02:00
|
|
|
//time := os.GetTime()
|
|
|
|
//os.DebugOutStr("Time: ")
|
|
|
|
//os.DebugOutHex(time)
|
2020-11-12 01:43:46 +01:00
|
|
|
var pos=32;
|
|
|
|
for true {
|
|
|
|
switch os.Event() {
|
|
|
|
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()
|
|
|
|
}
|
2020-05-03 11:30:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|