Ejemplo n.º 1
0
void taskmng_rol(void) {

	SDL_Event	e;

	if (SDL_GetTicks() > count + 30 ) {			//0.03秒たった?
		count = SDL_GetTicks() + 10000000;					//カウントリセット
		tap = 0;									//タップ解除
		mousemng.btn |= uPD8255A_LEFTBIT;			//左クリック解除
//		__android_log_print(ANDROID_LOG_INFO, "SDL", "SDL mouseup");
	}


	if ((!task_avail) || (!SDL_PollEvent(&e))) {
		return;
	}
	switch(e.type) {
		case SDL_MOUSEMOTION:

			if (menuvram == NULL) {

				if(e.motion.state == 1) {	//ボタン押されてる
					tap = FALSE;			//動いたのでtapじゃないよ
					mousemng.x = e.motion.xrel;
					mousemng.y = e.motion.yrel;//移動
				}
				else { 						//最初のいらないモーション
				}
			}
			else {
				menubase_moving(e.motion.x, e.motion.y, 0);
			}
			break;

		case SDL_MOUSEBUTTONUP:
//			switch(e.button.button) {
//				case SDL_BUTTON_LEFT:
//					longtap = SDL_GetTicks();//カウントリセット

					if (menuvram == NULL) {
						if (tap) {	//tapかどうかチェック
							mousemng.btn &= ~(uPD8255A_LEFTBIT);//	左クリックを送るよ
							count = SDL_GetTicks();//カウント開始
//							__android_log_print(ANDROID_LOG_INFO, "SDL", "SDL mousedown");
						}

					}
					else {
						menubase_moving(e.button.x, e.button.y, 2);
					}
					break;

//				case SDL_BUTTON_RIGHT:
//					break;
//			}
//			break;

		case SDL_MOUSEBUTTONDOWN:
//			switch(e.button.button) {
//				case SDL_BUTTON_LEFT:

					if (menuvram == NULL) {
						tap = TRUE;	//tapかも知れないよ
//						longtap = SDL_GetTicks();//カウントリセット
					}
					else {
						menubase_moving(e.button.x, e.button.y, 1);
					}
//					break;

//				case SDL_BUTTON_RIGHT:
//					break;
//			}
			break;

		case SDL_KEYDOWN:
			if (e.key.keysym.scancode == SDL_SCANCODE_MENU) {
				if (menuvram == NULL) {
					sysmenu_menuopen(0, 0, 0);
				}
				else {
					menubase_close();
				}
			}
			else if (e.key.keysym.scancode == SDL_SCANCODE_POWER) {
				pccore_cfgupdate();
				pccore_reset();
			}
			else if (e.key.keysym.scancode == SDL_SCANCODE_SELECT) {
				mousemng.btn &= ~(uPD8255A_LEFTBIT);
			}
			else if (e.key.keysym.scancode == SDL_SCANCODE_AC_BACK) {
				mousemng.btn &= ~(uPD8255A_RIGHTBIT);
			}
			else {
				sdlkbd_keydown(e.key.keysym.scancode);
			}
			break;

		case SDL_KEYUP:
			if (e.key.keysym.scancode == SDL_SCANCODE_SELECT) {
				mousemng.btn |= uPD8255A_LEFTBIT;
			}
			else if (e.key.keysym.scancode == SDL_SCANCODE_AC_BACK) {
				mousemng.btn |= uPD8255A_RIGHTBIT;
			}
			else {
				sdlkbd_keyup(e.key.keysym.scancode);
			}
			break;

		case SDL_QUIT:
			task_avail = FALSE;
			break;
	}
}
Ejemplo n.º 2
0
void taskmng_rol(void) {

	BOOL		moving;
	int			x;
	int			y;
	SDL_Event	e;

	moving = FALSE;
	x = 0;
	y = 0;
	while((task_avail) && (SDL_PollEvent(&e))) {
		switch(e.type) {
			case SDL_MOUSEMOTION:
				moving = TRUE;
				x = e.motion.x;
				y = e.motion.y;
				break;

			case SDL_MOUSEBUTTONUP:
				if (moving) {
					moving = FALSE;
					if (menuvram == NULL) {
					}
					else {
						menubase_moving(x, y, 0);
					}
				}
				switch(e.button.button) {
					case SDL_BUTTON_LEFT:
						if (menuvram == NULL) {
							sysmenu_menuopen(0, e.button.x, e.button.y);
						}
						else {
							menubase_moving(e.button.x, e.button.y, 2);
						}
						break;

					case SDL_BUTTON_RIGHT:
						break;
				}
				break;

			case SDL_MOUSEBUTTONDOWN:
				if (moving) {
					moving = FALSE;
					if (menuvram == NULL) {
					}
					else {
						menubase_moving(x, y, 0);
					}
				}
				switch(e.button.button) {
					case SDL_BUTTON_LEFT:
						if (menuvram == NULL) {
						}
						else {
							menubase_moving(e.button.x, e.button.y, 1);
						}
						break;

					case SDL_BUTTON_RIGHT:
						break;
				}
				break;

			case SDL_KEYDOWN:
				if (e.key.keysym.sym == SDLK_F11) {
					if (menuvram == NULL) {
						sysmenu_menuopen(0, 0, 0);
					}
					else {
						menubase_close();
					}
				}
				else {
					sdlkbd_keydown(e.key.keysym.sym);
				}
				break;

			case SDL_KEYUP:
				sdlkbd_keyup(e.key.keysym.sym);
				break;

			case SDL_QUIT:
				task_avail = FALSE;
				break;
		}
	}
	if (moving) {
		moving = FALSE;
		if (menuvram == NULL) {
		}
		else {
			menubase_moving(x, y, 0);
		}
	}
}
Ejemplo n.º 3
0
bool dcsys_task()
{
	enum {
		CMD_MENU = 1,
	};
	int cmd = 0;
  
	Event ev;
	static  unsigned int tick = 0;

	unsigned int tm = Timer() - tick;
	if (tm < USEC_TO_TIMER(1000000/60)) {
		return __dc_avail;
	}
  
	tick += tm;

	int x, y;

	int cJoy = 0;
	static int pJoy;
	static unsigned int repeatTime;

	if (__dc_avail) {

		dc_mouseaxis1 = 0;
		dc_mouseaxis2 = 0;

		while (PollEvent(ev)) {
      
			switch (ev.type) {
				
			case EVENT_KEYDOWN:
				switch (ev.key.keycode) {
				case KBD_S1: case KBD_S2:
					cmd = CMD_MENU;
					break;
	  
				default:
					dckbd_keydown(ev.key.keycode);
				}
				break;
	
			case EVENT_KEYUP:
				dckbd_keyup(ev.key.keycode);
				break;
	
			case EVENT_MOUSEMOTION:
				dc_mouseaxis1 += ev.motion.x;
				dc_mouseaxis2 += ev.motion.y;
				break;

			case EVENT_MOUSEBUTTONDOWN:
				switch (ev.button.button) {
				case EVENT_BUTTON_LEFT:
					mousemng_buttonevent(MOUSEMNG_LEFTDOWN);
					break;

				case EVENT_BUTTON_RIGHT:
					mousemng_buttonevent(MOUSEMNG_RIGHTDOWN);
					break;
				}
				break;
      
			case EVENT_MOUSEBUTTONUP:
				switch (ev.button.button) {
				case EVENT_BUTTON_LEFT:
					mousemng_buttonevent(MOUSEMNG_LEFTUP);
					break;

				case EVENT_BUTTON_RIGHT:
					mousemng_buttonevent(MOUSEMNG_RIGHTUP);
					break;
				}
				break;

			case EVENT_JOYAXISMOTION:
				x = 0;
				y = 0;
	
				if (ev.jaxis.axis == 0) {
					x = ev.jaxis.value;
				}
				if (ev.jaxis.axis == 1) {
					y = ev.jaxis.value;
				}

				dc_mouseaxis1 += x;
				dc_mouseaxis2 += y;
	  
				break;

			case EVENT_JOYBUTTONDOWN:

				if (ev.jbutton.button == JOY_START)
					cmd = CMD_MENU;
	
				if (ev.jbutton.button == JOY_RTRIGGER)
					__skbd_avail = !__skbd_avail;

				if (__skbd_avail && ev.jbutton.button == JOY_A)
					softkbddc_down();

				if (__skbd_avail && ev.jbutton.button == JOY_B)
					__use_bg = !__use_bg;
	
				if (__skbd_avail) {
					cJoy = ev.jbutton.button & 0xffff;
	  
				} else {
					switch (ev.jbutton.button) {

					case JOY_UP:
						dckbd_keydown(JOY1_UP);
						break;
	    
					case JOY_DOWN:
						dckbd_keydown(JOY1_DOWN);
						break;
	    
					case JOY_LEFT:
						dckbd_keydown(JOY1_LEFT);
						break;
	    
					case JOY_RIGHT:
						dckbd_keydown(JOY1_RIGHT);
						break;
	    
					case JOY_A:
						dckbd_keydown(JOY1_A);
						break;
	    
					case JOY_B:
						dckbd_keydown(JOY1_B);
						break;

					case JOY_X:
						mousemng_buttonevent(MOUSEMNG_LEFTDOWN);
						break;
	    
					case JOY_Y:
						mousemng_buttonevent(MOUSEMNG_RIGHTDOWN);
						break;
					}
				}
				break;
	
			case EVENT_JOYBUTTONUP:

				softkbddc_up();

				if (__skbd_avail) {

					pJoy = 0;
					repeatTime = 0;

				} else {
	  
					switch (ev.jbutton.button) {
	    
					case JOY_UP:
						dckbd_keyup(JOY1_UP);
						break;
	    
					case JOY_DOWN:
						dckbd_keyup(JOY1_DOWN);
						break;
	    
					case JOY_LEFT:
						dckbd_keyup(JOY1_LEFT);
						break;
	    
					case JOY_RIGHT:
						dckbd_keyup(JOY1_RIGHT);
						break;
	    
					case JOY_A:
						dckbd_keyup(JOY1_A);
						break;
	    
					case JOY_B:
						dckbd_keyup(JOY1_B);
						break;

					case JOY_X:
						mousemng_buttonevent(MOUSEMNG_LEFTUP);
						break;

					case JOY_Y:
						mousemng_buttonevent(MOUSEMNG_RIGHTUP);
						break;
					}
				}
				break;
	
			case EVENT_QUIT:
				__dc_avail = false;
				break;
			}
		}
	}


	if (__skbd_avail) {

		dc_joyinput = 0;

		int button = 0;
    
		if (cJoy) {
			repeatTime = Timer() + USEC_TO_TIMER(1000000/60*30);
			pJoy = cJoy;
			button = cJoy;
		} else if (repeatTime < Timer()) {

			button = pJoy;
			repeatTime = Timer() + USEC_TO_TIMER(1000000/60*10);
		}

		softkbddc_send(button);

	} else
		getJoyButton(JOYSTICKID1, &dc_joyinput);

	if (sys_updates & (SYS_UPDATECFG | SYS_UPDATEOSCFG)) {
		initsave();
		sysmng_initialize();
	}

	switch (cmd) {
	case CMD_MENU:
		sysmenu_menuopen();
		break;
	}

	scrnmng_update();
	softkbddc_draw();
	ta_commit_frame();
  
	return __dc_avail;
}
Ejemplo n.º 4
0
void taskmng_rol(void) {

	SDL_Event	e;

	if ((!task_avail) || (!SDL_PollEvent(&e))) {
		return;
	}
	switch(e.type) {
		case SDL_MOUSEMOTION:
			if (menuvram == NULL) {
			}
			else {
				menubase_moving(e.motion.x, e.motion.y, 0);
			}
			break;

		case SDL_MOUSEBUTTONUP:
			switch(e.button.button) {
				case SDL_BUTTON_LEFT:
					if (menuvram == NULL) {
						sysmenu_menuopen(0, e.button.x, e.button.y);
					}
					else {
						menubase_moving(e.button.x, e.button.y, 2);
					}
					break;

				case SDL_BUTTON_RIGHT:
					break;
			}
			break;

		case SDL_MOUSEBUTTONDOWN:
			switch(e.button.button) {
				case SDL_BUTTON_LEFT:
					if (menuvram == NULL) {
					}
					else {
						menubase_moving(e.button.x, e.button.y, 1);
					}
					break;

				case SDL_BUTTON_RIGHT:
					break;
			}
			break;

		case SDL_KEYDOWN:
			if (e.key.keysym.sym == SDLK_F11) {
				if (menuvram == NULL) {
					sysmenu_menuopen(0, 0, 0);
				}
				else {
					menubase_close();
				}
			}
			else {
				sdlkbd_keydown(e.key.keysym.sym);
			}
			break;

		case SDL_KEYUP:
			sdlkbd_keyup(e.key.keysym.sym);
			break;

		case SDL_QUIT:
			task_avail = FALSE;
			break;
	}
}
Ejemplo n.º 5
0
BOOL gamecore_proc(void) {

	int		event;

#ifndef DISABLE_DIALOG
	if (gamecore.gamecfg.enablepopup) {
		int x, y;
		UINT btn;
		UINT key;
		BOOL r;
		btn = inputmng_getmouse(&x, &y);
		key = inputmng_getkey();
		if (btn & RBUTTON_DOWNBIT) {
			r = sysmenu_menuopen(TRUE, x, y);
		}
		else if (key & KEY_MENU) {
			r = sysmenu_menuopen(TRUE, 0, 0);
		}
		else {
			r = FAILURE;
		}
		if (r == SUCCESS) {
			inputmng_resetmouse(0);
			inputmng_resetkey(0);
			menubase_modalproc();
			event = gamecore.event;
			if ((event >= GAMEEV_SUCCESS) && (event < GAMEEV_FADEIN)) {
				vramdraw_setrect(mainvram, NULL);
				vramdraw_draw();
			}
		}
	}
	if (menuvram != NULL) {
		menubase_proc();
	}
#endif

	event = gamecore.event;
	if ((event >= GAMEEV_SUCCESS) && (event < GAMEEV_FADEIN)) {
		anime_exec();
	}
	switch(event) {
		case GAMEEV_SUCCESS:
			event = script_dispatch();
			break;

		case GAMEEV_TEXTOUT:
			event = textdisp_exec();
			break;

		case GAMEEV_WAITMOUSE:
			event = event_mouse();
			break;

		case GAMEEV_CMDWIN:
			event = event_cmdwin();
			break;

		case GAMEEV_WAITPCMEND:
			event = event_waitpcmend();
			break;

		case GAMEEV_MSGCLK:
			event = event_msgclk();
			break;

		case GAMEEV_IRCLK:
			event = event_irclk();
			break;

		case GAMEEV_WAIT:
			event = event_wait();
			break;

		case GAMEEV_FADEIN:
			event = effect_fadeinexec();
			break;

		case GAMEEV_FADEOUT:
			event = effect_fadeoutexec();
			break;

		case GAMEEV_EFFECT:
			event = effect_exec();
			break;

		case GAMEEV_GRAYSCALE:
			event = effect_grayscale();
			break;

		case GAMEEV_SCROLL:
			event = effect_scroll();
			break;

		case GAMEEV_QUAKE:
			event = effect_quake();
			break;

		case GAMEEV_FORCE:
			event = GAMEEV_SUCCESS;
			break;

		case GAMEEV_EXIT:
			return(FAILURE);
	}

	gamecore.event = event;
	if (event < 0) {
		const char *e;
		e = gamecore_seterrorevent(event);
#ifndef DISABLE_DIALOG
		if (e) {
			menumbox(e, gamecore.suf.key, MBOX_ICONSTOP | MBOX_OK);
			return(FAILURE);
		}
#endif
		TRACEOUT(("error: %d", event));
		TRACEOUT(("system terminate."));
	}
	return(SUCCESS);
}