Base class object
//===============================================================================================//// File :xObject.h//// Date Created : 6/30/2005// Date Modified : 7/13/2005////===============================================================================================//// The base class for all objects////===============================================================================================#ifndef _XOBJECT_H_#define _XOBJECT_H_#include "Impulse.h"namespace Impulse{ namespace Base { class xObject { /* PRIVATE MEMBER VARIABLES */ private: int m_iUniqueID; std::string m_strName; /* PROTECTED MEMBER VARIABLES */ protected: bool m_bDisposed; /* PUBLIC METHODS */ public: /* CONSTRUCTORS */ xObject(void); xObject(std::string name); /* DESTRUCTOR */ ~xObject(void); //Calls the public dispose method void Dispose(void); //Gets the unique ID of the object int UniqueID(void); //Gets the name of the object std::string Name(void); /* PROTECTED METHODS */ protected: //Inheritable method, release any allocated memory virtual void Dispose(bool disposing); }; //End class xObject } //End namespace Base} //End namespace Impulse#endif
Scene Node class in same namespace, I can use the methods here
//===============================================================================================//// File : xSceneNode.h//// Date Created : 7/01/2005// Date Modified : 7/13/2005////===============================================================================================//// This is the base class for all things that are renderable to the screen.////===============================================================================================#ifndef _XSCENENODE_H_#define _XSCENENODE_H_#include "Impulse.h"namespace Impulse{ namespace Base { //class xSceneNode inherits from xObject class xSceneNode : public Impulse::Base::xObject { /* PRIVATE MEMBER VARIABLES */ private: IDirect3DDevice9 *m_pD3DDevice; D3DXVECTOR3 m_v3Translation, m_v3Rotation, m_v3Origin, m_v3Scale; D3DXMATRIX m_matWorld, m_matTranslation, m_matRotation, m_matScale; bool bIsVisible; /* PUBLIC METHODS */ public: /* CONSTRUCTORS */ xSceneNode(IDirect3DDevice9 *pD3DDevice); xSceneNode(IDirect3DDevice9 *pD3DDevice, std::string name); //Gets the nodes render device IDirect3DDevice9 *GetDevice(); // setdevice method void SetDevice(IDirect3DDevice9 *pD3DDevice); //This updates the world matrix void Update(void); //Returns each of the matrices, WORLD, TRANSLATION, ROTATION, SCALE D3DXMATRIX GetWorldMatrix(void); D3DXMATRIX GetTranslationMatrix(void); D3DXMATRIX GetRotationMatrix(void); D3DXMATRIX GetScaleMatrix(void); //Returns each of the vectors, TRANSLATION, ROTATION, SCALE D3DXVECTOR3 GetTranslationVector3(void); D3DXVECTOR3 GetRotationVector3(void); D3DXVECTOR3 GetScaleVector3(void); //Sets the absolute translation of the node void SetAbsoluteTranslation(D3DXVECTOR3 v); void SetAbsoluteTranslation(float x, float y, float z); //Sets the abosulte rotation of the node void SetAbsoluteRotation(D3DXVECTOR3 v); void SetAbsoluteRotation(float x, float y, float z); //Sets the absoulte origin of the node void SetAbsoluteOrigin(D3DXVECTOR3 v); void SetAbsoluteOrigin(float x, float y, float z); //Sets the absolute scale of the node void SetAbsoluteScale(D3DXVECTOR3 v); void SetAbsoluteScale(float x, float y, float z); //Sets the relative translation of the node void SetRelativeTranslation(D3DXVECTOR3 v); void SetRelativeTranslation(float x, float y, float z); //Sets the relative rotation of the node void SetRelativeRotation(D3DXVECTOR3 v); void SetRelativeRotation(float x, float y, float z); //Sets the relative origin of the node void SetRelativeOrigin(D3DXVECTOR3 v); void SetRelativeOrigin(float x, float y, float z); //Sets the relative scale of the node void SetRelativeScale(D3DXVECTOR3 v); void SetRelativeScale(float x, float y, float z); //Inheritable render method virtual bool Render(void); //Turns on the bounding box for rendering void DebugData(bool debug); //Gets the position of the bounding box virtual D3DXVECTOR3 GetPosition(void); //Gets the dimension of the bounding box virtual D3DXVECTOR3 GetDimension(void); /* PROTECTED METHODS */ protected: //Inheritable method, called when a node is updated virtual void OnUpdate(void); //This calculates the points after translation, rotation, scale //The child class of this class passes in all the points in //the OnUpdate inherited method virtual void CalculatePoints(D3DXVECTOR3 *original, D3DXVECTOR3 *points, int length); //Bounding Box Information bool m_bRenderVolume; xCustomVertex::PositionColored m_VerticesColored[4]; D3DXVECTOR3 m_v3Position, m_v3Dimension; D3DXMATRIX m_matBBWorld, m_matBBTranslation, m_matBBScale, m_matBBRotation; IDirect3DVertexBuffer9 *m_pVB; IDirect3DIndexBuffer9 *m_pIB; short m_sIndices[8]; D3DCOLOR m_PointColors[4]; //Sets up the indices for the bounding box virtual void SetupBoundingBoxIndices(void); //Sets up the vertices for the bounding box virtual void SetupBoundingBoxVertices(void); //Sets up the bounding box position and dimension virtual void SetupBoundingBox(D3DXVECTOR3 position, D3DXVECTOR3 dimension); virtual void SetupBoundingBox(float x, float y, float z, float width, float height, float depth); //Renders the bounding box virtual void RenderBoundingBox(void); //Calculates the points of the bounding box virtual void CalculateBoundingBoxFromPoints(D3DXVECTOR3 *points, int length); }; //End class xSceneNode } //End namespace Base} //End namespace Impulse#endif
Input class cannot see methods
//===============================================================================================//// File : xInputDevice.h//// Date Created : 7/14/2005// Date Modified : 7/14/2005////===============================================================================================//// Handles input from the keyboard or mouse////===============================================================================================#ifndef _XINPUTDEVICE_H_#define _XINPUTDEVICE_H_#include "Impulse.h"using namespace Impulse::Base;namespace Impulse{ namespace Input { enum DeviceType { DT_KEYBOARD = 0, DT_MOUSE = 1 }; class xInputDevice : public Impulse::Base::xObject { /* PRIVATE MEMBER VARIABLES */ private: IDirectInput8 *m_pDI; //DirectInput Object IDirectInputDevice8 *m_pDIDevice; //DirectInput Device HWND m_hWnd; //Window Handle unsigned char m_State[256]; //State of keyboard DIMOUSESTATE *m_MouseState; //State of mouse long m_XPos, m_YPos; //Position of mouse bool m_Windowed; //Windowed or not bool m_Clicked; //If mouse was clicked DeviceType m_deviceType; //Device type long m_DeviceSize; //Device Size DIDATAFORMAT *m_DataFormat; //Data format of the Device /* PRIVATE METHODS */ //Create a direct input device bool CreateInputDevice(void); //Initializes the keyboard device type bool InitializeKeyboard(void); //Initializes the mouse device type bool InitializeMouse(void); /* PUBLIC METHODS */ public: /* CONSTRUCTOR */ xInputDevice(HWND hWnd, IDirectInput8 *pDI, bool Windowed = true, DeviceType type = DT_KEYBOARD); //Clears out the device void Clear(void); //Reads the input device bool Read(void); //Gets the key state of a key press bool KeyState(unsigned long Key); //Gets the button state of a mouse press bool GetButtonState(unsigned long Button); //Returns if the mouse has been clicked bool OnClick(void); //Gets the position of the mouse long GetXPos(void); long GetYPos(void); long GetXDelta(void); long GetYDelta(void); /* PROTECTED METHODS */ protected: //Inherits from xObject, releases memory virtual void Dispose(bool disposing); }; } //End Input Namespace} //End Impulse Namespace#endif