📄 game.h
字号:
// ==========================================================================================================
//
// WORLDMAP 3D FOR BREW MOBILE 2.0+
// Written by Vander Nunes, Dec 2005
//
// ==========================================================================================================
#ifndef __GAME_H__
#define __GAME_H__
#include "game.bid"
#include "../../../engine/torus.h"
#include "../../../engine/scenegraph/scenegraph.h"
#include "../../../engine/sprite.h"
#include "../../../engine/music.h"
// --------------------------------------------------------------------------
//
// USER-DEFINED GAME CLASS
//
// --------------------------------------------------------------------------
class CGame
{
public:
CGame();
~CGame();
// ---------------------------------------------------------------------------------------
//
// Torus 3D Engine mandatory declarations
//
// ---------------------------------------------------------------------------------------
// Application, Shell, and Display
// ***IMPORTANT***: MUST BE THE FIRST CLASS MEMBER...
AEEApplet m_applet;
// engine pointer
CEngine* m_pEngine;
// camera
CCamera* m_pCam;
boolean Init();
void CleanUp();
static void Destroy(CGame* pGame);
static boolean HandleInitEvent(CGame* pGame, AEEEvent eCode, uint16 wParam, uint32 dwParam);
boolean HandleEvent(AEEEvent eCode, uint16 wParam, uint32 dwParam);
boolean KeyPressEvent(uint16 wParam);
boolean KeyReleaseEvent(uint16 wParam);
static void NextFrame(CGame* pGame);
void RenderFrame();
// ---------------------------------------------------------------------------------------
//
// Game specific extensions
//
// ---------------------------------------------------------------------------------------
//
// Game Status
//
#define STATUS_START 1
#define STATUS_LOADING 2
#define STATUS_MENU 3
#define STATUS_HELP 4
#define STATUS_PLAYING 5
//
// Earth characteristics
//
#define EARTH_SIZE 16 // radius
#define EARTH_DISTANCE 128 // distance from sun
//
// Sun characteristics
//
#define SUN_SIZE 4 // radius
#define MESH_SUN TRUE
//
// Moon characteristics
//
#define MOON_SIZE 2 // radius
#define MOON_DISTANCE 32
//
// Chasing
//
#define CHASE_EARTH 1
#define CHASE_SUN 2
#define CHASE_MOON 3
// key Variables
int m_key_state;
uint16 m_key_wParam;
boolean m_kSELECT, m_kLEFT, m_kRIGHT, m_kUP, m_kDOWN, m_kCLEAR;
boolean m_k2, m_k4, m_k6, m_k8;
byte m_jGameStatus;
dword m_dwFrame;
CSceneGraph* m_pScene;
CSceneItem* m_pEarth;
CSceneItem* m_pSun;
CSceneItem* m_pMoon;
CSceneItem* m_pHelp;
CSprite* m_pSpr8x13;
CTGA *m_pMap, *m_pDay, *m_pNight;
char m_jChase;
int m_iCamLongitude, m_iCamLatitude;
int m_iCamDistance;
dword m_dwAddSecs;
// ---------------------------------------------------------------------------------------
//
// Time control
//
// ---------------------------------------------------------------------------------------
JulianType m_LocalDate; // Local time and date
int m_iDaySeconds; // seconds elapsed today in local time
boolean m_bLocalDaylight; // Flag if local daylight saving is active
int m_iTimeOffset; // offset from local to UTC, in seconds
float m_fOrbitDegrees; //
float m_fDayDegrees; //
JulianType m_UTCDate; // UTC time and date
int m_iUTCDaySeconds; // seconds elapsed today in UTC time
// ---------------------------------------------------------------------------------------
//
// Earth inter-frame raytracing
//
// ---------------------------------------------------------------------------------------
typedef struct _raytracing
{
float ya, yda, da;
matrixf_t mRotX, mRotY, mRotFinal;
word y;
} raytracing;
raytracing m_RayTracing;
// ---------------------------------------------------------------------------------------
boolean LoadResources();
void RenderStart();
void RenderHelp();
void RenderPlaying();
void TimeUpdate(void);
void EarthUpdate(void);
void MoonUpdate(void);
float MoonNormalize(float v);
void InitRayTrace(void);
void RayTrace(void);
void FinishRayTrace(void);
boolean SaveRawLight(char *szFile);
};
// --------------------------------------------------------------------------
//
// overloads
//
// --------------------------------------------------------------------------
void *operator new(size_t dwSize) throw()
{
return MALLOC(dwSize);
}
void operator delete(void *po) throw()
{
FREE(po);
}
void *operator new [] (size_t dwSize) throw()
{
return MALLOC(dwSize);
}
void operator delete [] (void *po) throw()
{
FREE(po);
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -