⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 racex.h

📁 Visual C++ 游戏开发与设计实例 源代码(所有)
💻 H
字号:
// RACE X
//
// Written by Mauricio Teichmann Ritter
//
// Copyright (C) 2002, Brazil. All rights reserved.
// 
//

#include "stdafx.h"
#include "cRaceCar.h"	// Added by ClassView
#include ".\applib\cApplication.h"
#include ".\applib\cKeyboard.h"
#include ".\applib\cMouse.h"
#include ".\applib\cSurface.h"
#include ".\applib\cSprite.h"
#include ".\applib\cMultiplayer.h"
#include ".\applib\cMessageHandler.h"

#include ".\applib\cSoundInterface.h"
#include ".\applib\cSound.h"
#include ".\applib\cWavFile.h"




#include "cRaceTrack.h"
#include "cCompetition.h"
#include "cTextWriter.h"

#define GS_MAINSCREEN			1
#define GS_RACE					2
#define GS_CREATEGAME			3
#define GS_JOINGAME				4
#define GS_CREDITS				5
#define GS_HELP					6

#define GS_SELECTTRACK_AND_CAR	11
#define GS_SELECTCAR			12
#define GS_RACECOMPLETED		13
#define GS_COMPETITIONSTATUS	14
#define GS_NETWORKSTATUS		15
#define GS_WAIT					16
#define GS_WAITCOMPETITION		17



#define MSG_PLAYER_INFO			1
#define MSG_START_RACE			2
#define MSG_KEYBOARD_STATUS		3
#define MSG_RACECARS_STATUS		4
#define MSG_RACECARS_INFO		5
#define MSG_COMPETITIONSTATUS	6
#define MSG_PLAYER_READY		7


// This is the main application class

class cRaceXApp : public cApplication, cMessageHandler
{

private:
	// This holds the startup flag for each one of the game states
	int				iStart;

	// This vector hold the track names
	STRVECTOR		pTrackNames;

	// RaceTrack instance
	cRaceTrack		pRaceTrack;

	// This is used to process the Mouse and Keyboard input
	cMouse			m_Mouse;
	cKeyboard		m_Keyboard;

	// Textwritter classes, used to write text on the screen

	cTextWriter		m_txDigital;
	cTextWriter		m_txDigitalSmall;
	cTextWriter		m_txVerdana;

	// Competiion class instance
	cCompetition	m_pCompetition;

	// Main DXSound wrapper interface
	cSoundInterface	m_pSoundInterface;

	// Multiplayer Management object
	cMultiplayer	m_pMultiPlayer;

public:
	int GetDifficultyLevel();
	int m_iDifficultyLevel;
	cSurface m_surfCarPannel;
	BOOL m_bSendKeyboard;
	cMultiplayer* GetMultiplayer();
	BOOL m_bIsMultiplayer;
	BOOL CheckInput(string*, int iMax);
	
	string m_sPlayerName;
	string m_sGameName;
	cSprite m_sptrCar;
	int m_iIncrY;
	int m_iIncrX;

	// Sound Objects
	cSound m_sndChangeOption;
	cSound m_sndSelect;
	cSound m_sndType;

	int m_iOption;
	int m_iTrack;
	
	// Surface Objects
	cSurface m_surfBigCars[4];
	cSurface m_surfCursor;
	cSurface m_surfCaret;
	cSurface m_surfTitle;
	cSurface m_surfHelmet;
	cSurface m_surfPanel;
	cSurface m_surfTophy;
	cSurface m_surfPositions;



	int m_iState;
	cSurface m_hcHit;
	cRaceCar* pCar;

	// To show the track to select
	int		 m_iX, m_iY;
	void ExitApp();

	cRaceXApp() : cApplication()
	{

		m_bSendKeyboard = TRUE;
		m_lpszAppName = "RaceX";
		m_lpszwndClassName = "RaceXWnd";
		m_iState = GS_MAINSCREEN;
		m_bIsMultiplayer = FALSE;
		iStart = 0;

		WIN32_FIND_DATA	lpFindData;
		

		HANDLE hFileFinder = FindFirstFile("*.rxt", &lpFindData);
		if(hFileFinder)
		{
			char*	lpTmpString;
			do
			{
				lpTmpString = (char*) malloc(strlen(lpFindData.cFileName)+1);
				memcpy(lpTmpString, lpFindData.cFileName, strlen(lpFindData.cFileName)+1);
				pTrackNames.push_back(lpTmpString);
				lpTmpString = NULL;
			}while(FindNextFile(hFileFinder, &lpFindData) != 0);
		}		
	}

	~cRaceXApp()
	{
	}

	void AppInitialized();
	void DoIdle();
	void IncomingMessage(DWORD dwType, int idSender, BYTE* pBuffer, DWORD dwBufferSize);

};


cRaceXApp* GetRaceXApp();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -