?? gameobject.h
字號:
/**************************************************************************************
Project Name : Map Edit of my game
Module Name : The base class of object.
File Name : GameObject.h: interface for the CObject class.
Create : 2007-7-5, by Vigame
Update : 2007-7-8, deleted the data CObjectTexture *m_pTexture, added
class CGameResource, when we should use pic, we use objType
and m_nTextureIndex to find a pic in class CGameResource,
draw it in CGraphics. by Vigame.
2007-7-17, Add hit test function, by Vigame
2007-7-19, Add draw sprite fuction, by Vigame
Copyright :
Reference :
Abstrct : The descriptions of all objects.
**************************************************************************************/
#if !defined(AFX_OBJECT_H__9ADB7DE7_6608_4678_8875_A37737257C2E__INCLUDED_)
#define AFX_OBJECT_H__9ADB7DE7_6608_4678_8875_A37737257C2E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "myd3d.h"
#include "GlobalDefs.h"
class CGameObject
{
public:
CGameObject();
virtual ~CGameObject();
bool operator <(const CGameObject &)const; // For display sort
bool operator >(const CGameObject &)const;
public:
int GetWidth();
int GetHeight();
int GetIndex();
// Draw() fuction must be used only between BeginScene() and EndScene()
virtual void DrawSprite(LPD3DXSPRITE &pSprite,
CONST RECT *pSrcRect, CONST D3DXVECTOR3 *pPosition);
virtual void Draw(LPDIRECT3DDEVICE9 &pDevice);
virtual void Draw(LPDIRECT3DDEVICE9 &pDevice, int x, int y);
virtual void Draw(LPDIRECT3DTEXTURE9 &pTexture, LPDIRECT3DDEVICE9 &pDevice, int x, int y);
virtual void Draw(LPDIRECT3DTEXTURE9 &pTexture, LPDIRECT3DDEVICE9 &pDevice,
int x, int y, int width, int height, DWORD diffuse);
BOOL HitTest(CGameObject &inObject); // Test whether the object hit another
// BOOL CreateTexture(LPDIRECT3DDEVICE9 pDevice, LPCTSTR inFileName, DWORD inColorKey);
public:
// The coordinate
int m_nX;
int m_nY;
// The size
int m_nWidth;
int m_nHeight;
int m_nHp; // The objet's HP, if HP < 0, it disappeared
bool m_bActive;
Object_Type m_objType; // The type
int m_nTextureIndex; // The index of eatch type object's picture
int m_nIndex; // The index of the object
LPDIRECT3DTEXTURE9 m_pTexture; // IDirect3DTexture9 interface
// CObjectTexture *m_pTexture; // DELETED by Vigame, 2007-7-8
};
// This list is used to save the object can't move, like mountain,
// reef, walls and so on. if we want save the cartoon, we should
// not use this structure.
/*
typedef struct _STILL_LIFE_LIST_TYPE
{
CGameObject objStill; // The object data
int nIndex; // The index of the object
_STILL_LIFE_LIST_TYPE *pNext;
} STILL_LIFE_LIST_TYPE;
*/
#endif // !defined(AFX_OBJECT_H__9ADB7DE7_6608_4678_8875_A37737257C2E__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -