Example #1
0
/*=============================================================================
 * Mouse handlers
 */
static void inputMouse(int button, int state)
{
 int b = 0;
 int e = 0;

 switch(button) {
    case SDL_BUTTON_LEFT:	b = MOUSE_L;	break;
    case SDL_BUTTON_MIDDLE:	b = MOUSE_M;	break;
    case SDL_BUTTON_RIGHT:	b = MOUSE_R;	break;

    case SDL_BUTTON_WHEELUP:	e = INPUT_MUP;	break;
    case SDL_BUTTON_WHEELDOWN:	e = INPUT_MDN;	break;
    default: break;
 }

 if(e)
    if(state == SDL_RELEASED) e = 0;

 if(b)
    if(state == SDL_RELEASED) inputMouseB &= ~b;
    else
    {
	inputMouseB |= b;
	inputMouseR |= b;
    }

 SDL_GetMouseState(&inputMouseX, &inputMouseY);
 inputMenu(0, e);
 inputMouseR = 0;	// remove pending requests
}
Example #2
0
 void moveRgMenu()
  {
		if(activeItem->Select == SYSTEM) 
		 {
       workState = START_WORK;
			 return;
		 }
		
	  if((void*)activeItem->Child == (void*)&NULL_ENTRY) return;
	   else activeItem = (void*)activeItem->Child;
		
		if(activeItem->Select == SIMPLE) 
		  {
				lcdRepaintMenu();
				lcdMovePoint(activeItem->Index);
			}
		 else if(activeItem->Select == INPUT) 
		 {
			 LCD_Clear();
			 inputMenu(ENTER);
		 }
		 
		 else if(activeItem->Select == ACTION) 
		 {
			 LCD_Clear();
			 actionMenu(ENTER);
		 }
		 

 	}
Example #3
0
 void moveDnMenu()
  {
		//get page number

	  if(activeItem->Select == INPUT)
		 {
			inputMenu(DEC);
		 }
		 
		 else if(activeItem->Select == ACTION)
		  {
			  actionMenu(DEC);
			}
			
		else //(activeItem->Select == SIMPLE)
		 {
		  volatile int stPage = (activeItem->Index / FIELDS_NUMBER);
		
 		  if((void*)activeItem->Next == (void*)&NULL_ENTRY) return;
	      else activeItem = (void*)activeItem->Next;
			
       //if we change a page we need to repaint display
		   if(stPage != (activeItem->Index / FIELDS_NUMBER)) {stPage = (activeItem->Index / FIELDS_NUMBER); lcdRepaintMenu();}
		   lcdMovePoint(activeItem->Index - (FIELDS_NUMBER*stPage));
	   }

  }
Example #4
0
/*=============================================================================
 * Keyboard handlers
 */
static void inputKey(int sym, int unicode)
{
 int c = 0;
 int e = 0;

 switch(sym) {
    case SDLK_F1: e = INPUT_F1; break;
    case SDLK_F2: e = INPUT_F2; break;
    case SDLK_F3: e = INPUT_F3; break;
    case SDLK_F4: e = INPUT_F4; break;
    case SDLK_F5: e = INPUT_F5; break;
    case SDLK_F6: e = INPUT_F6; break;
    case SDLK_F7: e = INPUT_F7; break;

    case SDLK_F8:
	if(consoleIsActive()) consoleClose();
	else consoleOpen();
	return;

    case SDLK_F10: cmd("shot"); return;

    case SDLK_UP:	case SDLK_KP8: e = INPUT_KUP; break;
    case SDLK_DOWN:	case SDLK_KP2: e = INPUT_KDN; break;
    case SDLK_LEFT:	case SDLK_KP4: e = INPUT_KLF; break;
    case SDLK_RIGHT:	case SDLK_KP6: e = INPUT_KRI; break;

    case SDLK_HOME:	e = INPUT_KHOME; break;
    case SDLK_END:	e = INPUT_KEND; break;

    case SDLK_KP_MINUS: c = '-'; break;
    case SDLK_KP_PLUS: c = '+'; break;

    default:
	if(unicode)
	    if(unicode & 0xff80) break;		//cannot be translated to ascii
	    else c = (int) unicode & 0xff;
	else
	    if(sym >= '\b' && sym <= '~') c = sym;
	break;
 }

 inputMenu(c, e);
}