資源簡介
該程序包是本人大二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界面
評論
共有 條評論