Files
kolibrios/programs/games/snake/pause.asm
Aleksey Surkov 8e006128c8
Some checks failed
Build system / Check kernel codestyle (pull_request) Successful in 2m5s
Build system / Build (pull_request) Failing after 2m57s
game snake refactoring
2026-02-01 18:49:13 +04:00

82 lines
2.8 KiB
NASM

;;===Pause_mode================================================================================================================
Pause_mode:
mcall 66,1,1 ; set scan codes mode for keyboard
call Show_cursor
mov [action], 0
mov eax, [time_wait_limit]
mov [time_to_wait], eax
.redraw:
call Set_geometry
mcall 12,1
mcall 0, , ,[window_style], ,window_title
test [proc_info.wnd_state], 0x04 ; is rolled up?
jnz @f
call Draw_decorations
call Draw_pause_picture
stdcall draw.Navigation, labelMenu, [posLabel.yTop], 0
stdcall draw.Navigation, labelResume, [posLabel.yCenter], 0
mcall 12,2
@@:
.still:
mcall 10 ; wait for event
; ok, what an event?
dec al ; has the window been moved or resized?
jz .redraw
dec al ; was a key pressed?
jz .key
.button: ; a button was pressed
mcall 17 ; get button number
shr eax, 8 ; we should do it to get the real button code
cmp eax, 1
je Save_do_smth_else_and_exit
jmp .still
.key: ; a key was pressed
mcall 2 ; get keycode
cmp ah, 0x01 ; Escape - go to menu
je First_menu
cmp ah, 0x39 ; Space - resume game
je Level_body
cmp ah, [shortcut_increase]
jne @f
call Increase_geometry
jmp .redraw
@@:
cmp ah, [shortcut_decrease]
jne @f
call Decrease_geometry
jmp .redraw
@@:
jmp .still
;;---Pause_mode----------------------------------------------------------------------------------------------------------------
;;===Some_functions============================================================================================================
Draw_pause_picture:
;;===Draw_pause_picture========================================================================================================
mov ax, 2*0x100+24
mov cx, 4*0x100+6
mov edx, [pause_picture_color]
mov esi, picture_pause
call Draw_picture
ret
;;---Draw_pause_picture--------------------------------------------------------------------------------------------------------
;;---Some_functions------------------------------------------------------------------------------------------------------------