Ejemplo n.º 1
0
void NextFrame()
{
	Uint32 Then;
	SDL_BlitSurface(screen, NULL, videobuffer, NULL);
	SDL_Flip(videobuffer);
	FrameDelay(30);
	Then = NOW;
	NOW = SDL_GetTicks();
}
Ejemplo n.º 2
0
void NextFrame()
{
  arUI32 Then;
  SDL_BlitSurface(screen,NULL,videobuffer,NULL);
  SDL_Flip(videobuffer);
  FrameDelay(30);
  Then = NOW;
  NOW = SDL_GetTicks();
  /* fprintf(stdout,"Ticks passed this frame: %i\n", NOW - Then);*/
}
Ejemplo n.º 3
0
void NextFrame()
{
  Uint32 Then;

  SDL_GL_SwapBuffers(); 

  FrameDelay(15);
  Then = NOW;
  NOW = SDL_GetTicks();
  /* fprintf(stdout,"Ticks passed this frame: %i\n", NOW - Then);*/
}
Ejemplo n.º 4
0
XnStatus XnDeviceFileReader::WaitForStream(XN_EVENT_HANDLE /*hNewDataEvent*/, XnDeviceStream* pStream)
{
	XnStatus nRetVal = XN_STATUS_OK;

	// play forward until we have new data in this stream
	while (!pStream->IsNewDataAvailable())
	{
		XnBool bWrap;
		nRetVal = ReadTillNextData(&bWrap);
		XN_IS_STATUS_OK(nRetVal);
	}

	FrameDelay(pStream->GetLastTimestamp());

	return (XN_STATUS_OK);
}
Ejemplo n.º 5
0
XnStatus XnDeviceFileReader::WaitForPrimaryStream(XN_EVENT_HANDLE /*hNewDataEvent*/, XnStreamDataSet* pSet)
{
	XnStatus nRetVal = XN_STATUS_OK;

	// read until primary stream advanced
	while (!HasPrimaryStreamAdvanced(pSet))
	{
		XnBool bWrap;
		nRetVal = ReadTillNextData(&bWrap);
		XN_IS_STATUS_OK(nRetVal);
	}

	FrameDelay(GetLastTimestamp());

	return (XN_STATUS_OK);
}
Ejemplo n.º 6
0
int GetString(void (*loop)(void),char *title,char *text,int slength)
{
  int done = 0;
  int position = 0;
  Uint8 *keys;
  SDLMod mod;
  SDL_Event event;
  do
  {
    ResetBuffer();
    loop();
    DrawStringBox(title,text,slength);
    while(SDL_PollEvent(&event))
    {
      keys = SDL_GetKeyState(NULL);    
      mod = SDL_GetModState();
      if(keys[SDLK_RETURN] == 1)return 1;
      else if(keys[SDLK_ESCAPE] == 1)return 0;
      else
      {
       if(event.type == SDL_KEYDOWN)
       {
         if((event.key.keysym.sym == SDLK_BACKSPACE)&&(position > 0))
         {
           text[--position] = '\0';
           if(position == 0)
           {
             text[0] = ' ';
             text[1] = '\0';
           }
         }
       }
       if(position < slength - 1)
       {
        switch(event.type)
        {
          case SDL_KEYDOWN:/*lets check against ANY possible character*/
            if(((event.key.keysym.sym >= SDLK_0)&&(event.key.keysym.sym <= SDLK_9)))
            {
              text[position++] = (event.key.keysym.sym - SDLK_0) + '0';
              text[position] = '\0';
            }
            else if((event.key.keysym.sym >= SDLK_a)&&(event.key.keysym.sym <= SDLK_z))
            {
              if(mod & KMOD_SHIFT)text[position++] = (event.key.keysym.sym - SDLK_a) + 'A';
                else text[position++] = (event.key.keysym.sym - SDLK_a) + 'a';
                text[position] = '\0';
            }
            else switch(event.key.keysym.sym)
            {
              case SDLK_SPACE:
                text[position++] = ' ';
                text[position] = '\0';
                    break;
              case SDLK_PERIOD:
                text[position++] = '.';
                text[position] = '\0';
                    break;
              case SDLK_UNDERSCORE:
                text[position++] = '_';
                text[position] = '\0';
                    break;
              case SDLK_MINUS:
                text[position++] = '-';
                text[position] = '\0';
                    break;
              case SDLK_SLASH:
                text[position++] = '/';
                text[position] = '\0';
                    break;
              default:
                break;
            }
            break;
        }
       }
      }
    }
    NextFrame();
    FrameDelay(63);
  }while(!done);

}
Ejemplo n.º 7
0
void NextFrame()
{
    SDL_RenderPresent(renderer);
    FrameDelay();
}