📄 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.
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()
void Draw(LPDIRECT3DDEVICE9 &pDevice, int x, int y);
void Draw(LPDIRECT3DTEXTURE9 &pTexture, LPDIRECT3DDEVICE9 &pDevice, int x, int y);
void Draw(LPDIRECT3DTEXTURE9 &pTexture, LPDIRECT3DDEVICE9 &pDevice,
int x, int y, int width, int height, DWORD diffuse);
// 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
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 + -