Movback: Added support window resizing
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 1m9s
Build system / Build (pull_request) Successful in 7m38s

This commit is contained in:
2025-03-17 00:43:15 +02:00
parent 1869449309
commit 5a907e131b

View File

@@ -7,14 +7,18 @@
include "../../macros.inc"
include "../../KOSfuncs.inc"
WND_SIZE_X = 320
WND_SIZE_Y = 200
KOS_APP_START
Screen_W dd 600-10 ;10 px for borders
Screen_H dd 400
VC_DELTA = 1
HC_DELTA = 2
MEOS_APP_START
CODE
mcall SF_SYS_MISC,SSF_HEAP_INIT
call OnResize
fninit
call init_sinus_table
call init_background
@@ -22,6 +26,7 @@ CODE
mcall SF_SET_EVENTS_MASK, 101b
jmp .paint_window
align 4
.event_loop:
mcall SF_WAIT_EVENT_TIMEOUT, 1
@@ -39,23 +44,62 @@ CODE
add word [hor_counter],HC_DELTA
call handle_animation
xor ebp,ebp
mcall SF_PUT_IMAGE_EXT, virtual_screen_8,<WND_SIZE_X,WND_SIZE_Y>,<0,0>,8,_palette
mov ecx,[Screen_W]
shl ecx,16
add ecx,[Screen_H]
mcall SF_PUT_IMAGE_EXT, [virtual_screen_8],,<0,0>,8,_palette
jmp .event_loop
.paint_window:
mcall SF_THREAD_INFO, proc_info,-1
cmp dword[proc_info.box.height],0
je .resize_end
mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
add eax,4
sub eax,[proc_info.box.height]
neg eax
cmp eax,[Screen_H]
je .end_h
cmp eax,32 ;min height
jge @f
mov eax,32
@@:
mov [Screen_H],eax
xor eax,eax
mov [Screen_W],eax
.end_h:
mov eax,[proc_info.box.width]
sub eax,9
cmp eax,[Screen_W]
je .resize_end
cmp eax,64 ;min width
jge @f
mov eax,64
@@:
mov [Screen_W],eax
call OnResize
.resize_end:
mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
lea ecx,[eax + (100 shl 16) + WND_SIZE_Y+4]
lea ecx,[eax + (100 shl 16) +4]
add ecx,[Screen_H]
mov edi,title
mcall SF_CREATE_WINDOW, <100,WND_SIZE_X+9>,,0x74000000
mov ebx,(100 shl 16)+9
add ebx,[Screen_W]
mcall SF_CREATE_WINDOW,,,0x73000000
test [proc_info.wnd_state], 0x04
jnz @f
xor ebp,ebp
mcall SF_PUT_IMAGE_EXT, virtual_screen_8,<WND_SIZE_X,WND_SIZE_Y>,<0,0>,8,_palette
mov ecx,[Screen_W]
shl ecx,16
add ecx,[Screen_H]
mcall SF_PUT_IMAGE_EXT, [virtual_screen_8],,<0,0>,8,_palette
@@:
mcall SF_REDRAW, SSF_END_DRAW
@@ -110,6 +154,14 @@ init_background:
jne .ib_vertical
ret
align 4
OnResize:
mov ecx,[Screen_W]
imul ecx,[Screen_H]
mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[virtual_screen_8]
mov [virtual_screen_8],eax
ret
s_OFFX = 0
s_OFFY = 2
@@ -125,10 +177,12 @@ handle_animation:
add ebx,ebx
mov ax,[sinetable+ebx]
mov [esp+s_OFFX],ax
mov edi,virtual_screen_8
mov edx,WND_SIZE_Y-1
mov edi,[virtual_screen_8]
mov edx,[Screen_H]
dec edx
.a_ver:
mov ecx,WND_SIZE_X-1
mov ecx,[Screen_W]
dec ecx
mov bx,[esp+s_OFFY]
add bx,dx
and ebx,255
@@ -158,8 +212,7 @@ UDATA
_palette: rd 256
virtual_screen_8:
rb WND_SIZE_X*WND_SIZE_Y
virtual_screen_8 dd ?
background:
rb 256*256
@@ -169,4 +222,4 @@ UDATA
proc_info process_information
MEOS_APP_END
KOS_APP_END