当前位置:首页 > 汇编语言推箱子课程设计
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION mov mov
wc.hIcon,eax wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW mov
wc.hCursor,eax
invoke RegisterClassEx,addr wc invoke
CreateDialogParam,hInstance,addr
DlgName,NULL,addr
WndProc,NULL
WinMain endp
WndProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM LOCAL ps :PAINTSTRUCT LOCAL Dc:HDC
mov
eax,uMsg
invoke ShowWindow,hWnd,SW_SHOWNORMAL invoke UpdateWindow,hWnd .while TRUE
invoke GetMessage,addr msg,NULL,0,0
.BREAK .if !eax
invoke TranslateMessage,addr msg invoke DispatchMessage,addr msg
.endw mov ret
eax,msg.wParam
.if eax == WM_KEYDOWN
invoke KeyDownProc,wParam
.elseif eax==WM_INITDIALOG
push
hWin
9
pop hWnd
invoke GetDlgItem,hWin,IDC_TBRMAIN invoke DoToolBar,hInstance,eax invoke LoadRes .if eax == FALSE
invoke MessageBox,hWin,Addr szErrorMessage,\\ Addr szLoadError,MB_ICONERROR .endif
invoke InitStBar invoke SelectGate,1
.elseif eax==WM_COMMAND
.endif mov and
eax,wParam eax,0FFFFh
.if eax==IDM_FILE_EXIT
invoke SendMessage,hWin,WM_CLOSE,0,0
.elseif eax==IDM_HELP_ABOUT
invoke ShellAbout,hWin,addr AppName,addr AboutMsg,NULL
.elseif eax == IDC_TBB_NEW invoke SelectGate,CurrGate .elseif eax == IDC_TBB_PREV mov eax, CurrGate dec eax
invoke SelectGate,eax .elseif eax == IDC_TBB_NEXT invoke NextGate
.elseif eax == IDC_TBB_ABOUT
invoke ShellAbout,hWnd,Addr AppName,Addr AboutMsg,NULL
.elseif eax==WM_PAINT
invoke BeginPaint,hWin,Addr ps
10
mov Dc,eax invoke WMPaint,Dc
invoke EndPaint,hWin,Addr ps .elseif eax==WM_CLOSE
invoke DestroyWindow,hWin
.elseif uMsg==WM_DESTROY invoke FreeRes
invoke PostQuitMessage,NULL
.else
invoke DefWindowProc,hWin,uMsg,wParam,lParam ret
.endif
xor eax,eax ret
2.2功能控制模块(功能实现)
(2)小人移动的方向有4个,move()函数(处理小人移动的函数)对这4个方向移动的处理都一致,只是调用函数时的参数有所不同。首先判断小人移动的方向,然后根据小人所处世的当前状态、下一步状态或者下下一步状态进行适当的处理。 KeyDownProc endp ManMove proc vKey :DWORD LOCAL NewX:DWORD LOCAL NewY:DWORD LOCAL NewX2 :DWORD LOCAL NewY2 :DWORD LOCAL M1 :byte LOCAL M2 :byte LOCAL nPos1 :DWORD LOCAL nPos2 :DWORD
11
push esi
mov eax,ManXPos mov NewX,eax mov NewX2,eax mov eax,ManYPos mov NewY,eax mov NewY2,eax
mov eax ,vKey .if eax == VK_UP dec NewY dec NewY2 dec NewY2
.elseif eax == VK_DOWN inc NewY inc NewY2 inc NewY2
.elseif eax == VK_LEFT dec NewX dec NewX2 dec NewX2
.elseif eax == VK_RIGHT inc NewX inc NewX2 inc NewX2 .else ret .endif
12
共分享92篇相关文档