Example #1
0
void MainLoop::ProcessInput()
{
    LuaOnInput();

    // update all inputs regardless of there being an observable event or not
    if (mWorld) {
        mWorld->ProcessInput();
    }

    SDL_Event event;
    if (!SDL_PollEvent(&event)) {
        return;
    }

    if((event.type == SDL_QUIT) || ((event.type == SDL_KEYDOWN) && (event.key.keysym.scancode == SDL_SCANCODE_ESCAPE))) {
        RequestQuit(); // The user closed the window.
        return;
    }

    // Handle application-level requests, e.g. switching of renderer.
    if ((event.type == SDL_KEYDOWN) && (event.key.keysym.mod & KMOD_LCTRL))
    {
        SelectRendererFromScanCode(event.key.keysym.scancode);
        return;
    }

    if ((event.type == SDL_KEYDOWN))
    {
        switch (event.key.keysym.scancode)
        {
            case SDL_SCANCODE_COMMA:
                mWorld->GetPlayer().mPlaneY -= 0.05;
                break;
            case SDL_SCANCODE_PERIOD:
                mWorld->GetPlayer().mPlaneY += 0.05;
                break;
            default:
                break;
        }
        return;
    }
}
Example #2
0
/*
* MissingResource:  What to call if we find that client is missing a resource 
*   from a server message.  If user wants to, quit game, automatically redownload
*   new resources, and reenter game.
*/
void MissingResource(void)
{
   /* Always display the box, to alert us something is missing.
	// In release version, we are not doing updates, so don't show dialog.
#ifdef NODPRINTFS
	return;
#else*/
	/* Maximum of one of these dialogs at a time */
	static Bool dialog_up = False;
	
	if (dialog_up)
		return;
	
	dialog_up = True;
	if (!AreYouSure(hInst, hMain, YES_BUTTON, IDS_MISSINGRESOURCE))
		return;
	
	RequestQuit();
	dialog_up = False;
//#endif
}