2006-01-03 10:43:31 +01:00
|
|
|
;
|
|
|
|
; SHAPED WINDOW - BASIC EXAMPLE
|
|
|
|
;
|
2020-11-08 14:07:53 +01:00
|
|
|
; Compile with FASM
|
2006-01-03 10:43:31 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
use32
|
|
|
|
|
|
|
|
org 0x0
|
|
|
|
|
2015-08-18 02:36:57 +02:00
|
|
|
db 'MENUET01' ; 8 byte id
|
|
|
|
dd 1 ; required os
|
2006-01-03 10:43:31 +01:00
|
|
|
dd START ; program start
|
|
|
|
dd I_END ; program image size
|
2015-08-18 02:36:57 +02:00
|
|
|
dd E_END ; required amount of memory
|
|
|
|
dd E_END ; esp
|
|
|
|
dd 0, 0 ; no params, no path
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-05-10 15:48:35 +02:00
|
|
|
include '..\..\..\..\macros.inc'
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
START: ; start of execution
|
|
|
|
|
|
|
|
call shape_window ; function for shaping
|
2007-02-16 03:22:14 +01:00
|
|
|
red:
|
2006-01-03 10:43:31 +01:00
|
|
|
call draw_window ; at first, draw the window
|
|
|
|
|
|
|
|
still:
|
|
|
|
|
|
|
|
mov eax,10 ; wait here for event
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-02-16 03:22:14 +01:00
|
|
|
dec eax ; redraw request ?
|
|
|
|
jz red
|
|
|
|
dec eax ; key in buffer ?
|
|
|
|
jz key
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-02-16 03:22:14 +01:00
|
|
|
button:
|
2015-08-18 02:36:57 +02:00
|
|
|
mov al,17 ; get id
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
cmp ah,1 ; button id=1 ?
|
|
|
|
jne noclose
|
2007-02-16 03:22:14 +01:00
|
|
|
or eax,-1 ; close this program
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2007-02-16 03:22:14 +01:00
|
|
|
|
|
|
|
key: ; key
|
2015-08-18 02:36:57 +02:00
|
|
|
mov al,2 ; just read it and ignore
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2007-02-16 03:22:14 +01:00
|
|
|
jmp still
|
2006-01-03 10:43:31 +01:00
|
|
|
noclose:
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
|
shape_window:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mov eax,50 ; give the shape reference area
|
|
|
|
mov ebx,0
|
|
|
|
mov ecx,shape_reference
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
mov eax,50 ; give the shape scale 32 x 32 -> 128 x 128
|
2024-05-30 22:45:33 +02:00
|
|
|
mov ebx,1 ; you don't have to give this, scale is 1:1 by default
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ecx,2
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
popa
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
shape_reference: ; 32 x 32 ( window_size_X + 1 ) * ( window_size_Y + 1 )
|
|
|
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
db 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1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
|
|
|
; *********************************************
|
|
|
|
; ******* WINDOW DEFINITIONS AND DRAW ********
|
|
|
|
; *********************************************
|
|
|
|
|
|
|
|
|
|
|
|
draw_window:
|
|
|
|
|
|
|
|
mov eax,12 ; function 12:tell os about windowdraw
|
|
|
|
mov ebx,1 ; 1, start of draw
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
; DRAW WINDOW
|
2015-08-18 02:36:57 +02:00
|
|
|
xor eax,eax ; function 0 : define and draw window
|
|
|
|
mov ebx,100*65536+127 ; [x start] *65536 + [x size]
|
|
|
|
mov ecx,100*65536+127 ; [y start] *65536 + [y size]
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edx,0x00cccc00 ; color of work area RRGGBB,8->color glide
|
|
|
|
mov esi,0x00cccc00 ; color of grab bar RRGGBB,8->color glide
|
|
|
|
mov edi,0x00cccc00 ; color of frames RRGGBB
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
; CLOSE BUTTON
|
|
|
|
mov eax,8 ; function 8 : define and draw button
|
|
|
|
mov ebx,78*65536+12 ; [x start] *65536 + [x size]
|
|
|
|
mov ecx,20*65536+12 ; [y start] *65536 + [y size]
|
|
|
|
mov edx,1 ; button id
|
|
|
|
mov esi,0x5599cc ; button color RRGGBB
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
mov eax,12 ; function 12:tell os about windowdraw
|
|
|
|
mov ebx,2 ; 2, end of draw
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
; DATA AREA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I_END:
|
2015-08-18 02:36:57 +02:00
|
|
|
rb 0x100 ; stack
|
|
|
|
E_END:
|