📄 codeparts.asm
字号:
;---------------------------------------------------------------------------
; Initialization is called in WM_CREATE
;---------------------------------------------------------------------------
Initialization proc uses ebx esi hWnd:DWORD
LOCAL TempRect:RECT
invoke GetClientRect, hWnd, ADDR TempRect
xor ebx, ebx
.WHILE ebx < MAX_SMILIES
newobject CSmiley ; <<< Now "Smiley" objects (before was CSprite)
mov esi, eax
mov dword ptr [offset SmileyArray + 4 * ebx], eax
invoke RAND32, 3
add eax, 200 ; base of smiley resources (200, 201, 202 etc)
invoke LoadBitmap, hInstance, eax
method esi, CSmiley, setBitmap, eax
method esi, CSmiley, setDrawingDC, hBackDC
method esi, CSmiley, setScreenSize, TempRect.right,TempRect.bottom
method esi, CSmiley, setStepsDC, hStepDC
invoke RAND32, 25
push eax
add eax, 5
method esi, CSmiley, setSpeed, eax
pop eax
xor ecx, ecx
.IF eax>20
inc ecx
.ENDIF
method esi, CSmiley, enableSteps, ecx ; Randomly turn on or off the steps...
inc ebx
.ENDW
invoke GetStockObject, WHITE_BRUSH
invoke FillRect, hStepDC, ADDR fullrect, eax
ret
Initialization endp
Cleanup proc
xor ebx, ebx
.WHILE ebx < MAX_SMILIES
mov eax, [offset SmileyArray + 4 * ebx]
destroy eax
inc ebx
.ENDW
ret
Cleanup endp
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -