Rev 316 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ; |
2 | ; TRANSPARENT EXAMPLE |
||
3 | ; |
||
4 | ; Compile with FASM for Menuet |
||
5 | ; |
||
6 | |||
7 | use32 |
||
8 | |||
9 | org 0x0 |
||
10 | |||
11 | db 'MENUET01' ; 8 byte id |
||
12 | dd 0x01 ; header version |
||
13 | dd START ; start of code |
||
14 | dd I_END ; size of image |
||
15 | dd 0x30000 ; memory for app |
||
16 | dd 0x30000 ; esp |
||
17 | dd 0x0 , 0x0 ; I_Param , I_Icon |
||
18 | |||
19 | include 'lang.inc' |
||
485 | heavyiron | 20 | include '..\..\..\macros.inc' |
31 | halyavin | 21 | |
22 | START: ; start of execution |
||
485 | heavyiron | 23 | mov [procinfo.box.left], 100 |
24 | mov [procinfo.box.width], 200 |
||
25 | mov [procinfo.box.top], 80 |
||
26 | mov [procinfo.box.height], 300 |
||
316 | heavyiron | 27 | call draw_window |
28 | red: |
||
29 | call get_transparent |
||
31 | halyavin | 30 | call draw_window ; at first, draw the window |
31 | |||
32 | still: |
||
33 | |||
34 | mov eax,10 ; wait here for event |
||
485 | heavyiron | 35 | mcall |
31 | halyavin | 36 | |
37 | cmp eax,1 ; redraw request ? |
||
38 | je red |
||
39 | cmp eax,2 ; key in buffer ? |
||
40 | je key |
||
41 | cmp eax,3 ; button in buffer ? |
||
42 | je button |
||
43 | jmp still |
||
44 | |||
45 | key: ; key |
||
316 | heavyiron | 46 | mov al,2 ; just read it and ignore |
485 | heavyiron | 47 | mcall |
31 | halyavin | 48 | jmp still |
49 | |||
50 | button: ; button |
||
316 | heavyiron | 51 | mov al,17 ; get id |
485 | heavyiron | 52 | mcall |
31 | halyavin | 53 | |
54 | cmp ah,1 ; button id=1 ? |
||
55 | jne noclose |
||
316 | heavyiron | 56 | or eax,-1 ; close this program |
485 | heavyiron | 57 | mcall |
31 | halyavin | 58 | noclose: |
59 | |||
60 | jmp still |
||
61 | |||
62 | |||
63 | ; ********************************************* |
||
64 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
65 | ; ********************************************* |
||
66 | |||
67 | |||
68 | draw_window: |
||
69 | |||
70 | mov eax,12 ; function 12:tell os about windowdraw |
||
71 | mov ebx,1 ; 1, start of draw |
||
485 | heavyiron | 72 | mcall |
31 | halyavin | 73 | ; DRAW WINDOW |
316 | heavyiron | 74 | xor eax,eax ; function 0 : define and draw window |
485 | heavyiron | 75 | mov ebx,[procinfo.box.left] |
31 | halyavin | 76 | shl ebx,16 |
485 | heavyiron | 77 | add ebx,[procinfo.box.width] |
78 | mov ecx,[procinfo.box.top] |
||
31 | halyavin | 79 | shl ecx,16 |
485 | heavyiron | 80 | add ecx,[procinfo.box.height] |
316 | heavyiron | 81 | mov edx,0x33000000 ; color of work area RRGGBB,8->color gl |
485 | heavyiron | 82 | mov edi,title ; WINDOW LABEL |
83 | mcall |
||
31 | halyavin | 84 | |
85 | call draw_transparent |
||
316 | heavyiron | 86 | |
31 | halyavin | 87 | mov eax,12 ; function 12:tell os about windowdraw |
88 | mov ebx,2 ; 2, end of draw |
||
485 | heavyiron | 89 | mcall |
31 | halyavin | 90 | |
91 | ret |
||
92 | |||
93 | |||
94 | |||
95 | |||
96 | draw_transparent: |
||
97 | |||
98 | pusha |
||
99 | |||
100 | mov eax,7 |
||
101 | mov ebx,0x1000 |
||
485 | heavyiron | 102 | mov ecx,[procinfo.box.width] |
31 | halyavin | 103 | shl ecx,16 |
485 | heavyiron | 104 | add ecx,[procinfo.box.height] |
316 | heavyiron | 105 | xor edx,edx |
485 | heavyiron | 106 | mcall |
31 | halyavin | 107 | |
108 | popa |
||
109 | ret |
||
110 | |||
111 | |||
112 | get_transparent: |
||
113 | |||
114 | pusha |
||
115 | |||
116 | mov eax,9 |
||
117 | mov ebx,I_END |
||
118 | mov ecx,-1 |
||
485 | heavyiron | 119 | mcall |
31 | halyavin | 120 | |
121 | mov eax,14 |
||
485 | heavyiron | 122 | mcall |
31 | halyavin | 123 | |
124 | shr eax,16 |
||
125 | inc eax |
||
126 | mov [scx],eax |
||
127 | |||
485 | heavyiron | 128 | add [procinfo.box.left], 4 |
129 | sub [procinfo.box.width], 4+4 |
||
130 | add [procinfo.box.top], 22 |
||
131 | sub [procinfo.box.height], 22+4 |
||
31 | halyavin | 132 | |
485 | heavyiron | 133 | mov eax,[procinfo.box.left] |
134 | add eax,[procinfo.box.width] |
||
31 | halyavin | 135 | mov [x_end],eax |
485 | heavyiron | 136 | mov eax,[procinfo.box.top] |
137 | add eax,[procinfo.box.height] |
||
31 | halyavin | 138 | mov [y_end],eax |
139 | |||
485 | heavyiron | 140 | mov eax,[procinfo.box.left] |
141 | mov ebx,[procinfo.box.top] |
||
31 | halyavin | 142 | |
143 | dtpl1: |
||
144 | |||
145 | push eax |
||
146 | push ebx |
||
147 | |||
148 | imul ebx,[scx] |
||
149 | add ebx,eax |
||
150 | mov eax,35 |
||
485 | heavyiron | 151 | mcall |
31 | halyavin | 152 | |
153 | or eax, 0x4e4e4e |
||
154 | |||
155 | mov ebx,[esp+4] |
||
156 | mov ecx,[esp] |
||
485 | heavyiron | 157 | sub ebx,[procinfo.box.left] |
158 | sub ecx,[procinfo.box.top] |
||
159 | imul ecx,[procinfo.box.width] |
||
31 | halyavin | 160 | imul ebx,3 |
161 | imul ecx,3 |
||
162 | add ebx,ecx |
||
163 | mov [0x1000+ebx],eax |
||
164 | |||
165 | pop ebx |
||
166 | pop eax |
||
167 | |||
168 | inc eax |
||
169 | cmp eax,[x_end] |
||
170 | jb dtpl1 |
||
485 | heavyiron | 171 | mov eax,[procinfo.box.left] |
31 | halyavin | 172 | inc ebx |
173 | cmp ebx,[y_end] |
||
174 | jb dtpl1 |
||
175 | |||
176 | popa |
||
177 | |||
178 | ret |
||
179 | |||
180 | |||
181 | |||
182 | |||
183 | ; DATA AREA |
||
184 | |||
185 | |||
186 | x_end dd 0 |
||
187 | y_end dd 0 |
||
188 | |||
189 | scx dd 640 |
||
190 | |||
485 | heavyiron | 191 | title db 'Transparent',0 |
31 | halyavin | 192 | |
193 | I_END: |
||
194 | procinfo process_information |
||
195 |