Пример #1
0
    void draw (int picking)
    {
	if(picking==2)return;
	gle();
        glPushAttrib(GL_ALL_ATTRIB_BITS);
        gle();
	if(!picking)
	{
	    CameraUpdate ();
	    gle();
	    EntityUpdate ();
	    gle();
    	    WorldUpdate ();
	    gle();
    	    TextureUpdate ();
	    gle();
            VisibleUpdate ();
	    gle();
            CarUpdate ();
        }
        gle();
        RenderResize();
        gle();
        RenderUpdate (picking);
        resetviewport();
        gle();
        glPopAttrib();
        gle();
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glMatrixMode(GL_MODELVIEW);
    }
Пример #2
0
void BRIterate () {
  SDL_Event ev;

  // Check for UI events...
  while (SDL_PollEvent (&ev)) {
    if (ev.type == SDL_WINDOWEVENT && ev.window.event == SDL_WINDOWEVENT_EXPOSED)
      sdlRenderUpdate = TRUE;
  }

  // Check for updated video images...
  SDL_LockMutex (picMutex);
  if (picLocalUpdated) {
    UpdateTextureFromMSPicture (&texVideoLocal, &picLocal, "secondary");
    picLocalUpdated = FALSE;
    sdlRenderUpdate = TRUE;
  }
  if (picRemoteUpdated) {
    UpdateTextureFromMSPicture (&texVideoRemote, &picRemote, "main");
    picRemoteUpdated = FALSE;
    sdlRenderUpdate = TRUE;
  }
  SDL_UnlockMutex (picMutex);

  // Render update if necessary...
  if (sdlRenderUpdate) {
    RenderUpdate ();
    sdlRenderUpdate = FALSE;
  }
}
Пример #3
0
void DXApp::Run()
{
	MSG msg = { 0 };

	BOOL bRet = 1;

	float dt = 0;
	PreInit();
	InitGame();
	LateInit();
	while (msg.message != WM_QUIT)
	{
		if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		else
		{
			m_gameTimer->Tick();
			if (!m_appPaused)
			{
				CalculateFrameStats();
				dt += m_gameTimer->DeltaTime();
				if (dt >= 1.f / TICKS_PER_SECOND)
				{
					OnTickUpdate(m_gameTimer->DeltaTime());
					LateTickUpdate(m_gameTimer->DeltaTime());
					dt = 0;
					tick++;
				}
				if (tick == TICKS_PER_SECOND)
				{
					std::wstringstream ss;
					ss << "DirectX title - FPS: ";
					ss << fps;
					BOOL b = SetWindowText(m_mainHandle, LPCWSTR(ss.str().c_str()));
					DWORD d = GetLastError();
					fps = 0;
					tick = 0;
				}
				PrepareWindow();
				RenderUpdate();
				RenderWindow();
				fps++;
			}
			else
			{
				Sleep(100);
			}
		}
	}

}
Пример #4
0
void AppUpdate ()
{

  CameraUpdate ();
  EntityUpdate ();
  WorldUpdate ();
  TextureUpdate ();
  VisibleUpdate ();
  CarUpdate ();
  RenderUpdate ();

}
Пример #5
0
void BRDisplayMessage (const char *msg) {
  const static SDL_Color textColor = { .r = 0xff, .g = 0xff, .b = 0xff };
  SDL_Surface *surf;

  if (texMessage) {
    SDL_DestroyTexture (texMessage);
    texMessage = NULL;
  }
  surf = TTF_RenderUTF8_Blended (sdlFont, msg, textColor);
  texMessage = SDL_CreateTextureFromSurface (sdlRenderer, surf);
  //SDL_RenderPresent (sdlRenderer);
  RenderUpdate ();
}