📄 engine.h
字号:
/*
* ============================================================================
* Name : CGlobalData from CGlobalData.h
* Part of : Game
* Created : 2003-06-16 by Qiu Wei Min
* Description:
* Declares main application class.
* Version :
* Copyright: Gameloft S.A.
* Modify : 2004-8-20 by Chen Yong
* Description:
* Modify for 3d test and 3d egine
* ============================================================================
*/
#ifndef ENGINE_H
#define ENGINE_H
#include "Sysdef.h"
// INCLUDES
#include <aeeappgen.h>
//Qiu Li add for online connection, 2005/03/24
#include "AEEWeb.h"
#include <AEETAPI.h>
#include "..\system\network.h"
//Qiu Li end
#ifdef TIME_STASTIC
enum TIME_TYPE
{
TIMET_COLLISION = 0,
TIMET_RENDERSCENE,
TIMET_RENDERANIMATION,
TIMET_RENDERPLAYER,
// TIMET_RENDERMISC, //OTHER THINGS EXCEPT SCENE AND PLAYER
TIMET_RENDER3DALL,
TIMET_RENDERALL,
TIMET_ALL,
TIMET_COUNT //7
};
#endif
// CONSTANTS
// CLASS DECLARATION
class CSimpleMemory;
class CKeyinput ;
class CGfx;
class CResFile;
class CSound;
class CEngine;
class CGameBase;
class CScene;
class CFont;
class CNetwork;
class CEngine : public AEEApplet
{
//static CEngine *m_pInst;
CEngine() {/*m_pInst = this;*/};
public:
int m_TimerError;
int m_TimerCpt;
int m_initStep;
#ifndef LG
bool m_bSoundVolumeSet;//true if the sound volume has been set in the option.
#endif
void Construct();
/*static CEngine * GetEngine() {
return m_pInst; };*/
enum {
ERROR_NONE = 0,
ERROR_MEMORY,
ERROR_FILE,
ERROR_CREATEINST,
ERROR_OTHER
};
enum {
IMG_FIRELUM,
IMG_FLASHLUM,
IMG_TOTAL
};
int Tick();
bool FirstTimeInit();
void SetGamePointer(CGameBase *pGame);
void Deconstruct();
inline void SetLastError(int errcode){
m_lasterror = errcode;
}
inline int GetLastError(){
return m_lasterror;
}
inline CSimpleMemory* GetMem(){
return m_pMemory;
}
inline CKeyinput* GetInput() {
return m_pInput ;
}
inline CFont* GetFont() {
return m_pFont ;
}
inline CGfx* GetGfx() {
return m_pGfx;
}
inline CResFile* GetRes() {
return m_pResFile;
}
inline const char* GetString(int id){
return m_pStrings[id];
}
inline CSound* GetSound() {
return m_pSound;
}
inline int GetTick(){
return m_tickCount;
}
inline CNetwork* GetNetwork(){
return m_pNetwork;
}
void SetVideoBuffer(void *pBuff, int w, int h);
void* pFileMgr;
char isSuspend;
char memLow;
boolean isKeyPressed;
boolean ismemoryfailed;
void* pLicense;
CGameBase *m_pGame;
//Qiu Li add for online connection, 2005/03/24
IWeb* m_pIWeb;
IWebResp* m_pIWebResp;
IWebUtil* m_pIWebUtil; // use to combine the url for the full url
AEECallback m_Callback;
ITAPI* pITAPI;
//Qiu Li end
#ifdef TIME_STASTIC
int m_TimeOffsets[TIMET_COUNT];
#endif
protected:
int m_tickCount;
int m_lasterror;
CSimpleMemory *m_pMemory;
CKeyinput *m_pInput;
CGfx *m_pGfx;
CResFile *m_pResFile;
CSound *m_pSound;
char **m_pStrings;
int m_nString;
CFont * m_pFont;
CNetwork *m_pNetwork;
};
typedef struct stRefreshAreaTag
{
unsigned char _left;
unsigned char _top;
unsigned char _right;
unsigned char _bottom;
}stRefreshArea;
class CGameBase
{
public:
CGameBase(CEngine * pEngine){ m_pEngine = pEngine; };
CGameBase(){m_running = true;};
virtual ~CGameBase() {};
CEngine * m_pEngine;
stRefreshArea refreshArea; //use
CKeyinput *m_pInput;
virtual void update() {};
virtual void paint() {};
virtual void render() {};
boolean m_running;
int m_frameStartTick;
};
#endif
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -