I have the following init code and shutdown code for my project and if I shutdown I cannot re-init right after, If I exit my program and go back in, it works:
Anybody know why?
Regards,
Kornalius
- Code:
bool gapi_Init (HWND hWnd, LPVOID DrawFrame, int orientation, bool fullscreen)
{
if (fullscreen)
{
app *a = NULL;
windows *w = SearchWindow(hWnd, a);
SHSipPreference(hWnd, SIP_FORCEDOWN);
if (w->m != NULL)
ShowWindow(w->m, SW_HIDE);
dwWidth = 240;
dwHeight = 320;
if (orientation == Frog::ORIENTATION_WEST || orientation == Frog::ORIENTATION_EAST)
{
dwWidth = 320;
dwHeight = 240;
}
SetForegroundWindow(hWnd);
MoveWindow(hWnd, 0, 0, dwWidth, dwHeight, false);
SHFullScreen(hWnd, SHFS_HIDETASKBAR);
SHFullScreen(hWnd, SHFS_HIDESIPBUTTON);
SHFullScreen(hWnd, SHFS_HIDESTARTICON);
}
// Init Display
m_display.reset(Frog::PocketPC::CreateDisplay(hWnd, (Frog::Orientation)orientation, 0));
if (!m_display.get())
return false;
m_display->SetDithering(Frog::DisplayDevice::DITHER_FAST );
if (m_rast == NULL)
m_rast = m_display->CreateRasterizer(m_display->GetBackBuffer());
// Init input
m_input.reset(Frog::PocketPC::CreateInput(hWnd, (Frog::Orientation)orientation));
if (!m_input.get())
return false;
gapi_wnd = hWnd;
_DrawFrame = DrawFrame;
FPSLastTime = Frog::PocketPC::GetTickCount();
FPSCounter = 0;
SetTimer(hWnd, GAPI_TIMER, 0, NULL);
return true;
}
void gapi_Shut (HWND hWnd)
{
ClearS();
m_input.reset();
m_display.reset();
gapi_wnd = 0;
_DrawFrame = NULL;
KillTimer(hWnd, GAPI_TIMER);
SHFullScreen(hWnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON);
app *a = NULL;
windows *w = SearchWindow(hWnd, a);
if (w->m != NULL)
ShowWindow(w->m, SW_SHOW);
}
Anybody know why?
Regards,
Kornalius