Rev 7806 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7806 | Rev 9597 | ||
---|---|---|---|
1 | //Generated with Lev's C-- pack for HiAsm, www.hiasm.com |
1 | //Generated with Lev's C-- pack for HiAsm, www.hiasm.com |
2 | 2 | ||
3 | #define MEMSIZE 4096*400 |
3 | #define MEMSIZE 4096*400 |
4 | 4 | ||
5 | #include "../lib/kolibri.h" |
5 | #include "../lib/kolibri.h" |
6 | #include "../lib/gui.h" |
6 | #include "../lib/gui.h" |
7 | 7 | ||
8 | /*======================================================== |
8 | /*======================================================== |
9 | = = |
9 | = = |
10 | = DATA = |
10 | = DATA = |
11 | = = |
11 | = = |
12 | ========================================================*/ |
12 | ========================================================*/ |
13 | 13 | ||
14 | _rgb image[256*256]; |
14 | _rgb image[256*256]; |
15 | 15 | ||
16 | #define fw 256+167 |
16 | #define fw 256+167 |
17 | #define fh 290 |
17 | #define fh 290 |
18 | 18 | ||
19 | enum { |
19 | enum { |
20 | DRAW1_BTN=10, |
20 | DRAW1_BTN=10, |
21 | DRAW2_BTN, |
21 | DRAW2_BTN, |
22 | SETBG_BTN |
22 | SETBG_BTN |
23 | }; |
23 | }; |
24 | 24 | ||
25 | /*======================================================== |
25 | /*======================================================== |
26 | = = |
26 | = = |
27 | = MAIN CYCLE = |
27 | = MAIN CYCLE = |
28 | = = |
28 | = = |
29 | ========================================================*/ |
29 | ========================================================*/ |
30 | 30 | ||
31 | void main() |
31 | void main() |
32 | int id; |
32 | int id; |
33 | { |
33 | { |
34 | loop() switch(WaitEvent()) |
34 | loop() switch(WaitEvent()) |
35 | { |
35 | { |
36 | case evButton: |
36 | case evButton: |
37 | id=GetButtonID(); |
37 | id=GetButtonID(); |
38 | if (id==1) ExitProcess(); |
38 | if (id==1) ExitProcess(); |
39 | if (id==DRAW1_BTN) EventDraw1(); |
39 | if (id==DRAW1_BTN) EventDraw1(); |
40 | if (id==DRAW2_BTN) EventDraw2(); |
40 | if (id==DRAW2_BTN) EventDraw2(); |
41 | if (id==SETBG_BTN) EventSetBackground(#image,256,256); |
41 | if (id==SETBG_BTN) EventSetBackground(#image,256,256); |
42 | break; |
42 | break; |
43 | case evKey: |
43 | case evKey: |
44 | if (GetKeys()==27) ExitProcess(); |
44 | if (GetKeys()==27) ExitProcess(); |
45 | break; |
45 | break; |
46 | case evReDraw: |
46 | case evReDraw: |
47 | sc.get(); |
47 | sc.get(); |
48 | DefineAndDrawWindow(screen.width-fw/2,screen.height-fh/2,fw,fh+skin_height,0x33,0xE0DFE3,"Rainbow (rgb test)",0); |
48 | DefineAndDrawWindow(screen.w-fw/2,screen.h-fh/2,fw,fh+skin_h,0x33,0xE0DFE3,"Rainbow (rgb test)",0); |
49 | _PutImage(0,0,256,256,#image); |
49 | _PutImage(0,0,256,256,#image); |
50 | DrawCaptButton(280,20, 110,30,DRAW1_BTN,sc.button,sc.button_text,"Draw 1"); |
50 | DrawCaptButton(280,20, 110,30,DRAW1_BTN,sc.button,sc.button_text,"Draw 1"); |
51 | DrawCaptButton(280,60, 110,30,DRAW2_BTN,sc.button,sc.button_text,"Draw 2"); |
51 | DrawCaptButton(280,60, 110,30,DRAW2_BTN,sc.button,sc.button_text,"Draw 2"); |
52 | DrawCaptButton(280,100,110,30,SETBG_BTN,sc.button,sc.button_text,"Background"); |
52 | DrawCaptButton(280,100,110,30,SETBG_BTN,sc.button,sc.button_text,"Background"); |
53 | } |
53 | } |
54 | } |
54 | } |
55 | 55 | ||
56 | /*======================================================== |
56 | /*======================================================== |
57 | = = |
57 | = = |
58 | = Background system functions = |
58 | = Background system functions = |
59 | = = |
59 | = = |
60 | ========================================================*/ |
60 | ========================================================*/ |
61 | 61 | ||
62 | inline fastcall void BG_PaintMode( ECX) |
62 | inline fastcall void BG_PaintMode( ECX) |
63 | { |
63 | { |
64 | $mov eax, 15 |
64 | $mov eax, 15 |
65 | $mov ebx, 4 |
65 | $mov ebx, 4 |
66 | $int 0x40 |
66 | $int 0x40 |
67 | } |
67 | } |
68 | 68 | ||
69 | inline fastcall void BG_SetImageSize( ECX, EDX) |
69 | inline fastcall void BG_SetImageSize( ECX, EDX) |
70 | { |
70 | { |
71 | $mov eax, 15 |
71 | $mov eax, 15 |
72 | $mov ebx, 1 |
72 | $mov ebx, 1 |
73 | $int 0x40 |
73 | $int 0x40 |
74 | } |
74 | } |
75 | 75 | ||
76 | inline fastcall void BG_PutPixels( ECX, EDX, ESI) |
76 | inline fastcall void BG_PutPixels( ECX, EDX, ESI) |
77 | { |
77 | { |
78 | $mov eax, 15 |
78 | $mov eax, 15 |
79 | $mov ebx, 5 |
79 | $mov ebx, 5 |
80 | $int 0x40 |
80 | $int 0x40 |
81 | } |
81 | } |
82 | 82 | ||
83 | inline fastcall void BG_Redraw() |
83 | inline fastcall void BG_Redraw() |
84 | { |
84 | { |
85 | $mov eax, 15 |
85 | $mov eax, 15 |
86 | $mov ebx, 3 |
86 | $mov ebx, 3 |
87 | $int 0x40 |
87 | $int 0x40 |
88 | } |
88 | } |
89 | 89 | ||
90 | /*======================================================== |
90 | /*======================================================== |
91 | = = |
91 | = = |
92 | = EVENTS = |
92 | = EVENTS = |
93 | = = |
93 | = = |
94 | ========================================================*/ |
94 | ========================================================*/ |
95 | 95 | ||
96 | void EventDraw1() |
96 | void EventDraw1() |
97 | { |
97 | { |
98 | int i1; |
98 | int i1; |
99 | int i4; |
99 | int i4; |
100 | int pos; |
100 | int pos; |
101 | for(i4 = 0; i4 < 256; i4++) { |
101 | for(i4 = 0; i4 < 256; i4++) { |
102 | for(i1 = 0; i1 < 256; i1++) { |
102 | for(i1 = 0; i1 < 256; i1++) { |
103 | pos = i1 * 256 + i4; |
103 | pos = i1 * 256 + i4; |
104 | image[pos].b = i1; |
104 | image[pos].b = i1; |
105 | image[pos].r = 0; |
105 | image[pos].r = 0; |
106 | image[pos].g = 0; |
106 | image[pos].g = 0; |
107 | } |
107 | } |
108 | } |
108 | } |
109 | _PutImage(0,0,256,256,#image); |
109 | _PutImage(0,0,256,256,#image); |
110 | } |
110 | } |
111 | 111 | ||
112 | void EventDraw2() |
112 | void EventDraw2() |
113 | { |
113 | { |
114 | int i1; |
114 | int i1; |
115 | int i4; |
115 | int i4; |
116 | int t2; |
116 | int t2; |
117 | for(i4 = 0; i4 < 256; i4++) { |
117 | for(i4 = 0; i4 < 256; i4++) { |
118 | for(i1 = 0; i1 < 256; i1++) { |
118 | for(i1 = 0; i1 < 256; i1++) { |
119 | t2 = i1 * 256 + i4; |
119 | t2 = i1 * 256 + i4; |
120 | image[t2].r = i4; |
120 | image[t2].r = i4; |
121 | image[t2].g = i1; |
121 | image[t2].g = i1; |
122 | image[t2].b = 0; |
122 | image[t2].b = 0; |
123 | } |
123 | } |
124 | } |
124 | } |
125 | _PutImage(0,0,256,256,#image); |
125 | _PutImage(0,0,256,256,#image); |
126 | } |
126 | } |
127 | 127 | ||
128 | void EventSetBackground(dword img_pointer, w,h) |
128 | void EventSetBackground(dword img_pointer, w,h) |
129 | { |
129 | { |
130 | BG_PaintMode(2); //1-tile,2-stratch |
130 | BG_PaintMode(2); //1-tile,2-stratch |
131 | BG_SetImageSize(w,h); |
131 | BG_SetImageSize(w,h); |
132 | BG_PutPixels(img_pointer, 0, 3*w*h); |
132 | BG_PutPixels(img_pointer, 0, 3*w*h); |
133 | BG_Redraw(); |
133 | BG_Redraw(); |
134 | } |
134 | } |
135 | 135 | ||
136 | stop:>>>> |
136 | stop:>>>> |