• 大小: 8.65MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-17
  • 语言: C/C++
  • 标签:

资源简介

简单回合制游戏C++ 值得学习 大家可以从中学到 梦幻 大话的精髓之处!

资源截图

代码片段和文件信息


#include “stdafx.h“
#include 
//Download by http://www.codefans.net
//定义一个结构体
struct chr
{
int nHp;
int fHp;
int lv;
int w;
int kind;
};

//全局变量声明
HINSTANCE hInst;
HBITMAP bgsheepgirlskillskillultslashmagicrecovergame;
HDC hdcmdcbufdc;
HWND hWnd;
DWORD tPretNow;
int pNumftxtNum;
bool attackover;
chr playermonster;
char text[5][100];




//全局函数声明
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE int);
LRESULT CALLBACK WndProc(HWND UINT WPARAM LPARAM);
void MyPaint(HDC hdc);
void MsgInsert(char*);
void CheckDie(int hpbool player);

//****WinMain函数,程序入口点函数**************************************
int APIENTRY WinMain(HINSTANCE hInstance
                     HINSTANCE hPrevInstance
                     LPSTR     lpCmdLine
                     int       nCmdShow)
{
MSG msg;

MyRegisterClass(hInstance);

//初始化  
if (!InitInstance (hInstance nCmdShow)) 
{
return FALSE;
}

//消息循环
GetMessage(&msgNULLNULLNULL);            //初始化msg    
    while( msg.message!=WM_QUIT )
    {
        if( PeekMessage( &msg NULL 00 PM_REMOVE) )
        {
            TranslateMessage( &msg );
            DispatchMessage( &msg );
        }
else
{
tNow = GetTickCount();
if(tNow-tPre >= 40)
MyPaint(hdc);
}
    }

return msg.wParam;
}

//***设计一个窗口类,类似填空题,使用窗口结构体*************************
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;

wcex.cbSize = sizeof(WNDCLASSEX); 
wcex.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = NULL;
wcex.hCursor = NULL;
wcex.hCursor = LoadCursor(NULL IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = “canvas“;
wcex.hIconSm = NULL;

return RegisterClassEx(&wcex);
}

//****初始化函数************************************
//加载位图并设定各种初始值 
BOOL InitInstance(HINSTANCE hInstance int nCmdShow)
{
HBITMAP bmp;
hInst = hInstance;

hWnd = CreateWindow(“canvas“ “浅墨的绘图窗口“  WS_OVERLAPPEDWINDOW
CW_USEDEFAULT 0 CW_USEDEFAULT 0 NULL NULL hInstance NULL);

if (!hWnd)
{
return FALSE;
}

MoveWindow(hWnd1010640510true);
ShowWindow(hWnd nCmdShow);
UpdateWindow(hWnd);

hdc = GetDC(hWnd);
mdc = CreateCompatibleDC(hdc);
bufdc = CreateCompatibleDC(hdc);

bmp = CreateCompatibleBitmap(hdc640510);
Selectobject(mdcbmp);

bg = (HBITMAP)LoadImage(NULL“bg.bmp“IMAGE_BITMAP640510LR_LOADFROMFILE);
sheep = (HBITMAP)LoadImage(NULL“sheep.bmp“IMAGE_BITMAP133220LR_LOADFROMFILE);
girl = (HBITMAP)LoadImage(NULL“girl.bmp“IMAGE_BITMAP480148LR_LOADFROMFILE);
skill = (HBITMAP)LoadImage(NULL“skill.bmp“IMAGE_BITMAP5050LR_LOADFROMFILE);
skillult = (HBITMAP)LoadImage(NULL“skillult.bmp“IMAGE_BITMAP5050LR_

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        167  2008-09-26 21:50  ym_vcpp-0canvas_hicode\hicode\HiCode.cn.url

     文件    1305654  2012-04-09 21:13  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\bg.bmp

     文件       1260  2003-07-02 04:34  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\canvas.aps

     文件      55272  2012-04-10 16:03  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\canvas.asm

     文件      10981  2012-04-15 13:00  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\canvas.cpp

     文件       4325  2003-07-08 09:54  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\canvas.dsp

     文件        326  2003-06-28 10:16  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\canvas.h

     文件       1662  2003-06-28 10:53  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\canvas.rc

     文件   24727552  2012-04-10 16:05  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\canvas.sdf

     文件        878  2012-04-10 16:03  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\canvas.sln

    ..A..H.     12800  2012-04-10 16:05  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\canvas.suo

     文件       7647  2012-04-07 12:17  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\canvas.vcxproj

     文件       1436  2012-04-07 12:17  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\canvas.vcxproj.filters

     文件        143  2012-04-07 11:53  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\canvas.vcxproj.user

     文件     213174  2003-09-17 07:20  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\girl.bmp

     文件        167  2008-09-26 21:50  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\HiCode.cn.url

     文件   17498112  2012-04-10 15:49  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\ipch\canvas-f61e5085\canvas-efd88512.ipch

     文件      60054  2003-09-19 10:57  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\magic.bmp

     文件      64286  2003-09-22 10:51  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\over.bmp

     文件       2065  2003-06-28 10:16  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\ReadMe.txt

     文件     135054  2003-09-19 11:21  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\recover.bmp

     文件        410  2003-06-28 10:53  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\resource.h

     文件      88054  2003-09-17 07:15  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\sheep.bmp

     文件      16438  2012-04-10 12:50  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\skill.bmp

     文件      10054  2012-04-10 13:43  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\skillult.bmp

     文件      95310  2003-09-18 08:02  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\slash.bmp

     文件        273  2012-04-10 16:03  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\StdAfx.asm

     文件        293  2003-06-28 10:16  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\StdAfx.cpp

     文件        936  2003-06-28 10:16  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\StdAfx.h

     文件       3068  2009-12-15 11:18  ym_vcpp-0canvas_hicode\hicode\Visual C++回合制游戏demo\请先读我.htm

............此处省略11个文件信息

评论

共有 条评论