📄 cgame.h
字号:
/*
*
============================================================================
* Name : CGame.h
* Part of : Example3D
* Created : 12/14/2003 by Forum Nokia
* Description:
* This is the project specification file for Example3D.
* Initial content was generated by Series 60 AppWizard.
*
* Version : 1.0.0
* Copyright: Forum Nokia
*
============================================================================
*/
#ifndef __CGAME_H__
#define __CGAME_H__
// INCLUDES
#include <e32base.h>
#include "MGame.h"
#include "3dtypes.h"
// FORWARD DECLARATIONS
class C3DBase;
class C3DRenderer;
class CPolygonObject;
// ENUMERATIONS
enum TCameraMode
{
ECameraBehind, // camera follows behind car
ECameraSouth, // camera looks to car from south
ECameraLookAt // camera looks to car from where ever camera might be
};
// CLASS DECLARATION
/**
* CGame implemets MGame class
* MGame classes are used by CEngine
* Which calls Draw and Move functions
*/
class CGame
: public CBase
, public MGame
{
public:
/// Two-phased constructor
/// @param aDisplayMode display's color mode
/// @param aScreen bitmap to draw to
static CGame* NewL( TDisplayMode aDisplayMode, const TBitmap& aScreen );
/// Destructor
~CGame();
private:
/// Second-phase constructor
/// @param aScreen bitmap to draw to
void ConstructL( const TBitmap& aScreen );
/// Default constructor
CGame( TDisplayMode aDisplayMode );
public: // MGame
/// Called from CEngine
/// @param aScreen bitmap to draw to
void Draw( const TBitmap& aScreen );
/// Called from CEngine
/// @param aKey key table to read key press states
/// for example if( aKey[ '1' ] ) Pause();
void Move( TUint8* aKey );
private: // New methods:
/// creates a wheel 3D-object with given parameters
/// with more points the wheel is more like a circle
/// @param aRadius wheel radius
/// @param aWidth wheel width
/// @param aNumPoints number of points used on wheel surface
CPolygonObject* CreateWheel( TInt aRadius, TInt aWidth, TInt aNumPoints );
/// creates a 3D-object from given data
/// @param aVertexData pointer to vertex data
/// @param aFaceData pointer to face data
/// @param aNumVertices number of vertices in vertex data
/// @param aNumFaces number of faces in face data
/// @param aTexOffset offset added to texture coordinates
/// @param aTexMul original texture coordinates are multiplied with this
CPolygonObject* CreateObject( const TInt* aVertexData, const TInt* aFaceData,
TInt aNumVertices, TInt aNumFaces,
const TPoint& aTexOffset, TInt aTexMul );
private: // data
TDisplayMode iDisplayMode; // color mode to use
TBitmap iTexture; // textures for car and road
TBitmap iTexture2; // textures for house
C3DBase* i3DBase; // base for all 3D
C3DRenderer* iRender; // 3D-renderer
CPolygonObject* i3dHouse; // house building
CPolygonObject* i3dRoad; // one tile of road
CPolygonObject* i3dGrass; // one tile of grass
CPolygonObject* i3dCar; // the car
CPolygonObject* i3dFrontWheel; // one piece of front wheels
CPolygonObject* i3dRearWheel; // one piece of rear wheels
TInt iCarAngle; // car position and movemet parameters
TInt iCarAngleSpeed;
TInt iCarSpeed;
TInt iCarPos;
TVertex iCarPosition;
TVertex iCarPositionAdd;
TInt iSpeed;
TInt iAngleSpeed;
TInt iSteerAngle;
TInt iThrottle;
TCameraMode iCameraMode; // camera mode
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -