3dspiral: skinned window, transparent background, esc exit

git-svn-id: svn://kolibrios.org@2022 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2011-07-25 16:17:22 +00:00
parent 6b6de1e572
commit f354cb43ca

View File

@ -1,26 +1,26 @@
; ;
; application : 3d shaking waved spiral ; application : 3d shaking waved spiral
; compilator : fasm ; compilator : fasm
; system : MenuetOS ; system : KolibriOS
; author : macgub ; author : macgub
; email : macgub3@wp ; email : macgub3@wp
timeout equ 3 timeout equ 3
maxx equ 600 ; window size maxx equ 616 ; window size
maxy equ 420 maxy equ 420
use32 use32
org 0x0 org 0x0
db 'MENUET01' ; 8 byte id db 'MENUET01' ; 8 byte id
dd 0x01 ; header version dd 0x01 ; header version
dd START ; start of code dd START ; start of code
dd I_END ; size of image dd I_END ; size of image
dd 0x100000 ; memory for app dd 0x100000 ; memory for app
dd 0xbffff ; esp dd 0xbffff ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon dd 0x0 , 0x0 ; I_Param , I_Icon
START: ; start of execution START: ; start of execution
call draw_window call draw_window
@ -29,35 +29,40 @@ still:
; mov eax,23 ; wait here for event ; mov eax,23 ; wait here for event
; mov ebx,timeout ; mov ebx,timeout
; int 0x40 ; int 0x40
mov eax,11 ; check for event no wait mov eax,11 ; check for event no wait
int 0x40 int 0x40
cmp eax,1 ; redraw request ? cmp eax,1 ; redraw request ?
je red je red
cmp eax,2 ; key in buffer ? cmp eax,2 ; key in buffer ?
je key je key
cmp eax,3 ; button in buffer ? cmp eax,3 ; button in buffer ?
je button je button
jmp noclose jmp noclose
red: ; redraw red: ; redraw
call draw_window call draw_window
jmp still jmp still
key: ; key key: ; key
mov eax,2 ; just read it and ignore mov eax,2 ; just read it and ignore
int 0x40 int 0x40
jmp still shr eax,8
cmp eax, 27
button: ; button jne still
mov eax,17 ; get id mov eax, -1
int 0x40 int 0x40
cmp ah,1 ; button id=1 ?
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne noclose jne noclose
mov eax,-1 ; close this program mov eax,-1 ; close this program
int 0x40 int 0x40
noclose: noclose:
@ -85,13 +90,13 @@ oopz:
oop: oop:
push [x] push [x]
; call getcol ;(x,z) ; call getcol ;(x,z)
call fun ; calculates y and y1 call fun ; calculates y and y1
; call rotateY ; call rotateY
mov eax,[sin_variable] mov eax,[sin_variable]
add eax,[vector_x] ; vector_x add eax,[vector_x] ; vector_x
add [x],eax add [x],eax
mov eax,[vector_y] mov eax,[vector_y]
add [y],eax ; vector_y add [y],eax ; vector_y
add [y1],eax add [y1],eax
call point_perspective call point_perspective
call draw_point_3d call draw_point_3d
@ -109,7 +114,7 @@ oop:
mov eax,7 mov eax,7
mov ebx,screen_buf mov ebx,screen_buf
mov ecx,maxx*65536+maxy mov ecx,maxx*65536+maxy
mov edx,20*65536+20 mov edx,0*65536+0
int 0x40 int 0x40
call set_elipse_dim call set_elipse_dim
@ -282,7 +287,7 @@ point_perspective:
fistp [y1] fistp [y1]
ret ret
calc_sin_variable: calc_sin_variable:
;calculate sinus variable ;calculate sinus variable
fldpi fldpi
fidiv [sin_gran] fidiv [sin_gran]
fimul [sin_counter] fimul [sin_counter]
@ -360,34 +365,19 @@ ret
; ********************************************* ; *********************************************
draw_window: draw_window:
mov eax,12 ; function 12:tell os about windowdraw mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw mov ebx,1 ; 1, start of draw
int 0x40 int 0x40
; DRAW WINDOW ; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+maxx+25 ; [x start] *65536 + [x size] mov ebx,100*65536+maxx+9 ; [x start] *65536 + [x size]
mov ecx,100*65536+maxy+25 ; [y start] *65536 + [y size] mov ecx,100*65536+maxy+25 ; [y start] *65536 + [y size]
mov edx,0x02000000 ; color of work area RRGGBB,8->color gl mov edx,0x74000000 ; color of work area RRGGBB,8->color gl
mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl mov edi,labelt
mov edi,0x005080d0 ; color of frames RRGGBB
int 0x40 int 0x40
; WINDOW LABEL ; WINDOW LABEL
mov eax,4 ; function 4 : write text to window mov eax,12 ; function 12:tell os about windowdraw
mov ebx,8*65536+8 ; [x start] *65536 + [y start] mov ebx,2 ; 2, end of draw
mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB )
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(maxx+25-19)*65536+12 ; [x start] *65536 + [x size]
mov ecx,5*65536+12 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,0x6688dd ; button color RRGGBB
int 0x40
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40 int 0x40
ret ret
@ -411,8 +401,8 @@ current_deg dd ?
;suby dd ? ;suby dd ?
;subz dd ? ;subz dd ?
xobs dd maxx/2 ; 320 observer variables xobs dd maxx/2 ; 320 observer variables
yobs dd maxy/2 ; 175 yobs dd maxy/2 ; 175
zobs dd -200 zobs dd -200
xobssub dd ? xobssub dd ?
yobssub dd ? yobssub dd ?
@ -422,21 +412,21 @@ zobssub dd ?
sin_variable dd ? sin_variable dd ?
sin_mul dd 60 sin_mul dd 60
sin_gran dd 30 sin_gran dd 30
sin_counter dd 0 sin_counter dd 0
sq dd 724 ; round( (sqrt2)/2*1024 ) sq dd 724 ; round( (sqrt2)/2*1024 )
z dd ? z dd ?
x dd ? x dd ?
y dd ? y dd ?
y1 dd ? y1 dd ?
xo dd 70 ; center point , (loop counter-1)/2 xo dd 70 ; center point , (loop counter-1)/2
yo dd 20 yo dd 20
a dd 70 ; vertical half-axle a dd 70 ; vertical half-axle
b dd 20 ; horizontal half-axle b dd 20 ; horizontal half-axle
loop_counter dd 141 ; axle granularity loop_counter dd 141 ; axle granularity
col dd 0x00ffffff col dd 0x00ffffff
labelt: labelt:
db ' 3D SHAKING WAVED SPIRAL' db ' 3D shaking waved spiral',0
labellen: labellen:
screen_buf: screen_buf: