资源简介
该程序包是本人大二Windows的游戏课设,所有文件是C++代码。其中包含的图片资源,应该能给到同学们帮助。

代码片段和文件信息
#include “stdafx.h“
#include “fish.h“
#include “Bullet.h“
#include
void addfishes();
bool pz_judge (int iint k);
//全局变量声明
HINSTANCE hInst;
Fish fishes;
Fish fishes_f[50];
int f_xf_yfc_xfc_y;//fc鱼被抓时坐标
int fcount;
int xyN_xN_y; //x,y代表鼠标光标所在位置
int ck_x = 521ck_y = 645; //炮口坐标
HBITMAP bg;
HBITMAP ui_1ui_2;
HBITMAP cannonbulletnet;
HBITMAP button_addbutton_reduce;
HBITMAP number;
HBITMAP fish;
HDC hdcmdcbufdc;
HWND hWnd;
DWORD tPretNowtCheck; //声明三个函数来记录时间tPre记录上一次绘图的时间,tNow记录此次准备绘图的时间,tCheck记录每秒开始的时间
bool r_keyupl_keyup;
int cnumnumframefps; //num用来记录图号,frame用来累加每次画面更新的次数fps(frame per second)用来记录每秒画面更新的次数
int bcountbfee;//记录现有子弹数
int lv_c;
int money;
BULLET b[30]; //声明一个“bullet”类型的数组,用来存储炮台发出的子弹
//全局函数的声明
ATOM MyRegisterClass
(HINSTANCE hInstance);
BOOL InitInstance
(HINSTANCE int);
LRESULT CALLBACK WndProc(HWND UINT WPARAM
LPARAM);
void MyPaint(HDC hdc);
//***WinMain函数,程序入口点函数**************************************
int APIENTRY WinMain(HINSTANCE hInstance
HINSTANCE hPrevInstance
LPSTR lpCmdLine
int nCmdShow)
{
MSG msg;
MyRegisterClass(hInstance);
//运行初始化函数
if (!InitInstance (hInstance nCmdShow))
{
return FALSE;
}
//游戏循环
GetMessage(&msgNULLNULLNULL);
while( msg.message!=WM_QUIT )
{
if( PeekMessage( &msg NULL 00 PM_REMOVE) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
tNow = GetTickCount();
if(tNow-tPre >= 100) //当此次循环运行与上次绘图时间相差0.1秒时再进行重绘操作
MyPaint(hdc);
}
}
return msg.wParam;
}
//****设计一个窗口类,类似填空题,使用窗口结构体*************************
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW |
CS_VREDRAW;
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 = “mywindows“;
wcex.hIconSm = NULL;
return RegisterClassEx(&wcex);
}
//****初始化函数*************************************
// 从文件加载位图
BOOL InitInstance(HINSTANCE hInstance int nCmdShow)
{
char filename[20] = ““;
HBITMAP bmp;
hInst = hInstance;
hWnd = CreateWindow(“mywindows“
“捕鱼达人“
WS_OVERLAPPEDWINDOW
CW_USEDEFAULT
0
CW_USEDEFAULT
0
NULL
NULL
hInstance
NULL);
if (!hWnd)
{
return FALSE;
}
MoveWindow(hWnd10101040805true);
ShowWindow(hWnd nCmdShow);
UpdateWindow(hWnd);
hdc = GetDC(hWnd);
mdc = CreateCompatibleDC(hdc);
bufdc = CreateCompatibleDC(hdc);
bmp = CreateCompatibleBitmap(hdc
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 154 2018-06-19 21:14 Fisherman\Bullet.h
文件 380 2018-06-19 21:04 Fisherman\fish.h
文件 4134 2018-06-19 22:17 Fisherman\Fisherman.dsp
文件 526 2018-06-16 20:09 Fisherman\Fisherman.dsw
文件 58368 2018-06-21 22:39 Fisherman\Fisherman.ncb
文件 49664 2018-06-21 22:39 Fisherman\Fisherman.opt
文件 1328 2018-06-21 22:38 Fisherman\Fisherman.plg
目录 0 2018-09-29 15:03 Fisherman\images\
文件 2359350 2018-06-16 22:33 Fisherman\images\bj.bmp
文件 186060 2018-07-06 14:20 Fisherman\images\bj.jpg
文件 8790 2018-06-18 16:05 Fisherman\images\button_add.bmp
文件 8790 2018-06-18 16:05 Fisherman\images\button_reduce.bmp
文件 786486 2018-06-17 13:44 Fisherman\images\cannon.bmp
文件 5212 2018-06-19 21:19 Fisherman\images\cannon.txt
文件 3145782 2018-06-17 14:44 Fisherman\images\fish.bmp
文件 64579 2018-06-20 19:07 Fisherman\images\fish.txt
文件 3145782 2018-06-17 16:40 Fisherman\images\fish2.bmp
文件 34589 2018-06-17 16:40 Fisherman\images\fish2.txt
文件 3145782 2018-06-18 11:41 Fisherman\images\fish3.bmp
文件 22634 2018-06-18 16:19 Fisherman\images\fish3.txt
文件 7110 2018-06-18 15:06 Fisherman\images\number.bmp
文件 221454 2018-06-17 13:22 Fisherman\images\ui_box_01.bmp
文件 486054 2018-06-16 23:03 Fisherman\images\ui_box_02.bmp
文件 28845 2018-06-21 22:38 Fisherman\main.cpp
文件 2126 1998-05-13 00:00 Fisherman\MSIMG32.LIB
目录 0 2018-09-29 15:03 Fisherman\music\
文件 1089818 2013-11-01 11:21 Fisherman\music\bg.wav
文件 8313 2013-11-01 11:21 Fisherman\music\bgm_fire.ogg
文件 9261 2013-11-01 11:21 Fisherman\music\bgm_net.ogg
文件 29282 2013-11-01 11:21 Fisherman\music\coinanimate.ogg
文件 24435 2013-11-01 11:21 Fisherman\music\coinsnone.ogg
............此处省略7个文件信息
- 上一篇:基于c++的m序列的实现方式
- 下一篇:数值计算 c代码及简单的MFC界面
相关资源
- 国际象棋的qt源代码
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- c++ 画图(14Qt-XPS)
- c++多边形交并差运算
评论
共有 条评论