Пример #1
0
/* ******************************************************************** *
 * private: go in a menu item and start function
 * @param
 * @return
 * ******************************************************************** */
void	LCDMenuLib::goEnter()
/* ******************************************************************** */
{
	LCDMenu *tmp;	// declare opjects
	uint8_t name		= function;
	uint8_t j			= 0;
	
	if (function == _LCDML_NO_FUNC) { //check button lock		
		//check if element has childs
		if ((tmp = curMenu->getChild(curloc + curloc_correction())) != NULL) { // check child			
			goMenu(*tmp);					
			name = tmp->name;		

			//check if element has childs			
			if ((tmp = tmp->getChild(0)) != NULL) {			
				
				while ((tmp = tmp->getSibling(1)) != NULL)
				{
					if (bitRead(group_en, tmp->disp) || bitRead(control, _LCDML_control_disable_hidden)) {
						j++;
					}					
				}
			}

			if (j == 0) {				
				function = name;
				countChilds();
			}			
		}		
	}
}
Пример #2
0
void LCDMenu2::goBack()
{
    if(layer > 0) {
        back = 1;
        goMenu(*curMenu->getParent());
    }

}
Пример #3
0
void main(){
    setlocale(LC_ALL, "Russian");
    do {
        showStatusBar();
        showMenu();
        goMenu();
    } while(1);
}
Пример #4
0
/* ******************************************************************** *
 * public: go to the first element in this menu with id = 0
 * @param
 * @return
 * ******************************************************************** */
void	LCDMenuLib::goBack()
/* ******************************************************************** */
{	
	if(layer > 0) {	 //check layer
		//go back
		bitWrite(control, _LCDML_control_menu_back, 1);
		goMenu(*curMenu->getParent());
	}		
}
Пример #5
0
void LCDMenu2::goEnter()
{
    Menu *tmp;
    tmp=curMenu;
    if ((tmp=tmp->getChild(curloc))) {//The child exists
        if (tmp->canEnter) {//canEnter function is set
            if (tmp->canEnter(*tmp)) {//It wants us to enter
                goMenu(*tmp);
            }
        }
        else {//canEnter function not set, assume entry allowed
            goMenu(*tmp);
            curfuncname = tmp->name;
        }
    }
    else {//Child did not exist  The only time this should happen is one the back Menu item, so go back
        goBack();
    }
}
Пример #6
0
void KOViewManager::showListView()
{
    if ( !mListView ) {
        mListView = new KOListView( mMainView->calendar(), mMainView->viewStack() );
        mListView->setObjectName( "KOViewManager::ListView" );
        addView( mListView );
    }
    goMenu( true );
    showView( mListView );
}
Пример #7
0
void KOViewManager::showWhatsNextView()
{
    if ( !mWhatsNextView ) {
        mWhatsNextView = new KOWhatsNextView( mMainView->calendar(), mMainView->viewStack() );
        mWhatsNextView->setObjectName( "KOViewManager::WhatsNextView" );
        addView( mWhatsNextView );
    }
    goMenu( true );
    showView( mWhatsNextView );
}
Пример #8
0
void KOViewManager::showMonthView()
{
    if ( !mMonthView ) {
        mMonthView = new KOrg::MonthView( mMainView->calendar(), mMainView->viewStack() );
        mMonthView->setObjectName( "KOViewManager::MonthView" );
        addView( mMonthView );
    }
    goMenu( true );
    showView( mMonthView );
}
Пример #9
0
void KOViewManager::showTimeSpentView()
{
    if ( !mTimeSpentView ) {
        mTimeSpentView = new KOTimeSpentView( mMainView->calendar(), mMainView->viewStack() );
        mTimeSpentView->setObjectName( "KOViewManager::TimeSpentView" );
        addView( mTimeSpentView );
    }
    goMenu( true );
    showView( mTimeSpentView );
}
Пример #10
0
//pnd_nubstate_t t;
void gui_handle_events (void)
{
	printf("gui_handle_events\n");
/*if(blubb<0)
{
	test = pnd_evdev_open(pnd_evdev_nub1);
	printf("nub1 open: %d\n", test);
	test = pnd_evdev_open(pnd_evdev_nub2);
	printf("nub2 open: %d\n", test);
	t.x=1;
	t.y=1;
	printf("nubstate 1: x=%d y=%d\n", t.x, t.y);
}
blubb++;
if(blubb>100 && blubb<0)
{
	pnd_evdev_catchup(1);
	blubb=0;
}
test = pnd_evdev_nub_state(pnd_evdev_nub1, &t);
printf("nubstate 1: x=%d y=%d, returnvalue=%d\n", t.x, t.y, test);
pnd_evdev_nub_state(pnd_evdev_nub2, &t);
printf("nubstate 2: x=%d y=%d\n", t.x, t.y);
*/

#if ! defined (DREAMCAST) && ! defined (GP2X) && ! defined (PSP) && ! defined (GIZMONDO)
	Uint8 *keystate = SDL_GetKeyState(NULL);
	if ( keystate[SDLK_F12] )
		SDL_WM_ToggleFullScreen(prSDLScreen);
	else
	if ( keystate[SDLK_F11] )
#else
#ifdef DREAMCAST
	if (SDL_JoystickGetButton(uae4all_joy0,3) )
#endif
#ifdef GP2X
    if (SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_SELECT))
#endif
#ifdef PSP
	if (SDL_JoystickGetButton(uae4all_joy0, PSP_BUTTON_SELECT))
#endif
#ifdef GIZMONDO
	Uint8 *keystate = SDL_GetKeyState(NULL);
	if ( keystate[SDLK_F1] )
#endif
#endif
#ifdef GP2X
	{
		// hack: always use SDL_SWSURFACE in menus
		//switch_to_sw_sdl();
		goMenu();
		//switch_to_hw_sdl(0);
	}
#else
		goMenu();
#endif

#ifndef PANDORA
#if defined (DREAMCAST) || defined (GP2X) || defined (PSP) || defined (GIZMONDO)
#ifdef DREAMCAST
	if (SDL_JoystickGetAxis (uae4all_joy0, 2))
		if (vkbd_mode)
		{
			vkbd_mode=0;
   			notice_screen_contents_lost();
		}
	if (SDL_JoystickGetAxis (uae4all_joy0, 3))
		vkbd_mode=1;
#else

	if (!gp2xMouseEmuOn && !gp2xButtonRemappingOn)
	{
#ifdef GP2X
		if (SDL_JoystickGetButton (uae4all_joy0, GP2X_BUTTON_L))
#else
#ifdef GIZMONDO
		if (SDL_JoystickGetButton (uae4all_joy0, GIZ_LTRIG))
#else
		if (SDL_JoystickGetButton (uae4all_joy0, PSP_BUTTON_L))
#endif
#endif
		{
			/*if (vkbd_mode)
			{
				vkbd_mode = 0;
				goingVkbd=0;
				notice_screen_contents_lost();
			}
			else*/
				goingSuperThrottle=1;
		}
		else
		{
			if (!nowSuperThrottle)
				goingSuperThrottle=0;
			/*else
				goingVkbd=0;*/
		}

#ifdef GP2X
		if (SDL_JoystickGetButton (uae4all_joy0, GP2X_BUTTON_R))
#else
#ifdef GIZMONDO
		if (SDL_JoystickGetButton (uae4all_joy0, GIZ_RTRIG))
#else
		if (SDL_JoystickGetButton (uae4all_joy0, PSP_BUTTON_R))
#endif
#endif
		{
			if (goingSuperThrottle)
				goSuperThrottle();
			/*else
			{
				if (goingVkbd>4)
					vkbd_mode=1;
				else
					goingVkbd++;
			}*/
		}
		else
		{
			if (nowSuperThrottle)
				leftSuperThrottle();
			/*else
				goingVkbd=0;*/
		}
	}

#endif
#endif

	/*if (vkbd_key)
	{
		if (vkbd_keysave==-1234567)
		{
			SDL_keysym ks;
			ks.sym=vkbd_key;
			vkbd_keysave=keycode2amiga(&ks);
			if (vkbd_keysave >= 0)
			{
				if (!uae4all_keystate[vkbd_keysave])
				{
					uae4all_keystate[vkbd_keysave]=1;
					record_key(vkbd_keysave<<1);
				}
			}
		}
	}
	else
		if (vkbd_keysave!=-1234567)
		{
			if (vkbd_keysave >= 0)
			{
				uae4all_keystate[vkbd_keysave]=0;
				record_key((vkbd_keysave << 1) | 1);
			}
			vkbd_keysave=-1234567;
		}*/
#endif

#ifdef PANDORA
	Uint8 *keystate = SDL_GetKeyState(NULL);
	if(keystate[SDLK_F12])
	{
		if(hwScaled)
			SDL_WM_ToggleFullScreen(prSDLScreen);
		else
			SDL_WM_ToggleFullScreen(prSDLScaleScreen);
	}

if(!vkbd_mode)
{
	//L + R
	if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_R))
	{
		//up
		if(SDL_JoystickGetAxis(uae4all_joy0, 1) < 0)
		{
			moveVertical(1);
			moved_y += 2;
		}
		//down
		else if(SDL_JoystickGetAxis(uae4all_joy0, 1) > 0)
		{
			moveVertical(-1);
			moved_y -= 2;
		}
		//left
		else if(SDL_JoystickGetAxis(uae4all_joy0, 0) < 0)
		{
			screenWidth -=10;
			if(screenWidth<200)
				screenWidth = 200;
			update_display();
		}
		//right
		else if(SDL_JoystickGetAxis(uae4all_joy0, 0) > 0)
		{
			screenWidth +=10;
			if(screenWidth>800)
				screenWidth = 800;
			update_display();
		}
		//1
		else if(keystate[SDLK_1])
		{
			mainMenu_displayedLines = 200;
			screenWidth = 768;
			presetModeId = 0;
			strcpy(presetMode, "320x200 upscaled");
			update_display();
		}
		//2
		else if(keystate[SDLK_2])
		{
			mainMenu_displayedLines = 216;
			screenWidth = 716;
			presetModeId = 1;
			strcpy(presetMode, "320x216 upscaled");
			update_display();
		}
		//3
		else if(keystate[SDLK_3])
		{
			mainMenu_displayedLines = 240;
			screenWidth = 640;
			presetModeId = 2;
			strcpy(presetMode, "320x240 upscaled");
			update_display();
		}
		//4
		else if(keystate[SDLK_4])
		{
			mainMenu_displayedLines = 256;
			screenWidth = 600;
			presetModeId = 3;
			strcpy(presetMode, "320x256 upscaled");
			update_display();
		}
		//5
		else if(keystate[SDLK_5])
		{
			mainMenu_displayedLines = 262;
			screenWidth = 588;
			presetModeId = 4;
			strcpy(presetMode, "320x262 upscaled");
			update_display();
		}
		//6
		else if(keystate[SDLK_6])
		{
			mainMenu_displayedLines = 270;
			screenWidth = 570;
			presetModeId = 5;
			strcpy(presetMode, "320x270 upscaled");
			update_display();
		}
		//7
		else if(keystate[SDLK_7])
		{
			mainMenu_displayedLines = 200;
			screenWidth = 640;
			presetModeId = 6;
			strcpy(presetMode, "320x200 NTSC");
			update_display();
		}
		//8
		else if(keystate[SDLK_8])
		{
			mainMenu_displayedLines = 200;
			screenWidth = 800;
			presetModeId = 7;
			strcpy(presetMode, "320x200 fullscreen");
			update_display();
		}
	}

	//autofire on/off
	if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_R))
	{
		//(Y) button
		if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_Y))
		{
			if(!justPressedY)
			{
				//autofire on/off
				switch_autofire = !switch_autofire;
				justPressedY=1;
			}
		}
		else if(justPressedY)
			justPressedY=0;
	}

	if (mainMenu_customControls && !gp2xMouseEmuOn && !gp2xButtonRemappingOn)
	{
		if(mainMenu_custom_dpad == 0)
		{
			//UP
			if(SDL_JoystickGetAxis(uae4all_joy0, 1) < 0)
			{
				if(!justMovedUp)
				{
					if(mainMenu_custom_up == -1) buttonstate[0]=1;
					else if(mainMenu_custom_up == -2) buttonstate[2]=1;
					else if(mainMenu_custom_up > 0)
					{
						getMapping(mainMenu_custom_up);
						uae4all_keystate[customKey] = 1;
						record_key(customKey << 1);
					}
					justMovedUp=1;
				}
			}
			else if(justMovedUp)
			{
				if(mainMenu_custom_up == -1) buttonstate[0]=0;
				else if(mainMenu_custom_up == -2) buttonstate[2]=0;
				else if(mainMenu_custom_up > 0)
				{
					getMapping(mainMenu_custom_up);
					uae4all_keystate[customKey] = 0;
					record_key((customKey << 1) | 1);
				}
				justMovedUp=0;
			}

			//DOWN
			if(SDL_JoystickGetAxis(uae4all_joy0, 1) > 0)
			{
				if(!justMovedDown)
				{
					if(mainMenu_custom_down == -1) buttonstate[0]=1;
					else if(mainMenu_custom_down == -2) buttonstate[2]=1;
					else if(mainMenu_custom_down > 0)
					{
						getMapping(mainMenu_custom_down);
						uae4all_keystate[customKey] = 1;
						record_key(customKey << 1);
					}
					justMovedDown=1;
				}
			}
			else if(justMovedDown)
			{
				if(mainMenu_custom_down == -1) buttonstate[0]=0;
				else if(mainMenu_custom_down == -2) buttonstate[2]=0;
				else if(mainMenu_custom_down > 0)
				{
					getMapping(mainMenu_custom_down);
					uae4all_keystate[customKey] = 0;
					record_key((customKey << 1) | 1);
				}
				justMovedDown=0;
			}

			//LEFT
			if(SDL_JoystickGetAxis(uae4all_joy0, 0) < 0)
			{
				if(!justMovedLeft)
				{
					if(mainMenu_custom_left == -1) buttonstate[0]=1;
					else if(mainMenu_custom_left == -2) buttonstate[2]=1;
					else if(mainMenu_custom_left > 0)
					{
						getMapping(mainMenu_custom_left);
						uae4all_keystate[customKey] = 1;
						record_key(customKey << 1);
					}
					justMovedLeft=1;
				}
			}
			else if(justMovedLeft)
			{
				if(mainMenu_custom_left == -1) buttonstate[0]=0;
				else if(mainMenu_custom_left == -2) buttonstate[2]=0;
				else if(mainMenu_custom_left > 0)
				{
					getMapping(mainMenu_custom_left);
					uae4all_keystate[customKey] = 0;
					record_key((customKey << 1) | 1);
				}
				justMovedLeft=0;
			}

 			//RIGHT
			if(SDL_JoystickGetAxis(uae4all_joy0, 0) > 0)
			{
				if(!justMovedRight)
				{
					if(mainMenu_custom_right == -1) buttonstate[0]=1;
					else if(mainMenu_custom_right == -2) buttonstate[2]=1;
					else if(mainMenu_custom_right > 0)
					{
						getMapping(mainMenu_custom_right);
						uae4all_keystate[customKey] = 1;
						record_key(customKey << 1);
					}
					justMovedRight=1;
				}
			}
			else if(justMovedRight)
			{
				if(mainMenu_custom_right == -1) buttonstate[0]=0;
				else if(mainMenu_custom_right == -2) buttonstate[2]=0;
				else if(mainMenu_custom_right > 0)
				{
					getMapping(mainMenu_custom_right);
					uae4all_keystate[customKey] = 0;
					record_key((customKey << 1) | 1);
				}
				justMovedRight=0;
			}
		}

		//(A)
		if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_B))
		{
			if(!justPressedA)
			{
				if(mainMenu_custom_A == -1) buttonstate[0]=1;
				else if(mainMenu_custom_A == -2) buttonstate[2]=1;
				else if(mainMenu_custom_A > 0)
				{
					getMapping(mainMenu_custom_A);
					uae4all_keystate[customKey] = 1;
					record_key(customKey << 1);
				}
				justPressedA=1;
			}
		}
		else if(justPressedA)
		{
			if(mainMenu_custom_A == -1) buttonstate[0]=0;
			else if(mainMenu_custom_A == -2) buttonstate[2]=0;
			else if(mainMenu_custom_A > 0)
			{
				getMapping(mainMenu_custom_A);
				uae4all_keystate[customKey] = 0;
				record_key((customKey << 1) | 1);
			}
			justPressedA=0;
		}

		//(B)
		if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_A))
		{
			if(!justPressedB)
			{
				if(mainMenu_custom_B == -1) buttonstate[0]=1;
				else if(mainMenu_custom_B == -2) buttonstate[2]=1;
				else if(mainMenu_custom_B > 0)
				{
					getMapping(mainMenu_custom_B);
					uae4all_keystate[customKey] = 1;
					record_key(customKey << 1);
				}
				justPressedB=1;
			}
		}
		else if(justPressedB)
		{
			if(mainMenu_custom_B == -1) buttonstate[0]=0;
			else if(mainMenu_custom_B == -2) buttonstate[2]=0;
			else if(mainMenu_custom_B > 0)
			{
				getMapping(mainMenu_custom_B);
				uae4all_keystate[customKey] = 0;
				record_key((customKey << 1) | 1);
			}
			justPressedB=0;
		}

		//(X)
		if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_X))
		{
			if(!justPressedX)
			{
				if(mainMenu_custom_X == -1) buttonstate[0]=1;
				else if(mainMenu_custom_X == -2) buttonstate[2]=1;
				else if(mainMenu_custom_X > 0)
				{
					getMapping(mainMenu_custom_X);
					uae4all_keystate[customKey] = 1;
					record_key(customKey << 1);
				}
				justPressedX=1;
			}
		}
		else if(justPressedX)
		{
			if(mainMenu_custom_X == -1) buttonstate[0]=0;
			else if(mainMenu_custom_X == -2) buttonstate[2]=0;
			else if(mainMenu_custom_X > 0)
			{
				getMapping(mainMenu_custom_X);
				uae4all_keystate[customKey] = 0;
				record_key((customKey << 1) | 1);
			}
			justPressedX=0;
		}

		//(Y)
		if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_Y))
		{
			if(!justPressedY)
			{
				if(mainMenu_custom_Y == -1) buttonstate[0]=1;
				else if(mainMenu_custom_Y == -2) buttonstate[2]=1;
				else if(mainMenu_custom_Y > 0)
				{
					getMapping(mainMenu_custom_Y);
					uae4all_keystate[customKey] = 1;
					record_key(customKey << 1);
				}
				justPressedY=1;
			}
		}
		else if(justPressedY)
		{
			if(mainMenu_custom_Y == -1) buttonstate[0]=0;
			else if(mainMenu_custom_Y == -2) buttonstate[2]=0;
			else if(mainMenu_custom_Y > 0)
			{
				getMapping(mainMenu_custom_Y);
				uae4all_keystate[customKey] = 0;
				record_key((customKey << 1) | 1);
			}
			justPressedY=0;
		}

		//(L)
		if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L))
		{
			if(!justPressedL)
			{
				if(mainMenu_custom_L == -1) buttonstate[0]=1;
				else if(mainMenu_custom_L == -2) buttonstate[2]=1;
				else if(mainMenu_custom_L > 0)
				{
					getMapping(mainMenu_custom_L);
					uae4all_keystate[customKey] = 1;
					record_key(customKey << 1);
				}
				justPressedL=1;
			}
		}
		else if(justPressedL)
		{
			if(mainMenu_custom_L == -1) buttonstate[0]=0;
			else if(mainMenu_custom_L == -2) buttonstate[2]=0;
			else if(mainMenu_custom_L > 0)
			{
				getMapping(mainMenu_custom_L);
				uae4all_keystate[customKey] = 0;
				record_key((customKey << 1) | 1);
			}
			justPressedL=0;
		}

		//(R)
		if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_R))
		{
			if(!justPressedR)
			{
				if(mainMenu_custom_R == -1) buttonstate[0]=1;
				else if(mainMenu_custom_R == -2) buttonstate[2]=1;
				else if(mainMenu_custom_R > 0)
				{
					getMapping(mainMenu_custom_R);
					uae4all_keystate[customKey] = 1;
					record_key(customKey << 1);
				}
				justPressedR=1;
			}
		}
		else if(justPressedR)
		{
			if(mainMenu_custom_R == -1) buttonstate[0]=0;
			else if(mainMenu_custom_R == -2) buttonstate[2]=0;
			else if(mainMenu_custom_R > 0)
			{
				getMapping(mainMenu_custom_R);
				uae4all_keystate[customKey] = 0;
				record_key((customKey << 1) | 1);
			}
			justPressedR=0;
		}
	}
	else if(!gp2xMouseEmuOn)
	{
		//DPad = arrow keys in stylus-mode
		if(gp2xButtonRemappingOn)
		{
			//dpad up
			if (SDL_JoystickGetAxis(uae4all_joy0, 1) < 0)
			{
				if(!justMovedUp)
				{
					//left and right mouse-buttons down
					buttonstate[0] = 1;
					buttonstate[2] = 1;
					stylusClickOverride = 1;
					justMovedUp=1;
				}
			}
			else if(justMovedUp)
			{
				//left and right mouse-buttons up
				buttonstate[0] = 0;
				buttonstate[2] = 0;
				stylusClickOverride = 0;
				justMovedUp=0;
			}
			//dpad down
			if (SDL_JoystickGetAxis(uae4all_joy0, 1) > 0)
			{
				if(!justMovedDown)
				{
					//no clicks with stylus now
					stylusClickOverride=1;
					justMovedDown=1;
				}
			}
			else if(justMovedDown)
			{
				//clicks active again
				stylusClickOverride=0;
				justMovedDown=0;
			}
			//dpad left
			if (SDL_JoystickGetAxis(uae4all_joy0, 0) < 0)
			{
				if(!justMovedLeft)
				{
					//left mouse-button down
					buttonstate[0] = 1;
					stylusClickOverride = 1;
					justMovedLeft=1;
				}
			}
			else if(justMovedLeft)
			{
				//left mouse-button up
				buttonstate[0] = 0;
				stylusClickOverride = 0;
				justMovedLeft=0;
			}
			//dpad right
			if (SDL_JoystickGetAxis(uae4all_joy0, 0) > 0)
			{
				if(!justMovedRight)
				{
					//right mouse-button down
					buttonstate[2] = 1;
					stylusClickOverride = 1;
					justMovedRight=1;
				}
			}
			else if(justMovedRight)
			{
				//right mouse-button up
				buttonstate[2] = 0;
				stylusClickOverride = 0;
				justMovedRight=0;
			}
			//L + up
			if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && SDL_JoystickGetAxis(uae4all_joy0, 1) < 0)
				stylusAdjustY-=2;
			//L + down
			if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && SDL_JoystickGetAxis(uae4all_joy0, 1) > 0)
				stylusAdjustY+=2;
			//L + left
			if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && SDL_JoystickGetAxis(uae4all_joy0, 0) < 0)
				stylusAdjustX-=2;
			//L + right
			if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && SDL_JoystickGetAxis(uae4all_joy0, 0) > 0)
				stylusAdjustX+=2;
		}
		//R-trigger in joystick mode
		else if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_R))
		{
			//(A) button
			if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_A))
			{
				if(!justPressedA)
				{
					//CTRL
					uae4all_keystate[AK_CTRL] = 1;
					record_key(AK_CTRL << 1);
					justPressedA=1;
				}
			}
			else if(justPressedA)
			{
				uae4all_keystate[AK_CTRL] = 0;
				record_key((AK_CTRL << 1) | 1);
				justPressedA=0;
			}
			//(B) button
			if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_B))
			{
				if(!justPressedB)
				{
					//left ALT
					uae4all_keystate[AK_LALT] = 1;
					record_key(AK_LALT << 1);
					justPressedB=1;
				}
			}
			else if(justPressedB)
			{
				uae4all_keystate[AK_LALT] = 0;
				record_key((AK_LALT << 1) | 1);
				justPressedB=0;
			}
			//(X) button
			if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_X))
			{
				if(!justPressedX)
				{
					//HELP
					uae4all_keystate[AK_HELP] = 1;
					record_key(AK_HELP << 1);
					justPressedX=1;
				}
			}
			else if(justPressedX)
			{
				//HELP
				uae4all_keystate[AK_HELP] = 0;
				record_key((AK_HELP << 1) | 1);
				justPressedX=0;
			}
		}
		else if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L))
		{
			//(A) button
			if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_A))
			{
				if(!justPressedA)
				{
					//right mouse-button down
					buttonstate[2] = 1;
					justPressedA=1;
				}
			}
			else if(justPressedA)
			{
				//right mouse-button up
				buttonstate[2] = 0;
				justPressedA=0;
			}
			//(B) button
			if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_B))
			{
				if(!justPressedB)
				{
					//left mouse-button down
					buttonstate[0] = 1;
					justPressedB=1;
				}
			}
			else if(justPressedB)
			{
				//left mouse-button up
				buttonstate[0] = 0;
				justPressedB=0;
			}
		}
		else
		{
			if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_Y))
			{
				if(!justPressedY)
				{
					//SPACE
					uae4all_keystate[AK_SPC] = 1;
					record_key(AK_SPC << 1);
					justPressedY=1;
				}
			}
			else if(justPressedY)
			{
				//SPACE
				uae4all_keystate[AK_SPC] = 0;
				record_key((AK_SPC << 1) | 1);
				justPressedY=0;
			}
		}
	}
	else
	{
		if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_A))
		{
			if(!justPressedA)
			{
				//right mouse-button down
				buttonstate[2] = 1;
				justPressedA=1;
			}
		}
		else if(justPressedA)
		{
			//right mouse-button up
			buttonstate[2] = 0;
			justPressedA=0;
		}
		//(B) button
		if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_B))
		{
			if(!justPressedB)
			{
				//left mouse-button down
				buttonstate[0] = 1;
				justPressedB=1;
			}
		}
		else if(justPressedB)
		{
			//left mouse-button up
			buttonstate[0] = 0;
			justPressedB=0;
		}
		if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_Y))
		{
			if(!justPressedY)
			{
				//SPACE
				uae4all_keystate[AK_SPC] = 1;
				record_key(AK_SPC << 1);
				justPressedY=1;
			}
		}
		else if(justPressedY)
		{
			//SPACE
			uae4all_keystate[AK_SPC] = 0;
			record_key((AK_SPC << 1) | 1);
			justPressedY=0;
		}
		if (SDL_JoystickGetAxis(uae4all_joy0, 0) < 0)
		{
			if(!justMovedLeft)
			{
				//left ALT
				uae4all_keystate[0x64] = 1;
				record_key(0x64 << 1);
				justMovedLeft=1;
			}
		}
		else if(justMovedLeft)
		{
			//left ALT
			uae4all_keystate[0x64] = 0;
			record_key((0x64 << 1) | 1);
			justMovedLeft=0;
		}
		if (SDL_JoystickGetAxis(uae4all_joy0, 0) > 0)
		{
			if(!justMovedRight)
			{
				//left ALT
				uae4all_keystate[0x64] = 1;
				record_key(0x64 << 1);
				justMovedRight=1;
			}
		}
		else if(justMovedRight)
		{
			//left ALT
			uae4all_keystate[0x64] = 0;
			record_key((0x64 << 1) | 1);
			justMovedRight=0;
		}
	}

	if(!mainMenu_customControls && SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_R))
	{
		//R+dpad = arrow keys in joystick mode
		//dpad up
		if (SDL_JoystickGetAxis(uae4all_joy0, 1) < 0)
		{
			if(!justMovedUp)
			{
				//arrow up
				uae4all_keystate[0x4C] = 1;
				record_key(0x4C << 1);
				justMovedUp=1;
			}
		}
		else if(justMovedUp)
		{
			//arrow up
			uae4all_keystate[0x4C] = 0;
			record_key((0x4C << 1) | 1);
			justMovedUp=0;
		}
		//dpad down
		if (SDL_JoystickGetAxis(uae4all_joy0, 1) > 0)
		{
			if(!justMovedDown)
			{
				//arrow down
				uae4all_keystate[0x4D] = 1;
				record_key(0x4D << 1);
				justMovedDown=1;
			}
		}
		else if(justMovedDown)
		{
			//arrow down
			uae4all_keystate[0x4D] = 0;
			record_key((0x4D << 1) | 1);
			justMovedDown=0;
		}
		//dpad left
		if (SDL_JoystickGetAxis(uae4all_joy0, 0) < 0)
		{
			if(!justMovedLeft)
			{
				//arrow left
				uae4all_keystate[0x4F] = 1;
				record_key(0x4F << 1);
				justMovedLeft=1;
			}
		}
		else if(justMovedLeft)
		{
			//arrow left
			uae4all_keystate[0x4F] = 0;
			record_key((0x4F << 1) | 1);
			justMovedLeft=0;
		}
		//dpad right
		if (SDL_JoystickGetAxis(uae4all_joy0, 0) > 0)
		{
			if(!justMovedRight)
			{
				//arrow right
				uae4all_keystate[0x4E] = 1;
				record_key(0x4E << 1);
				justMovedRight=1;
			}
		}
		else if(justMovedRight)
		{
			//arrow right
			uae4all_keystate[0x4E] = 0;
			record_key((0x4E << 1) | 1);
			justMovedRight=0;
		}
	}

	//L+D: show/hide status ln
	if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && keystate[SDLK_d])
	{
		keystate[SDLK_d]=0;
		mainMenu_showStatus = !mainMenu_showStatus;
	}
}

	//L+K: virtual keyboard
	if (SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && keystate[SDLK_k])
	{
		if(!justLK)
		{
			vkbd_mode = !vkbd_mode;
			justLK=1;
		}
	}
	else if(justLK)
		justLK=0;

#ifndef CYCLONE
	if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && keystate[SDLK_s])
	{
		keystate[SDLK_s]=0;
		savestate_state = STATE_DOSAVE;
	}
	if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && keystate[SDLK_l])
	{
		extern char *savestate_filename;
		FILE *f=fopen(savestate_filename, "rb");
		keystate[SDLK_l]=0;
		if(f)
		{
			fclose(f);
			savestate_state = STATE_DORESTORE;
		}
		else
			gui_set_message("Failed: Savestate not found", 100);
	}
#endif
//if(SDL_JoystickGetButton(uae4all_joy0, GP2X_BUTTON_L) && keystate[SDLK_1])
//{
//	resChange = 1;
//	gfxHeight	 = 256;
//	prSDLScreen = SDL_SetVideoMode(320, 256, 16, VIDEO_FLAGS);
//	system("export SDL_OMAP_LAYER_SIZE=800x480");
//}
#endif

	if (vkbd_key)
	{
		if (vkbd_keysave==-1234567)
		{
			SDL_keysym ks;
			ks.sym=vkbd_key;
			vkbd_keysave=keycode2amiga(&ks);
			if (vkbd_keysave >= 0)
			{
				if (!uae4all_keystate[vkbd_keysave])
				{
					uae4all_keystate[vkbd_keysave]=1;
					record_key(vkbd_keysave<<1);
				}
			}
		}
	}
	else
		if (vkbd_keysave!=-1234567)
		{
			if (vkbd_keysave >= 0)
			{
				uae4all_keystate[vkbd_keysave]=0;
				record_key((vkbd_keysave << 1) | 1);
			}
			vkbd_keysave=-1234567;
		}
}
Пример #11
0
void LCDMenu::goBack()
{
goMenu(*curMenu->getParent());
}