Rev 5739 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ; |
2 | ; SHAPED WINDOW - BASIC EXAMPLE |
||
3 | ; |
||
8163 | maxcodehac | 4 | ; Compile with FASM |
31 | halyavin | 5 | ; |
6 | |||
7 | use32 |
||
8 | |||
9 | org 0x0 |
||
10 | |||
5739 | dunkaist | 11 | db 'MENUET01' ; 8 byte id |
12 | dd 1 ; required os |
||
31 | halyavin | 13 | dd START ; program start |
14 | dd I_END ; program image size |
||
5739 | dunkaist | 15 | dd E_END ; required amount of memory |
16 | dd E_END ; esp |
||
17 | dd 0, 0 ; no params, no path |
||
31 | halyavin | 18 | |
485 | heavyiron | 19 | include '..\..\..\..\macros.inc' |
31 | halyavin | 20 | |
21 | |||
22 | |||
23 | START: ; start of execution |
||
24 | |||
25 | call shape_window ; function for shaping |
||
353 | heavyiron | 26 | red: |
31 | halyavin | 27 | call draw_window ; at first, draw the window |
28 | |||
29 | still: |
||
30 | |||
31 | mov eax,10 ; wait here for event |
||
485 | heavyiron | 32 | mcall |
31 | halyavin | 33 | |
353 | heavyiron | 34 | dec eax ; redraw request ? |
35 | jz red |
||
36 | dec eax ; key in buffer ? |
||
37 | jz key |
||
31 | halyavin | 38 | |
353 | heavyiron | 39 | button: |
5739 | dunkaist | 40 | mov al,17 ; get id |
485 | heavyiron | 41 | mcall |
31 | halyavin | 42 | |
353 | heavyiron | 43 | cmp ah,1 ; button id=1 ? |
44 | jne noclose |
||
45 | or eax,-1 ; close this program |
||
485 | heavyiron | 46 | mcall |
31 | halyavin | 47 | |
48 | key: ; key |
||
5739 | dunkaist | 49 | mov al,2 ; just read it and ignore |
485 | heavyiron | 50 | mcall |
31 | halyavin | 51 | jmp still |
52 | noclose: |
||
53 | |||
54 | jmp still |
||
55 | |||
56 | |||
57 | shape_window: |
||
58 | |||
59 | pusha |
||
60 | |||
61 | mov eax,50 ; give the shape reference area |
||
62 | mov ebx,0 |
||
63 | mov ecx,shape_reference |
||
485 | heavyiron | 64 | mcall |
31 | halyavin | 65 | |
66 | mov eax,50 ; give the shape scale 32 x 32 -> 128 x 128 |
||
67 | mov ebx,1 ; you dont have to give this, scale is 1:1 by default |
||
68 | mov ecx,2 |
||
485 | heavyiron | 69 | mcall |
31 | halyavin | 70 | |
71 | popa |
||
72 | |||
73 | ret |
||
74 | |||
75 | |||
76 | shape_reference: ; 32 x 32 ( window_size_X + 1 ) * ( window_size_Y + 1 ) |
||
77 | |||
78 | db 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 |
||
79 | db 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0 |
||
80 | db 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0 |
||
81 | db 0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0 |
||
82 | db 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0 |
||
83 | db 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0 |
||
84 | db 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0 |
||
85 | db 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0 |
||
86 | db 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0 |
||
87 | db 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 |
||
88 | db 0,1,1,1,1,1,1,1,1,1,1,1,1,1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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0 |
||
103 | db 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0 |
||
104 | db 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0 |
||
105 | db 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0 |
||
106 | db 0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0 |
||
107 | db 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0 |
||
108 | db 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0 |
||
109 | db 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 |
||
110 | |||
111 | |||
112 | ; ********************************************* |
||
113 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
114 | ; ********************************************* |
||
115 | |||
116 | |||
117 | draw_window: |
||
118 | |||
119 | mov eax,12 ; function 12:tell os about windowdraw |
||
120 | mov ebx,1 ; 1, start of draw |
||
485 | heavyiron | 121 | mcall |
31 | halyavin | 122 | |
123 | ; DRAW WINDOW |
||
5739 | dunkaist | 124 | xor eax,eax ; function 0 : define and draw window |
125 | mov ebx,100*65536+127 ; [x start] *65536 + [x size] |
||
126 | mov ecx,100*65536+127 ; [y start] *65536 + [y size] |
||
31 | halyavin | 127 | mov edx,0x00cccc00 ; color of work area RRGGBB,8->color glide |
128 | mov esi,0x00cccc00 ; color of grab bar RRGGBB,8->color glide |
||
129 | mov edi,0x00cccc00 ; color of frames RRGGBB |
||
485 | heavyiron | 130 | mcall |
31 | halyavin | 131 | |
132 | |||
133 | ; CLOSE BUTTON |
||
134 | mov eax,8 ; function 8 : define and draw button |
||
135 | mov ebx,78*65536+12 ; [x start] *65536 + [x size] |
||
136 | mov ecx,20*65536+12 ; [y start] *65536 + [y size] |
||
137 | mov edx,1 ; button id |
||
138 | mov esi,0x5599cc ; button color RRGGBB |
||
485 | heavyiron | 139 | mcall |
31 | halyavin | 140 | |
141 | |||
142 | mov eax,12 ; function 12:tell os about windowdraw |
||
143 | mov ebx,2 ; 2, end of draw |
||
485 | heavyiron | 144 | mcall |
31 | halyavin | 145 | |
146 | ret |
||
147 | |||
148 | |||
149 | ; DATA AREA |
||
150 | |||
151 | |||
152 | |||
153 | I_END: |
||
5739 | dunkaist | 154 | rb 0x100 ; stack |
155 | E_END: |