无需配置环境,下载可用,VC6.0编译环境,完整实现fc蓝白机坦克大战的完整源代码。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-01-12 09:19 坦克大战
文件 18000 2011-08-12 11:40 坦克大战BattleCity.aps
文件 5273 2000-02-16 19:50 坦克大战BattleCity.dsp
文件 545 2004-01-30 04:34 坦克大战BattleCity.dsw
文件 52224 2012-01-12 11:50 坦克大战BattleCity.ncb
文件 49664 2011-08-12 16:40 坦克大战BattleCity.opt
文件 1782 2011-08-12 11:58 坦克大战BattleCity.plg
文件 2114 2000-02-17 22:53 坦克大战BattleCity.rc
文件 909 2012-01-12 09:19 坦克大战BattleCity.sln
..A..H. 10240 2012-01-12 11:50 坦克大战BattleCity.suo
文件 7722 2012-01-12 09:19 坦克大战BattleCity.vcproj
文件 1944 2005-01-31 18:35 坦克大战code999.com说明.txt
目录 0 2012-01-12 11:45 坦克大战Debug
文件 163840 2012-01-12 11:45 坦克大战DebugBattleCity.exe
文件 6422528 2012-01-12 09:19 坦克大战DebugBattleCity.pch
文件 1330176 2012-01-12 11:45 坦克大战DebugBattleCity.pdb
文件 1204 2011-08-12 11:32 坦克大战DebugBattleCity.res
文件 2087 2012-01-12 11:45 坦克大战DebugBuildLog.htm
文件 250593 2012-01-12 09:19 坦克大战DebugGame.obj
文件 19185 2011-08-12 11:32 坦克大战DebugInput.obj
文件 28064 2011-08-12 11:32 坦克大战DebugPlane.obj
文件 20744 2011-08-12 11:32 坦克大战DebugSound.obj
文件 39235 2011-08-12 11:32 坦克大战DebugSprite.obj
文件 181248 2011-08-12 11:32 坦克大战Debugvc60.idb
文件 110592 2011-08-12 11:32 坦克大战Debugvc60.pdb
文件 117760 2012-01-12 09:19 坦克大战Debugvc70.idb
文件 651264 2012-01-12 09:19 坦克大战Debugvc70.pdb
文件 19007 2011-08-12 11:32 坦克大战Debugwavread.obj
文件 34847 2000-07-02 17:40 坦克大战Game.cpp
文件 2649 2000-05-20 19:24 坦克大战Game.h
............此处省略78个文件信息
// Game.cpp: implementation of the CGame class.
//
//////////////////////////////////////////////////////////////////////
#include
#include “Game.h“
#include “resource.h“
#define SCREEN_W 640
#define SCREEN_H 480
#define OFFSETX 100
#define OFFSETY 48
#define Player1_STARTX 130
#define Player1_STARTY 386
#define Player2_STARTX 258
#define Player2_STARTY 386
#define SAFE_RELEASE(x) if(x){ x->Release(); x = NULL; }
CGame* g_pGame;
inline int random( int min int max )
{
return (min + rand() % (max - min + 1));
}
void TRACE( LPCTSTR format ... )
{
char buf[128];
va_list vl;
va_start(vl format);
sprintf(buf format vl);
OutputDebugString( buf );
va_end(vl);
}
void CGame::OutputText( int x int y LPCTSTR string )
{
HDC hdc;
if( m_pddsBackBuffer &&
m_pddsBackBuffer->GetDC(&hdc) == DD_OK )
{
SetBkMode( hdc TRANSPARENT );
SetTextColor( hdc RGB(2552550) );
TextOut( hdc x y string lstrlen(string) );
m_pddsBackBuffer->ReleaseDC( hdc );
}
}
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CGame::CGame()
{
m_hInst = NULL;
m_hWnd = NULL;
m_bActive = FALSE;
m_bShowStats = FALSE;
m_bFullScreen = TRUE;
m_bSingle = TRUE;
m_pDD = NULL;
m_pddsFrontBuffer = NULL;
m_pddsBackBuffer = NULL;
g_pGame = this;
}
CGame::~CGame()
{
}
LRESULT CALLBACK WndProc( HWND hWnd UINT uMsg WPARAM wParam LPARAM lParam )
{
if( g_pGame )
return g_pGame->MsgProc( hWnd uMsg wParam lParam );
return DefWindowProc( hWnd uMsg wParam lParam );
}
LRESULT CGame::MsgProc( HWND hWnd UINT uMsg WPARAM wParam LPARAM lParam )
{
switch( uMsg )
{
case WM_ACTIVATEAPP:
if( m_bActive = (BOOL)wParam )
m_DirectInput.Acquire();
return 0;
case WM_SETCURSOR:
if( m_bFullScreen )
{
SetCursor( NULL );
return TRUE;
}
break;
case WM_CLOSE:
PostQuitMessage(0);
return 0;
case WM_MOVE:
m_bActive = TRUE;
GetClientRect( hWnd &m_rcWindow );
ClientToScreen( hWnd (LPPOINT)&m_rcWindow );
ClientToScreen( hWnd (LPPOINT)&m_rcWindow + 1 );
return 0;
case WM_MOVING:
m_bActive = FALSE;
break;
case WM_KEYDOWN:
switch( wParam )
{
case VK_ESCAPE:
if( m_gameState == GS_ACTIVE )
m_gameState = GS_SPLASH;
else if( m_gameState == GS_SPLASH )
PostQuitMessage(0);
else if( m_gameState == GS_OVER )
m_gameState = GS_SPLASH;
break;
case VK_F4:
DDTerm();
m_bFullScreen = !m_bFullScreen;
DDInit();
return 0;
case VK_F5:
m_bShowStats = !m_bShowStats;
return 0;
case VK_DOWN:
case VK_UP:
if( m_gameState == GS_SPLASH )
{
m_bSingle = !m_bSingle;
return 0;
}
break;
case VK_PRIOR:
if( m_gameState == GS_ACTIVE && m_nLevel > 1
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-01-12 09:19 坦克大战
文件 18000 2011-08-12 11:40 坦克大战BattleCity.aps
文件 5273 2000-02-16 19:50 坦克大战BattleCity.dsp
文件 545 2004-01-30 04:34 坦克大战BattleCity.dsw
文件 52224 2012-01-12 11:50 坦克大战BattleCity.ncb
文件 49664 2011-08-12 16:40 坦克大战BattleCity.opt
文件 1782 2011-08-12 11:58 坦克大战BattleCity.plg
文件 2114 2000-02-17 22:53 坦克大战BattleCity.rc
文件 909 2012-01-12 09:19 坦克大战BattleCity.sln
..A..H. 10240 2012-01-12 11:50 坦克大战BattleCity.suo
文件 7722 2012-01-12 09:19 坦克大战BattleCity.vcproj
文件 1944 2005-01-31 18:35 坦克大战code999.com说明.txt
目录 0 2012-01-12 11:45 坦克大战Debug
文件 163840 2012-01-12 11:45 坦克大战DebugBattleCity.exe
文件 6422528 2012-01-12 09:19 坦克大战DebugBattleCity.pch
文件 1330176 2012-01-12 11:45 坦克大战DebugBattleCity.pdb
文件 1204 2011-08-12 11:32 坦克大战DebugBattleCity.res
文件 2087 2012-01-12 11:45 坦克大战DebugBuildLog.htm
文件 250593 2012-01-12 09:19 坦克大战DebugGame.obj
文件 19185 2011-08-12 11:32 坦克大战DebugInput.obj
文件 28064 2011-08-12 11:32 坦克大战DebugPlane.obj
文件 20744 2011-08-12 11:32 坦克大战DebugSound.obj
文件 39235 2011-08-12 11:32 坦克大战DebugSprite.obj
文件 181248 2011-08-12 11:32 坦克大战Debugvc60.idb
文件 110592 2011-08-12 11:32 坦克大战Debugvc60.pdb
文件 117760 2012-01-12 09:19 坦克大战Debugvc70.idb
文件 651264 2012-01-12 09:19 坦克大战Debugvc70.pdb
文件 19007 2011-08-12 11:32 坦克大战Debugwavread.obj
文件 34847 2000-07-02 17:40 坦克大战Game.cpp
文件 2649 2000-05-20 19:24 坦克大战Game.h
............此处省略78个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)