2006-01-03 10:43:31 +01:00
|
|
|
;
|
|
|
|
; TRANSPARENT EXAMPLE
|
|
|
|
;
|
|
|
|
; Compile with FASM for Menuet
|
|
|
|
;
|
|
|
|
|
|
|
|
use32
|
|
|
|
|
|
|
|
org 0x0
|
|
|
|
|
|
|
|
db 'MENUET01' ; 8 byte id
|
|
|
|
dd 0x01 ; header version
|
|
|
|
dd START ; start of code
|
|
|
|
dd I_END ; size of image
|
|
|
|
dd 0x30000 ; memory for app
|
|
|
|
dd 0x30000 ; esp
|
|
|
|
dd 0x0 , 0x0 ; I_Param , I_Icon
|
|
|
|
|
|
|
|
include 'lang.inc'
|
2007-05-10 15:48:35 +02:00
|
|
|
include '..\..\..\macros.inc'
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
START: ; start of execution
|
2007-05-10 15:48:35 +02:00
|
|
|
mov [procinfo.box.left], 100
|
|
|
|
mov [procinfo.box.width], 200
|
|
|
|
mov [procinfo.box.top], 80
|
|
|
|
mov [procinfo.box.height], 300
|
2007-02-04 01:42:14 +01:00
|
|
|
call draw_window
|
|
|
|
red:
|
|
|
|
call get_transparent
|
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
|
|
|
|
|
|
|
cmp eax,1 ; redraw request ?
|
|
|
|
je red
|
|
|
|
cmp eax,2 ; key in buffer ?
|
|
|
|
je key
|
|
|
|
cmp eax,3 ; button in buffer ?
|
|
|
|
je button
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
key: ; key
|
2007-02-04 01:42:14 +01:00
|
|
|
mov al,2 ; just read it and ignore
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
jmp still
|
|
|
|
|
|
|
|
button: ; button
|
2007-02-04 01:42:14 +01: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-04 01:42:14 +01:00
|
|
|
or eax,-1 ; close this program
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
noclose:
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
|
; *********************************************
|
|
|
|
; ******* 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
|
2007-02-04 01:42:14 +01:00
|
|
|
xor eax,eax ; function 0 : define and draw window
|
2007-05-10 15:48:35 +02:00
|
|
|
mov ebx,[procinfo.box.left]
|
2006-01-03 10:43:31 +01:00
|
|
|
shl ebx,16
|
2007-05-10 15:48:35 +02:00
|
|
|
add ebx,[procinfo.box.width]
|
|
|
|
mov ecx,[procinfo.box.top]
|
2006-01-03 10:43:31 +01:00
|
|
|
shl ecx,16
|
2007-05-10 15:48:35 +02:00
|
|
|
add ecx,[procinfo.box.height]
|
2007-02-04 01:42:14 +01:00
|
|
|
mov edx,0x33000000 ; color of work area RRGGBB,8->color gl
|
2007-05-10 15:48:35 +02:00
|
|
|
mov edi,title ; WINDOW LABEL
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
call draw_transparent
|
2007-02-04 01:42:14 +01:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_transparent:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,0x1000
|
2007-05-10 15:48:35 +02:00
|
|
|
mov ecx,[procinfo.box.width]
|
2006-01-03 10:43:31 +01:00
|
|
|
shl ecx,16
|
2007-05-10 15:48:35 +02:00
|
|
|
add ecx,[procinfo.box.height]
|
2007-02-04 01:42:14 +01:00
|
|
|
xor edx,edx
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
popa
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
get_transparent:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mov eax,9
|
|
|
|
mov ebx,I_END
|
|
|
|
mov ecx,-1
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
mov eax,14
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
shr eax,16
|
|
|
|
inc eax
|
|
|
|
mov [scx],eax
|
|
|
|
|
2007-05-10 15:48:35 +02:00
|
|
|
add [procinfo.box.left], 4
|
|
|
|
sub [procinfo.box.width], 4+4
|
|
|
|
add [procinfo.box.top], 22
|
|
|
|
sub [procinfo.box.height], 22+4
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-05-10 15:48:35 +02:00
|
|
|
mov eax,[procinfo.box.left]
|
|
|
|
add eax,[procinfo.box.width]
|
2006-01-03 10:43:31 +01:00
|
|
|
mov [x_end],eax
|
2007-05-10 15:48:35 +02:00
|
|
|
mov eax,[procinfo.box.top]
|
|
|
|
add eax,[procinfo.box.height]
|
2006-01-03 10:43:31 +01:00
|
|
|
mov [y_end],eax
|
|
|
|
|
2007-05-10 15:48:35 +02:00
|
|
|
mov eax,[procinfo.box.left]
|
|
|
|
mov ebx,[procinfo.box.top]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
dtpl1:
|
|
|
|
|
|
|
|
push eax
|
|
|
|
push ebx
|
|
|
|
|
|
|
|
imul ebx,[scx]
|
|
|
|
add ebx,eax
|
|
|
|
mov eax,35
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
or eax, 0x4e4e4e
|
|
|
|
|
|
|
|
mov ebx,[esp+4]
|
|
|
|
mov ecx,[esp]
|
2007-05-10 15:48:35 +02:00
|
|
|
sub ebx,[procinfo.box.left]
|
|
|
|
sub ecx,[procinfo.box.top]
|
|
|
|
imul ecx,[procinfo.box.width]
|
2006-01-03 10:43:31 +01:00
|
|
|
imul ebx,3
|
|
|
|
imul ecx,3
|
|
|
|
add ebx,ecx
|
|
|
|
mov [0x1000+ebx],eax
|
|
|
|
|
|
|
|
pop ebx
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
inc eax
|
|
|
|
cmp eax,[x_end]
|
|
|
|
jb dtpl1
|
2007-05-10 15:48:35 +02:00
|
|
|
mov eax,[procinfo.box.left]
|
2006-01-03 10:43:31 +01:00
|
|
|
inc ebx
|
|
|
|
cmp ebx,[y_end]
|
|
|
|
jb dtpl1
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; DATA AREA
|
|
|
|
|
|
|
|
|
|
|
|
x_end dd 0
|
|
|
|
y_end dd 0
|
|
|
|
|
|
|
|
scx dd 640
|
|
|
|
|
2007-05-10 15:48:35 +02:00
|
|
|
title db 'Transparent',0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
I_END:
|
|
|
|
procinfo process_information
|
|
|
|
|