Rev 7858 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7858 | Rev 8177 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | package kernel |
1 | package kernel |
2 | import "os" |
2 | import "os" |
- | 3 | import "colors" |
|
Line -... | Line 4... | ||
- | 4 | ||
- | 5 | const ( |
|
- | 6 | Btn1=2; |
|
- | 7 | Btn2=3; |
|
- | 8 | BtnExit=1; |
|
- | 9 | ) |
|
- | 10 | ||
- | 11 | func RedrawAll(bar_pos int){ |
|
- | 12 | btn_txt1:=" <- " |
|
- | 13 | btn_txt2:=" -> " |
|
- | 14 | str:="I love KolibriOS" |
|
- | 15 | title:="Test Golang" |
|
- | 16 | os.Redraw(1) |
|
- | 17 | os.Window(500,250,420,200, title) |
|
- | 18 | os.WriteText(32,32, 0x11000000 | colors.Green,str, 10) |
|
- | 19 | os.DrawLine(32, 80, 150, 80, colors.Green) |
|
- | 20 | os.CreateButton(32, 128, 80, 30, Btn1, colors.Blue); |
|
- | 21 | os.CreateButton(300, 128, 80, 30, Btn2, colors.Blue); |
|
- | 22 | os.WriteText(32,128, 0x11000000 | colors.White,btn_txt1, 10) |
|
- | 23 | os.WriteText(320,128, 0x11000000 | colors.White,btn_txt2, 10) |
|
Line 3... | Line 24... | ||
3 | 24 | } |
|
- | 25 | ||
- | 26 | func Load() { |
|
- | 27 | time := os.GetTime() |
|
4 | 28 | os.DebugOutStr("Time: ") |
|
5 | func Load() { |
29 | os.DebugOutHex(time) |
6 | x := "test" |
30 | var pos=32; |
7 | for true { |
- | |
8 | switch os.Event() { |
31 | for true { |
9 | 32 | switch os.Event() { |
|
- | 33 | case os.EVENT_REDRAW: |
|
- | 34 | RedrawAll(pos) |
|
- | 35 | break |
|
- | 36 | case os.EVENT_BUTTON: |
|
10 | case 1: |
37 | switch os.GetButtonID() { |
11 | os.Redraw(1) |
38 | case Btn1: |
12 | os.Window(50,250,450,200,x) |
39 | pos-=32 |
13 | os.Redraw(2) |
40 | RedrawAll(pos) |
- | 41 | break |
|
- | 42 | case Btn2: |
|
- | 43 | pos+=32 |
|
- | 44 | RedrawAll(pos); |
|
14 | os.Sleep(100) |
45 | break |
15 | case 3: |
46 | case BtnExit: |
16 | os.Exit() |
47 | os.Exit() |
17 | } |
48 | } |
- | 49 | } |