This code has no error, but it dont display the resource image. Kindly fix it and paste it again. Thankyou.
- Code:
CGapiSurface* g_ipaq;
class CMyApplication : public CGapiApplication
{
public:
CMyApplication(const GDAPPCONFIG& config) : CGapiApplication(config)
{}
virtual HRESULT CreateSysMemSurfaces(CGapiDisplay* pDisplay, HINSTANCE hInstance)
{
return GD_OK;
}
virtual HRESULT CreateVidMemSurfaces(CGapiDisplay* pDisplay, HINSTANCE hInstance)
{
return GD_OK;
}
virtual CreateSurfaces(CGapiDisplay* pDisplay, HINSTANCE hInstance)
{
const COLORREF TRANSPARENTCOLOR = RGB(0, 0, 255);
g_ipaq->CreateSurface(GDSURFACE_SYSTEMMEMORY,hInstance,IDR_PNG2, _T("PNG"));
g_ipaq->SetColorKey(TRANSPARENTCOLOR);
}
virtual HRESULT ProcessNextFrame(CGapiSurface* pBackbuffer, DWORD dwFlags)
{
pBackbuffer->FillRect(NULL, RGB(128, 128, 128), 0, NULL);
pBackbuffer->BltFast(0,0,g_ipaq,NULL,NULL,NULL);
return S_OK;
};
virtual HRESULT KeyDown(DWORD dwKey, GDKEYLIST& keylist)
{
Shutdown();
return S_OK;
};
virtual ~CMyApplication() {};
};
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
LPTSTR pCmdLine, int nCmdShow)
{
GDAPPCONFIG config;
ZeroMemory(&config;, sizeof(GDAPPCONFIG));//zeromemory macro fills a block of memory with zeros, i-e here it is initializing the "config" to zeros
// this macro also works as "::ZeroMemory..."
config.hInstance = hInst;
config.pAppTitle = TEXT("Welcome to GapiDraw!");
config.dwMaxFPS = 20;
config.dwWindowIcon = IDI_APP;
// Create the application
CMyApplication simple(config);
// Start main loop
return simple.Run();
}