C语言~~自制-拼图游戏.doc
文本预览下载声明
//编译环境VC++6.0. 程序和资源一共15M.//需要的留个EMAIL....??能上传到这里供大家下载吗???谁知道告诉我//自制-拼图游戏???作者:高坤??转载请标明出处??谢谢//代码笨拙??高手勿笑???欢迎批评指正#include windows.h#include stdio.h#include time.h#include mmsystem.h#include resource.hHINSTANCE hInst;HBITMAP pic,empty,compare_pic,pict[8],compare_pict[8],other;??? //所有图的变量名HDC hdc,mdc;??????????????????????????????????????????????????? //DC名int mouse_x,mouse_y,n=0,line=3,high3=100,high4=200,high5=300;???//鼠标X Y 移动步数 难度 记录char str[10]= ;???????????????????????????????????????????????//字符串,显示步数和记录时用bool fin=false,new3=true,new4=false,new5=false;?????????????????//完成 难度三 四 五 的重绘struct Point{????int x;????int y; ????int num;}point[26];?????????????????????????????????????????????????????//块ATOM MyRegisterClass(HINSTANCE hInstance);BOOL InitInstance(HINSTANCE, int);LRESULT CALLBACK????WndProc(HWND, UINT, WPARAM, LPARAM);void MyPaint();??????????????????????????????????????????????????//显示void Change_Block(int block1,int block2);????????????????????????//交换两块的属性void Save();?????????????????????????????????????????????????????//保存记录void GetPos();???????????????????????????????????????????????????//为重绘做的随机排列int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){????MSG msg;????MyRegisterClass(hInstance);????if (!InitInstance (hInstance, nCmdShow))??? //如果实例化失败,退出????{????????return FALSE;????}????while (GetMessage(msg, NULL, 0, 0))????????//消息循环,一直获取消息,直到消息返回值为假????{????????TranslateMessage(msg);?????????????????//翻译消息????????DispatchMessage(msg);??????????????????//将消息发到适当的对象上????}????return msg.wParam;}ATOM MyRegisterClass(HINSTANCE hInstance)??? //注册窗口类,通知你要建的窗口是什么样的.可以有多个,用类名来区分{????WNDCLASSEX wcex;??????????????????????????????????????//类名????wcex.cbSize = sizeof(WNDCLASSEX);?????????????????????//类的长度?????? cb...表示存储空间????wcex.style????????????= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;????????//窗口风格??水平horizontal.垂直vertical.重画redraw????wcex.lpfnWndProc??
显示全部