Game Dev/Scrap 24

The Function Pointer Tutorial

원문 : http://alones.byus.net/moniwiki/wiki.php/function_pointer?action=show // C // C int (*pt2Function)(float, char, char) = NULL; // C++ int (TMyClass::*pt2Member)(float, char, char) = NULL; int (TMyClass::*pt2ConstMember)(float, char, char) const = NULL; 함수 포인터 배열은 어떻게 사용하는가? 함수 포인터 배열의 동작은 매우 흥미롭다. 인덱스를 이용해서 함수를 선택할 수 있다. 구문은 복잡해 보이고 종종 혼란을 야기하기도 한다. 아래 코드에서 C와 C++에서 함수 포인터 배열을 정의하고 사용하는 두 가지..

Game Dev/Scrap 2008.08.11

Device Lost Handling

원문 : http://www.gpgstudy.com/gpgiki/DxDeviceLostHandling //**** 디바이스 리소스 인터페이스.. // 디바이스 의존적인 리소스들의 추상클래스. struct IDeviceRes { virtual void Invalidate() = 0; virtual bool SetValidate() = 0; }; //**** 텍스쳐 클래스 class CTextureRes : public IDeviceRes { public: virtual void Invalidate() { 텍스쳐 해제; } virtual bool SetValidate() { 텍스쳐 다시 로드; } bool Load(); void Unload(); protected: char m_szFileName[256];..

Game Dev/Scrap 2008.07.23

Synchronized block in C++

출처 : http://ricanet.com/new/view.php?id=blog/050807 ACriticalSection someCriticalSection; synchronized(someCriticalSection) { ... } 1. 생성과 해제를 통한 자원 획득, 해제class AutoLock { public: AutoLock( ACriticalSection& cs ) : cs(cs) { cs.Lock(); cont = true; } ~AutoLock() { cs.Unlock(); } private: ACriticalSection& cs; }; { AutoLock(someCriticalSection); ... } 2. for문을 이용한 매크로 class AutoLock { public: Auto..

Game Dev/Scrap 2008.06.09