• 大小: 1.55M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-14
  • 语言: 其他
  • 标签: 其他  

资源简介

拼图游戏(c源代码附程序).zip

资源截图

代码片段和文件信息

// Puzzle.cpp : 定义应用程序的入口点。
//

#include “stdafx.h“
#include “Puzzle.h“
#include “PuzzleMain.h“

CPuzzleMain g_PuzzleMain;//保存游戏实例

#define MAX_LOADSTRING 100

// 全局变量:
HINSTANCE hInst; // 当前实例
TCHAR sztitle[MAX_LOADSTRING]; // 标题栏文本
TCHAR szWindowClass[MAX_LOADSTRING]; // 主窗口类名

// 此代码模块中包含的函数的前向声明:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE int);
LRESULT CALLBACK WndProc(HWND UINT WPARAM LPARAM);
INT_PTR CALLBACK About(HWND UINT WPARAM LPARAM);

int APIENTRY _tWinMain(HINSTANCE hInstance
                     HINSTANCE hPrevInstance
                     LPTSTR    lpCmdLine
                     int       nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);

  // TODO: 在此放置代码。
MSG msg;
HACCEL hAccelTable;

// 初始化全局字符串
LoadString(hInstance IDS_APP_title sztitle MAX_LOADSTRING);
LoadString(hInstance IDC_PUZZLE szWindowClass MAX_LOADSTRING);
MyRegisterClass(hInstance);

// 执行应用程序初始化:
if (!InitInstance (hInstance nCmdShow))
{
return FALSE;
}

hAccelTable = LoadAccelerators(hInstance MAKEINTRESOURCE(IDC_PUZZLE));

// 主消息循环:
while (GetMessage(&msg NULL 0 0))
{
if (!TranslateAccelerator(msg.hwnd hAccelTable &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

return (int) msg.wParam;
}



//
//  函数: MyRegisterClass()
//
//  目的: 注册窗口类。
//
//  注释:
//
//    仅当希望
//    此代码与添加到 Windows 95 中的“RegisterClassEx”
//    函数之前的 Win32 系统兼容时,才需要此函数及其用法。调用此函数十分重要,
//    这样应用程序就可以获得关联的
//    “格式正确的”小图标。
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;

wcex.cbSize = sizeof(WNDCLASSEX);

wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance MAKEINTRESOURCE(IDI_PUZZLE));
wcex.hCursor = LoadCursor(NULL IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_PUZZLE);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance MAKEINTRESOURCE(IDI_SMALL));

return RegisterClassEx(&wcex);
}

//
//   函数: InitInstance(HINSTANCE int)
//
//   目的: 保存实例句柄并创建主窗口
//
//   注释:
//
//        在此函数中,我们在全局变量中保存实例句柄并
//        创建和显示主程序窗口。
//
BOOL InitInstance(HINSTANCE hInstance int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // 将实例句柄存储在全局变量中

   hWnd = CreateWindow(szWindowClass sztitle 
WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_MAXIMIZEBOX
      CW_USEDEFAULT 0 800 600 NULL NULL hInstance NULL);

   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd nCmdShow);
   UpdateWindow(hWnd);

   g_PuzzleMain.InitMain(hWnd);

   return TRUE;
}

//
//  函数: WndProc(HWND UINT WPARAM LPARAM)
//
//  目的: 处理主窗口的消息。
//
//  WM_COMMAND - 处理应用程序菜单
//  WM_PAINT - 绘制主窗口
//  WM_DESTROY - 发送退出消息并返回
//

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-11-26 22:03  拼图游戏(c++源代码附程序)\
     文件        4918  2013-05-29 06:55  拼图游戏(c++源代码附程序)\Puzzle.cpp
     文件       62464  2013-05-29 07:54  拼图游戏(c++源代码附程序)\Puzzle.exe
     文件          39  2013-05-28 17:33  拼图游戏(c++源代码附程序)\Puzzle.h
     文件        4266  2013-05-29 07:40  拼图游戏(c++源代码附程序)\PuzzleLogic.cpp
     文件         851  2013-05-29 07:23  拼图游戏(c++源代码附程序)\PuzzleLogic.h
     文件        1450  2013-05-29 07:06  拼图游戏(c++源代码附程序)\PuzzleMain.cpp
     文件         575  2013-05-29 06:23  拼图游戏(c++源代码附程序)\PuzzleMain.h
     文件        1670  2013-05-29 06:46  拼图游戏(c++源代码附程序)\PuzzleSound.cpp
     文件         333  2013-05-28 23:42  拼图游戏(c++源代码附程序)\PuzzleSound.h
     文件        6841  2013-05-29 07:40  拼图游戏(c++源代码附程序)\PuzzleView.cpp
     文件        1478  2013-05-29 07:40  拼图游戏(c++源代码附程序)\PuzzleView.h
     目录           0  2013-05-29 17:30  拼图游戏(c++源代码附程序)\res\
     文件     1440056  2014-11-26 21:48  拼图游戏(c++源代码附程序)\res\background01.bmp
     文件     1451612  2014-11-27 21:11  拼图游戏(c++源代码附程序)\res\backmusic05.wav
     文件        8422  2013-05-29 06:13  拼图游戏(c++源代码附程序)\res\click02.wav
     文件      320056  2014-11-26 22:09  拼图游戏(c++源代码附程序)\res\pintu01.bmp
     文件       80056  2014-11-26 22:09  拼图游戏(c++源代码附程序)\res\smallpintu01.bmp
     文件        2256  2013-05-29 06:29  拼图游戏(c++源代码附程序)\resource.h
     文件         211  2013-05-28 17:33  拼图游戏(c++源代码附程序)\stdafx.cpp
     文件         420  2013-05-28 17:33  拼图游戏(c++源代码附程序)\stdafx.h
     文件         236  2013-05-28 17:33  拼图游戏(c++源代码附程序)\targetver.h
     文件          44  2014-11-26 22:06  拼图游戏(c++源代码附程序)\游戏说明.txt

评论

共有 条评论