コード例 #1
0
	bool CEGuiInputProcessor::onSdlEvent(SDL_Event& event) {
		bool consumed = false;
		
		switch(event.type) {
			
			case SDL_KEYUP:
			case SDL_KEYDOWN:
				consumed = processKeyInput(event);
				break;
				
			case SDL_MOUSEBUTTONUP:
			case SDL_MOUSEBUTTONDOWN:
				consumed = processMouseInput(event);
				break;
				
			case SDL_MOUSEMOTION:
				consumed = processMouseMotion(event);
				break;
			
			default:
				;
		}
		
		return consumed;
	}
コード例 #2
0
	bool LibRocketInputProcessor::onSdlEvent(SDL_Event& event) {
		
		bool consumed = false;
		
		updateKeyModState();
		
		switch(event.type) {
			
			case SDL_KEYUP:
			case SDL_KEYDOWN:
				consumed = processKeyInput(event);
				break;
				
			case SDL_TEXTINPUT:
				consumed = processTextInput(event);
				break;

			case SDL_MOUSEWHEEL:
			case SDL_MOUSEBUTTONUP:
			case SDL_MOUSEBUTTONDOWN:
				consumed = processMouseInput(event);
				break;
				
			case SDL_MOUSEMOTION:
				consumed = processMouseMotion(event);
				break;
			
			default:
				break;
		}
		
		return consumed;
	}
コード例 #3
0
ファイル: sdli.cpp プロジェクト: dtzWill/supernes
static void processEvent(const SDL_Event& event)
{
	if (videoEventFilter(event)) return;
	if (keyboardBindingFilter(event)) return;

  int key = 0;
  int x, y, xnew, ynew;
	switch (event.type) 
	{
		case SDL_KEYDOWN:
      key = event.key.keysym.sym;

			if (Config.action[key]) 
				S9xDoAction(Config.action[key]);

      joypads[0] |= getJoyMask(Config.joypad1Mapping, key);
      joypads[1] |= getJoyMask(Config.joypad2Mapping, key);

      checkOther(Config.joypad1Mapping, key );
      checkOther(Config.joypad2Mapping, key );
			break;
		case SDL_KEYUP:
      key = event.key.keysym.sym;
      joypads[0] &= ~getJoyMask(Config.joypad1Mapping, key);
      joypads[1] &= ~getJoyMask(Config.joypad2Mapping, key);
			break;
		case SDL_MOUSEBUTTONUP:
		case SDL_MOUSEBUTTONDOWN:
      x = event.button.x; y = event.button.y;
      // We interpret mouse input differently depending on orientation
      if ( orientation != ORIENTATION_PORTRAIT )
      {
        // XXX: Make this not magical
        y = 320 - event.button.x;
        x = event.button.y;
      }
			processMouse(x, y,
					(event.button.state == SDL_PRESSED));
			break;
		case SDL_MOUSEMOTION:
      xnew = event.motion.x; ynew = event.motion.y;
      x = xnew - event.motion.xrel; y = ynew - event.motion.yrel;

      // We interpret mouse input differently depending on orientation
      if ( orientation != ORIENTATION_PORTRAIT )
      {
        // XXX: Make this not magical
        ynew = 320 - event.motion.x;
        xnew = event.motion.y;
        x = xnew - event.motion.yrel;
        y = ynew + event.motion.xrel;
      }
			processMouseMotion(x, y, xnew, ynew);
			break;
//		case SDL_QUIT:
//			Config.running = false;
//			break;
	}
}