Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by registered user icosaeder ( 16 years ago )
/* Camera.h */

class SECamera: public SE3DObject
{
private:
    static SECamera *Self;
    static uint32 RefCount;
    SECamera() { AllowMatrixConvertion = false; };
    virtual ~SECamera() { Self = NULL; };
    void RenderDynamic(float);
public:
    static SECamera *Instance();
    inline static SECamera *GetInstance() { RefCount++; return Self; };
    inline void FreeInstance() { if (--RefCount == 0) delete this; };
    inline int32 GetPriority() { return SE_CAMERA; };
};

/* Camera.cc */

#include "SECamera.h"

//Initialize pointer to the singleton object
SECamera *SECamera::Self = NULL;
//Initialize count of references to the singleton object
uint32 SECamera::RefCount = 0;
//------------------------------------------------------------------------------

/**
 * Get the instanse of the singleton object
 *
 * @return Pointer to the SECamera singleton object
 */
SECamera *SECamera::Instance()
{
    if (Self == NULL)
        Self = new SECamera;
    RefCount++;
    return Self;
}
//------------------------------------------------------------------------------

 

Revise this Paste

Your Name: Code Language: