Subversion Repositories Kolibri OS

Rev

Rev 8178 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
8178 superturbo 1
package kernel
2
 
3
import "os"
4
import "colors"
5
 
6
const (
7
    Btn1=2;
8
    Btn2=3;
9
    BtnExit=1;
10
)
11
 
12
func RedrawAll(bar_pos int){
9053 pavelyakov 13
    os.Redraw(1)
14
    os.Window(500,250,420,200, "Test Golang")
8178 superturbo 15
    os.DrawLine(32, 80, 150, 80, colors.Green)
16
    os.CreateButton(32, 128, 80, 30, Btn1, colors.Blue);
17
    os.CreateButton(300, 128, 80, 30, Btn2, colors.Blue);
9053 pavelyakov 18
    os.WriteText(32,128, 0x11000000 | colors.White," <- ")
19
    os.WriteText(320,128, 0x11000000 | colors.White," -> ")
20
    os.DrawBar(bar_pos, 90, 100, 30, colors.Red);
8178 superturbo 21
}
22
 
23
func Load() {
9053 pavelyakov 24
    //time := os.GetTime()
25
    //os.DebugOutStr("Time: ")
26
    //os.DebugOutHex(time)
8178 superturbo 27
    var pos=32;
28
    for true {
29
        switch os.Event() {
30
			case os.EVENT_REDRAW:
31
                RedrawAll(pos)
32
                break
33
            case os.EVENT_BUTTON:
34
                switch os.GetButtonID() {
35
                    case Btn1:
36
                        pos-=32
37
                        RedrawAll(pos)
38
                        break
39
                    case Btn2:
40
                        pos+=32
41
                        RedrawAll(pos);
42
                        break
43
                    case BtnExit:
44
                        os.Exit()
45
                }
46
		}
47
	}
48
}