Esempio n. 1
0
int PERDXHandleEvents(void)
{
   PollKeys();

   if (YabauseExec() != 0)
      return -1;

   return 0;
}
Esempio n. 2
0
int main(int argc, char** argv)
{

	int dw = GetScreenWidth();
	int dh = GetScreenHeight();

	vec3 icp = {0.0F, 4.0F, 8.0F};
	vec3 icl = {0.0F, 0.0F, 0.0F};
	vec3 icu = {0.0F, 1.0F, 0.0F};
	g_globalCam.SetCamera(icp, icl, icu);
	g_globalCam.SetPerspective(65.0F, dw / (float)dh, 0.1F, 1000.0F);



	// Query extension base //
	CreateAppWindow("Mooball", dw, dh, 32, false);
	initExtensions();
	InitKeys();

	srand(time(NULL));

	// Query Device capabilities //
	if(!ValidateDevice())
	{
		DestroyAppWindow();
		return 0;
	}
	g_pTexInterface = new CTextureInterface;
	g_pShaderInterface = new CShaderInterface;
	g_lightManager = new CLightManager;
	g_bMSAA = (quickINI::Instance()->getValueAsInt("msaa") > 0) && (g_pTexInterface->GetMaxMSAA() > 0);
	g_bVSYNC = quickINI::Instance()->getValueAsInt("vsync") > 0;

//	g_model.Load( "Media/Models/Pokeball.3ds" );
	CModelObject* pMdl = new COBJModel;
	std::string err = pMdl->LoadModel("sponza.obj", "Media/Models/");

	// Initialize CG Runtime and shaders //
	init_cg();

	// Turn vsync on //
	if( EXT_VSYNC && g_bVSYNC )
	{
        #ifdef WIN32
            wglSwapIntervalEXT(1);
        #else
            glXSwapIntervalSGI(1);
        #endif
	}

	// Create offscreen targets and depth configurations //
	init_render_targets();

	// Added 8/4/10 - Keeps Mooball from hogging
	// the input focus while it's minimized.
//	HWND windowHandle = GetFocus();

	while(running)
	{
		if(QueryQuitMsg())
			running = false;

		else
		{
			if(!g_bDebugMode)
			{
				UpdateScene();
				PollKeys();
				PollMouse();
			}
			RenderScene();
			FlipBuffers();
		}

	}

	// Fall through to destruction //
	DestroyAppWindow();

	delete g_lightManager;
	delete g_pTexInterface;
	delete g_pShaderInterface;

	return 0;
}