#include <windows.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "p.h"
#include "resource.h"
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
BOOL CALLBACK DlgProc(HWND,UINT,WPARAM,LPARAM);
HDC hdc;
HDC hdcmem;
HBITMAP hBm;
BITMAP bm;
HINSTANCE hInst;
HMENU hmenu,hprintmenu;
int i,j,xo=0,yo=0;
int ch=0,che=0;
struct map c=b[che];
struct map *g=&c;
int renx=ren[che][0],reny=ren[che][1],num=0;
void MOVE_UP(struct map * c,int &renx,int &reny,int &che,int &num);
void MOVE_DOWN(struct map * c,int &renx,int &reny,int &che,int &num);
void MOVE_LEFT(struct map * c,int &renx,int &reny,int &che,int &num);
void MOVE_RIGHT(struct map * c,int &renx,int &reny,int &che,int &num);
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInst,
LPSTR lpszCmdLine,
int nCmdShow)
{
HWND hwnd ;
MSG Msg ;
WNDCLASS wndclass ;
HACCEL haccel;
char lpszClassName[] = "推箱子--清瑞";
char lpszTitle[]= "推箱子--清瑞";
char lpszMenuName[]= "MENU";
wndclass.style = 0;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon(hInstance, "Parliament") ;
wndclass.hCursor = LoadCursor( hInstance, "CURSOR3") ;
wndclass.hbrBackground =(HBRUSH) GetStockObject( WHITE_BRUSH) ;
wndclass.lpszMenuName = lpszMenuName ;
wndclass.lpszClassName = lpszClassName ;
if( !RegisterClass( &wndclass))
{
MessageBeep(0) ;
return FALSE ;
}
hwnd = CreateWindow( lpszClassName,
lpszTitle,
WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX,
CW_USEDEFAULT,
CW_USEDEFAULT,
430,
400,
NULL,
NULL,
hInstance,
NULL) ;
hBm=LoadBitmap(hInstance,"BackBitmap");
GetObject( hBm, sizeof( BITMAP), (LPVOID)&bm) ;
ShowWindow( hwnd, nCmdShow) ;
UpdateWindow(hwnd);
haccel=LoadAccelerators(hInstance,"MAINFRAME");
hInst=hInstance;
while( GetMessage(&Msg, NULL, 0, 0))
{
if(!TranslateAccelerator(hwnd,haccel,&Msg))
{
TranslateMessage( &Msg) ;
DispatchMessage( &Msg) ;
}
}
return Msg.wParam;
}
LRESULT CALLBACK WndProc( HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
{ PAINTSTRUCT ps;
switch(message)
{
case WM_KEYDOWN:
switch(wParam)
{
case VK_UP:
MOVE_UP(g,renx,reny,che,num);
break;
case VK_DOWN:
MOVE_DOWN(g,renx,reny,che,num) ;
break;
case VK_LEFT:
MOVE_LEFT(g,renx,reny,che,num);
break;
case VK_RIGHT:
MOVE_RIGHT(g,renx,reny,che,num);
break;
}
InvalidateRect(hwnd,NULL,0);
break;
case WM_CREATE:
hdc=GetDC(hwnd);
hdcmem=CreateCompatibleDC(hdc);
ReleaseDC(hwnd,hdc);
case WM_PAINT:
hmenu=GetMenu(hwnd);
if(che==0)
EnableMenuItem(hmenu,IDM_BEHIND,MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
else
EnableMenuItem(hmenu,IDM_BEHIND,MF_BYCOMMAND|MF_ENABLED);
if(che==19)
EnableMenuItem(hmenu,IDM_HEAD,MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
else
EnableMenuItem(hmenu,IDM_HEAD,MF_BYCOMMAND|MF_ENABLED);
hdc=BeginPaint(hwnd,&ps);
SelectObject(hdcmem,hBm);
for(i=0;i<14;i++)
for(j=0;j<12;j++)
switch(c.a[j][i])
{
case '0':
BitBlt(hdc,xo+i*30,yo+j*30,30,30,hdcmem,0,0,SRCCOPY);
break;
case '1':
BitBlt(hdc,xo+i*30,yo+j*30,30,30,hdcmem,30,0,SRCCOPY);
break;
case '2':
BitBlt(hdc,xo+i*30,yo+j*30,30,30,hdcmem,60,0,SRCCOPY);
break;
case '3':
BitBlt(hdc,xo+i*30,yo+j*30,30,30,hdcmem,90,0,SRCCOPY);
break;
case '4':
BitBlt(hdc,xo+i*30,yo+j*30,30,30,hdcmem,120,0,SRCCOPY);
break;
case '5':
BitBlt(hdc,xo+i*30,yo+j*30,30,30,hdcmem,150,0,SRCCOPY);
break;
}
BitBlt(hdc,renx,reny,30,30,hdcmem,180,0,SRCCOPY);
EndPaint(hwnd,&ps);
if(num==d[che])
{
Sleep(500);
ch=MessageBox(hwnd,"You have passed this game,Do you want continue?","Conculations",MB_YESNO);
switch(ch)
{
case IDNO:
DeleteObject(hBm);
PostQuitMessage(0);
break;
case IDYES:
che++;
c=b[che];
renx=ren[che][0];
reny=ren[che][1];
num=0;
InvalidateRect(hwnd,NULL,0);
break;
}
}
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDM_HEAD:
if(che<19)
{
che++;
c=b[che];
renx=ren[che][0];
reny=ren[che][1];
num=0;
}
else
MessageBox(hwnd,"This is the latest game,Con not move ahead","SORRY",MB_OK);
InvalidateRect(hwnd,NULL,0);
break;
case IDM_BEHIND:
if(che>0)
{
che--;
c=b[che];
renx=ren[che][0];
reny=ren[che][1];
num=0;
}
else
MessageBox(hwnd,"This is the first game,Con not move behind","SORRY",MB_OK);
InvalidateRect(hwnd,NULL,0);
break;
case IDM_EXIT:
SendMessage(hwnd,WM_DESTROY,0,0);
break;
case IDM_ABOUT:
DialogBox(hInst,"DIALOG1",hwnd,(DLGPROC)DlgProc);
break;
case IDM_BEGIN:
c=b[che];
num=0;
renx=ren[che][0];
reny=ren[che][1];
InvalidateRect(hwnd,NULL,0);
break;
}
break;
case WM_DESTROY:
DeleteObject(hBm);
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,message,wParam,lParam);
}
return 0;
}
BOOL CALLBACK DlgProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
return 1;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
EndDialog( hdlg, 0) ;
return 1;
case IDCANCEL:
EndDialog( hdlg, 0) ;
return 0;
}
break ;
case WM_CLOSE:
EndDialog( hdlg, 0) ;
return 1;
}
return 0;
}
没有合适的资源?快使用搜索试试~ 我知道了~
学生自编的推箱子游戏
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共37个文件
h:4个
pdb:3个
plg:2个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
需积分: 3 9 下载量 49 浏览量
2008-11-24
22:59:03
上传
评论 1
收藏 213KB RAR 举报
温馨提示
自编的一个小游戏,关于推箱子的,试试看,请提出宝贵改进意见。
资源详情
资源评论
资源推荐
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/BMP.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 37 条
- 1
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![torrent](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-iso9660](https://img-home.csdnimg.cn/images/20210720083646.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
xiaohailing
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 一个基本的图书管理系统.rar
- Python合并两张图片.rar
- matlab画图.rar
- VerilogVHDL\FPGA入门教程FPGA器件边练边学-快速入门Verilogvhdl
- 基于C++的mfc的仿QQ聊天系统(高分课程设计期末大作业)
- 基于Java web的学生管理系统(源码+数据库+报告)高分项目
- 基于Java web的学生管理系统(源码+数据库+报告)期末大作业&课程设计
- FM1702SL芯片13.56MHZ NFC读卡器开发板PROTELPCB图+FM1702SL中文说明书+FM1715编程指南
- 期末大作业交通数据分析与应用期末作业程序源码+实验报告.zip
- 期末大作业基于Java web的图书销售管理系统(源码+数据库)高分项目
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
评论0