/*!
*@brief	移動処理。
*/
void CPlayer::Move()
{
	//XZ平面での移動速度。
	m_moveSpeed.x = 0.02f;
	m_moveSpeed.z = 0.02f;
	if (KeyInput().IsAPress()) {
		//キーボードのAが押されていたら速度を倍にする。
		m_moveSpeed.x *= 2.0f;
		m_moveSpeed.z *= 2.0f;
		m_moveSpeed.y = 0.1f;
	}
	//Y方向への移動速度。
	if (KeyInput().IsUpPress()) {
		m_position.z += m_moveSpeed.z;
	}
	if (KeyInput().IsDownPress()) {
		m_position.z -= m_moveSpeed.z;
	}
	if (KeyInput().IsRightPress()) {
		m_position.x += m_moveSpeed.x;
	}
	if (KeyInput().IsLeftPress()) {
		m_position.x -= m_moveSpeed.x;
	}
	m_position.y += m_moveSpeed.y;
	//重力とかは考えない。
	m_moveSpeed.y -= 0.01f;
	if (m_position.y < 0.08f) {
		//座標が半径以下になったので座標を補正。
		m_position.y = 0.08f;
	}
}
Exemple #2
0
void	Controls::CatchController(const sf::Event &event)
{
    std::string index = "";

    if (this->num_play ==  1)
        this->ctrlCu = this->ctrlK1;
    else
        this->ctrlCu = this->ctrlK2;
    if (CheckEvent(event, 850, 1055, 415, 470))
        index = "up";
    else if (CheckEvent(event, 550, 755, 535, 590))
        index = "left";
    else if (CheckEvent(event, 850, 1050, 540, 590))
        index = "down";
    else if (CheckEvent(event, 1225, 1425, 540, 590))
        index = "right";
    else if (CheckEvent(event, 850, 1050, 660, 710))
        index = "bomb";
    if (index.size() > 1) {
        this->ctrlCu[index] = "Key";
        this->Display();
        this->_Window->display();
        KeyInput(index);
    }
}
Exemple #3
0
KeyInput SDLInput::dequeueKeyInput()
{
    if (mKeyInputQueue.empty())
        return KeyInput();

    KeyInput keyInput = mKeyInputQueue.front();
    mKeyInputQueue.pop();

    return keyInput;
}
Exemple #4
0
void MainWindow::keyPressEvent(QKeyEvent *e)
{
	if(isFullScreen() && e->key() == Qt::Key_F11)
	{
		on_action_OptionsFullScreen_triggered();
		return;
	}

	NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawQttoNative.find(e->key())->second, KEY_DOWN));
}
Exemple #5
0
// 블럭 상태 및 스테이지 업뎃
void Tetris::Update()
{
	int key = KeyInput();
	switch( stage )
	{
	case INIT :
		press_any_key( key );
		break;
	case READY :
		level_select( key );
		break;
	case RUNNING :
		m_block->Move( key );

		// 블럭이 바닥이나 다른 블럭에 닿았다면 합침
		if( m_block->GetBlockState() == 2 )
			merge_block( m_block->GetBlockX(), m_block->GetBlockY() );

		// 꽉 찬 라인이 있는지 확인
		m_full_line_num = check_full_line();
		if( m_full_line_num != 0 )
			full_line_Set();

		if( stage_data[m_level].clear_line == m_line )
		{
			++m_level;
			if( m_level >= MAX_STAGE )
			{
				stage = SUCCESS;
			}
			m_line = 0;
		}

		// 게임 오버~
		if( GameOver() )
			stage = FAILED;
		break;
	case SUCCESS:
	case FAILED:
		if( key == 'y' || key == 'Y' )
		{
			stage = READY;
			Init();
		}
		if( key == 'n' || key == 'N' )
			stage = RESULT;
		break;
	case RESULT:
			m_bIsGameOver = true;
		break;
	}
}
Exemple #6
0
// Runs the game
TSize App::Run()
{
    Timer t; // to switch the clock

    t.Start(1);

    for (;;)
    {
        Mouse.Update();

        // Current control tag
        status = controls.Tag();

        // If anything was updated, show it
        if (controls.Update() != 0 || t.Done())
        {
            if (t.Done()) // Start new timer
                t.Start(1);

            if (maze.Found()) // Increase number of crystals
                if (!--crystals)
                    return (clock() - Start) / CLK_TCK;

            UpdateInfo(); // Updates information labels

            controls.Show(); // Shows the controls

            Mouse.Hide(); // Hide mouse

            g_Screen.Switch(Delay); // Switch pages
            Mouse.Page(g_Screen.Visual()); // Switch mouse

            Mouse.Show(); // Show mouse
        }

        ButtonInput(); // Get buttons input

        if (done.Click()) // Exit if "Exit" is clicked
            return 0;

        if (!KeyInput()) // Escape pressed
            return 0;

    }
}
void StateCharacterGenerate::Update()
{
    DrawFormatString( 0 , 0 , ColorOf(0,255,0) , "キャラ生成テスト:Enterで再生成");
    
    char const* status_name[] =
    {
    	"HP ",
    	"ATK",
    	"DEF",
    	"SPD",
    	"TEC",
    	"LUK",
    };
    
    assert( StatusType_Num == ARRAY_SIZE(status_name) );

    DrawFormatString( 0, 20 , ColorOf(255,255,255), "id:%03d", mUnitStatus.mID );

	int const kBaseY = 40;
    for( int i = 0 ; i < StatusType_Num ; i++ ){
        for( int j = 0 ; j < mUnitStatus.mStatus[i] ; j++ ){
			int color = ColorOf(255,255,255);
			if( mUnitStatus.mStatus[i] >= 15 ){
				color = ColorOf(250,0,0);
			}else if( mUnitStatus.mStatus[i] >= 12 ){
				color = ColorOf(250,250,0);
			}else if( mUnitStatus.mStatus[i] <= 7 ){
				color = ColorOf(0,0,250);
			}
	        DrawFormatString( 50 + j * 12 , kBaseY + i*10 , color ,"■" );
        }
        DrawFormatString( 0, kBaseY + i*10, ColorOf(255,255,255), "%s:%03d", status_name[i], mUnitStatus.mStatus[i] );
    }
    
    if( KeyInput()->IsTrig( InputKey::Type_Enter ) ){
    	mUnitStatus.SetRandom(mGenerateNum);
    	mGenerateNum++;
    }
}
Exemple #8
0
void SymbianMediaKeys::forwardtimerexpired(){
	forwardtimer->stop();
	NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_NEXT, KEY_UP));
}
Exemple #9
0
void MainWindow::keyReleaseEvent(QKeyEvent *e)
{
	NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawQttoNative.find(e->key())->second, KEY_UP));
}
Exemple #10
0
int RankingView(void) {
	int		i, xxx, col;

	KeyInput();

	domirror = 0;	// 鏡像を無効化

	// 背景描画
	if(background == 0) {
		for(i = 0; i <= 4; i++) {
			ExBltFastRect(4 + (category >= 2) + (category == 3), 96 * i - (count & 63) /2, 0, 0, 0, 96, 240);
		}
	} else if(background == 1) {
		for(i = 0; i <= 4; i++) {
			ExBltFastRect(4 + (category >= 2) + (category == 3), 96 * i, 0, 0, 0, 96, 240);
		}
	} else {
		ExBltFast(30, 0, 0);
	}

	if(category == 0)
		printFont(11, 3, "- BEGINNER MODE -", 4);
	else if(category == 1)
		printFont(11, 3, "-  MASTER MODE  -", 1);
	else if(category == 2)
		printFont(11, 3, "-   20G MODE    -", 7);
	else
		printFont(11, 3, "-  DEVIL MODE   -", 3);

	// 簡易セレクトでは表示しない#1.60c7i6
	if(!mini_select) {
		if(rankingmode)
			printFont(11, 4, "TIME TRIAL RANKING", category);
		else
			printFont(12, 4, "ENDLESS RANKING", category);
	} else {
		rankingmode = 1;
	}

//	printFont(2, 6, "RANK   SCORE  LV LINES TIME     NAME", 2);
	ExBltRect(3, 64, 56, 206, 112, 22, 7);
	if(rankingmode) {
		ExBltRect(3, 240, 56, 154, 112, 26, 7);
		ExBltRect(3, 140, 56, 180, 119, 26, 7);
	} else {
		ExBltRect(3, 140, 56, 154, 112, 26, 7);
		ExBltRect(3, 240, 56, 180, 119, 26, 7);
	}
	ExBltRect(3, 216, 48, 180, 112, 26, 7);
	ExBltRect(3, 257, 48, 154, 119, 26, 7);

	for(i = 0; i < 5; i++) {
		xxx = 40 - count + 4 * i;
		if(xxx < 2) xxx = 2;
		if(i % 2 == 1) xxx = 4 - xxx;

		// オレンジに表示されるランキングをとりあえず導入#1.60c7f5
		if(rkfl[category * 10 + rankingmode * 5 + i]) {
			// 完全クリアした場合
			col = 7;
		} else if(((category == 0) && (rklv[category * 10 + rankingmode * 5 + i] == 200)) ||
				  ((category == 3) && (rklv[category * 10 + rankingmode * 5 + i] == 1300)) ||
				  (((category == 1) || (category == 2)) && (rklv[category * 10 + rankingmode * 5 + i] == 999))) {
			// ロール途中で窒息した場合
			if(rankingmode) {
				col = 4;
			} else {
				col = 0;
			}
		} else {
			// 未カンスト
			col = 0;
		}

//		printFont(xxx, 8 + 2 * i, string[10 + i], col);
		sprintf(string[0], "%d", i + 1);
		printBIGFont((xxx +3) * 8, (4 * i + 9) * 8, string[0], col);
		printFont(xxx + 6, 4 * i + 10, string[30 + category * 10 + rankingmode* 5 + i], col);
		if(rankingmode) {
			sprintf(string[0], "%7d", rksc[category * 10 + rankingmode * 5 + i]);
			printFont(xxx + 25, 4 * i + 10, string[0], col);
			getTime(rktime[category * 10 + rankingmode * 5 + i]);
			printBIGFont((xxx + 11) * 8, (4 * i + 9) * 8, string[0], col);
		} else {
			sprintf(string[0], "%7d", rksc[category * 10 + rankingmode * 5 + i]);
			printBIGFont((xxx + 11) * 8, (4 * i + 9) * 8, string[0], col);
			getTime(rktime[category * 10 + rankingmode * 5 + i]);
			printFont(xxx + 25, 4 * i + 10, string[0], col);
		}
		sprintf(string[0], "%5d/%3d", rklv[category * 10 + rankingmode * 5 + i], rkbl[category * 10 + rankingmode * 5 + i]);
		printFont(xxx + 24, 4 * i + 9, string[0], col);
	}

	if(getPushState(0, 4) || getPushState(0, 5) || getPushState(1, 4) || getPushState(1, 5)) {
		return (-1);
	}

	return (0);
}
Exemple #11
0
void BlackberryMain::handleInput(screen_event_t screen_event)
{
	TouchInput input;
	KeyInput key;
	int val, buttons, pointerId;
	int pair[2];
	screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &val);
	screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_SOURCE_POSITION, pair);

	input_state.mouse_valid = true;
	switch(val)
	{
	// Touchscreen
	case SCREEN_EVENT_MTOUCH_TOUCH:
	case SCREEN_EVENT_MTOUCH_RELEASE: 	// Up, down
		screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TOUCH_ID, &pointerId);
		input_state.pointer_down[pointerId] = (val == SCREEN_EVENT_MTOUCH_TOUCH);
		input_state.pointer_x[pointerId] = pair[0] * g_dpi_scale;
		input_state.pointer_y[pointerId] = pair[1] * g_dpi_scale;

		input.x = pair[0] * g_dpi_scale;
		input.y = pair[1] * g_dpi_scale;
		input.flags = (val == SCREEN_EVENT_MTOUCH_TOUCH) ? TOUCH_DOWN : TOUCH_UP;
		input.id = pointerId;
		NativeTouch(input);
		break;
	case SCREEN_EVENT_MTOUCH_MOVE:
		screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TOUCH_ID, &pointerId);
		input_state.pointer_x[pointerId] = pair[0] * g_dpi_scale;
		input_state.pointer_y[pointerId] = pair[1] * g_dpi_scale;

		input.x = pair[0] * g_dpi_scale;
		input.y = pair[1] * g_dpi_scale;
		input.flags = TOUCH_MOVE;
		input.id = pointerId;
		NativeTouch(input);
		break;
	// Mouse, Simulator
	case SCREEN_EVENT_POINTER:
		screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_BUTTONS, &buttons);
		if (buttons == SCREEN_LEFT_MOUSE_BUTTON) { // Down
			input_state.pointer_x[0] = pair[0] * g_dpi_scale;
			input_state.pointer_y[0] = pair[1] * g_dpi_scale;
			input_state.pointer_down[0] = true;

			input.x = pair[0] * g_dpi_scale;
			input.y = pair[1] * g_dpi_scale;
			input.flags = TOUCH_DOWN;
			input.id = 0;
			NativeTouch(input);
		} else if (input_state.pointer_down[0]) {	// Up
			input_state.pointer_x[0] = pair[0] * g_dpi_scale;
			input_state.pointer_y[0] = pair[1] * g_dpi_scale;
			input_state.pointer_down[0] = false;

			input.x = pair[0] * g_dpi_scale;
			input.y = pair[1] * g_dpi_scale;
			input.flags = TOUCH_UP;
			input.id = 0;
			NativeTouch(input);
		}
		break;
	// Keyboard
	case SCREEN_EVENT_KEYBOARD:
		int flags, value;
		screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_FLAGS, &flags);
		screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_SYM, &value);
		NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawBlackberrytoNative.find(value)->second, (flags & KEY_DOWN) ? KEY_DOWN : KEY_UP));
		break;
	// Gamepad
	case SCREEN_EVENT_GAMEPAD:
	case SCREEN_EVENT_JOYSTICK:
		int analog0[3];
		screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_BUTTONS, &buttons);
		for (int i = 0; i < 32; i++) {
			int mask = 1 << i;
			if ((old_buttons & mask) != (buttons & mask))
				NativeKey(KeyInput(DEVICE_ID_PAD_0, KeyMapPadBlackberrytoNative.find(mask)->second, (buttons & mask) ? KEY_DOWN : KEY_UP));
		}
		if (!screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_ANALOG0, analog0)) {
			for (int i = 0; i < 2; i++) {
				AxisInput axis;
				axis.axisId = JOYSTICK_AXIS_X + i;
				// 1.2 to try to approximate the PSP's clamped rectangular range.
				axis.value = 1.2 * analog0[i] / 128.0f;
				if (axis.value > 1.0f) axis.value = 1.0f;
				if (axis.value < -1.0f) axis.value = -1.0f;
				axis.deviceId = DEVICE_ID_PAD_0;
				axis.flags = 0;
				NativeAxis(axis);
			}
		}
		old_buttons = buttons;
		break;
	case SCREEN_EVENT_DISPLAY:
		screen_display_t new_dpy = NULL;
		screen_get_event_property_pv(screen_event, SCREEN_PROPERTY_DISPLAY, (void **)&new_dpy);
		for (int i = 0; i < ndisplays; i++) {
			if (new_dpy != screen_dpy[i])
				continue;
			int active = 0;
			screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_ATTACHED, &active);
			if (active) {
				int size[2];
				screen_get_display_property_iv(screen_dpy[i], SCREEN_PROPERTY_SIZE, size);
				if (size[0] == 0 || size[1] == 0)
					active = 0;
			}
			if (active && !displays[i].attached)
				realiseDisplay(i);
			else if (!active && displays[i].attached && displays[i].realised)
				unrealiseDisplay(i);
			displays[i].attached = active;
		}
		break;
	}
}
Exemple #12
0
bool MainUI::event(QEvent *e)
{
    TouchInput input;
    QList<QTouchEvent::TouchPoint> touchPoints;
    switch(e->type())
    {
    case QEvent::TouchBegin:
    case QEvent::TouchUpdate:
    case QEvent::TouchEnd:
        touchPoints = static_cast<QTouchEvent *>(e)->touchPoints();
        foreach (const QTouchEvent::TouchPoint &touchPoint, touchPoints) {
            switch (touchPoint.state()) {
            case Qt::TouchPointStationary:
                break;
            case Qt::TouchPointPressed:
            case Qt::TouchPointReleased:
                input_state.pointer_down[touchPoint.id()] = (touchPoint.state() == Qt::TouchPointPressed);
                input_state.pointer_x[touchPoint.id()] = touchPoint.pos().x() * g_dpi_scale * xscale;
                input_state.pointer_y[touchPoint.id()] = touchPoint.pos().y() * g_dpi_scale * yscale;

                input.x = touchPoint.pos().x() * g_dpi_scale * xscale;
                input.y = touchPoint.pos().y() * g_dpi_scale * yscale;
                input.flags = (touchPoint.state() == Qt::TouchPointPressed) ? TOUCH_DOWN : TOUCH_UP;
                input.id = touchPoint.id();
                NativeTouch(input);
                break;
            case Qt::TouchPointMoved:
                input_state.pointer_x[touchPoint.id()] = touchPoint.pos().x() * g_dpi_scale * xscale;
                input_state.pointer_y[touchPoint.id()] = touchPoint.pos().y() * g_dpi_scale * yscale;

                input.x = touchPoint.pos().x() * g_dpi_scale * xscale;
                input.y = touchPoint.pos().y() * g_dpi_scale * yscale;
                input.flags = TOUCH_MOVE;
                input.id = touchPoint.id();
                NativeTouch(input);
                break;
            default:
                break;
            }
        }
        break;
    case QEvent::MouseButtonDblClick:
        if (!g_Config.bShowTouchControls || GetUIState() != UISTATE_INGAME)
            emit doubleClick();
        break;
    case QEvent::MouseButtonPress:
    case QEvent::MouseButtonRelease:
        input_state.pointer_down[0] = (e->type() == QEvent::MouseButtonPress);
        input_state.pointer_x[0] = ((QMouseEvent*)e)->pos().x() * g_dpi_scale * xscale;
        input_state.pointer_y[0] = ((QMouseEvent*)e)->pos().y() * g_dpi_scale * yscale;

        input.x = ((QMouseEvent*)e)->pos().x() * g_dpi_scale * xscale;
        input.y = ((QMouseEvent*)e)->pos().y() * g_dpi_scale * yscale;
        input.flags = (e->type() == QEvent::MouseButtonPress) ? TOUCH_DOWN : TOUCH_UP;
        input.id = 0;
        NativeTouch(input);
        break;
    case QEvent::MouseMove:
        input_state.pointer_x[0] = ((QMouseEvent*)e)->pos().x() * g_dpi_scale * xscale;
        input_state.pointer_y[0] = ((QMouseEvent*)e)->pos().y() * g_dpi_scale * yscale;

        input.x = ((QMouseEvent*)e)->pos().x() * g_dpi_scale * xscale;
        input.y = ((QMouseEvent*)e)->pos().y() * g_dpi_scale * yscale;
        input.flags = TOUCH_MOVE;
        input.id = 0;
        NativeTouch(input);
        break;
    case QEvent::Wheel:
        NativeKey(KeyInput(DEVICE_ID_MOUSE, ((QWheelEvent*)e)->delta()<0 ? NKCODE_EXT_MOUSEWHEEL_DOWN : NKCODE_EXT_MOUSEWHEEL_UP, KEY_DOWN));
        break;
    case QEvent::KeyPress:
        NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawQttoNative.find(((QKeyEvent*)e)->key())->second, KEY_DOWN));
        break;
    case QEvent::KeyRelease:
        NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawQttoNative.find(((QKeyEvent*)e)->key())->second, KEY_UP));
        break;
    default:
        return QWidget::event(e);
    }
    e->accept();
    return true;
}
Exemple #13
0
void SymbianMediaKeys::voldowntimerexpired(){
	voldowntimer->stop();
	NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_VOLUME_DOWN, KEY_UP));
}
Exemple #14
0
/*
 * it seems that it takes about 600ms to get an update after buttonpress
 * */
void SymbianMediaKeys::MrccatoCommand(TRemConCoreApiOperationId aOperationId,TRemConCoreApiButtonAction aButtonAct){
	TRequestStatus status;
	switch( aOperationId ){
	case ERemConCoreApiPausePlayFunction:
	{
		switch (aButtonAct){
		case ERemConCoreApiButtonPress:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_PLAY_PAUSE, KEY_DOWN));
			break;
		case ERemConCoreApiButtonRelease:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_PLAY_PAUSE, KEY_UP));
			break;
		case ERemConCoreApiButtonClick:
			playtimer->start(KTimeOut);
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_PLAY_PAUSE, KEY_DOWN));
			break;
		default:
			// Play/Pause unknown action
			break;
		}
		break;
	}

	case ERemConCoreApiStop:
	{
		switch (aButtonAct){
		case ERemConCoreApiButtonPress:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_STOP, KEY_DOWN));
			break;
		case ERemConCoreApiButtonRelease:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_STOP, KEY_UP));
			break;
		case ERemConCoreApiButtonClick:
			stoptimer->start(KTimeOut);
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_STOP, KEY_DOWN));
			break;
		default:
			break;
		}
		break;
	}
	case ERemConCoreApiRewind:
	{
		switch (aButtonAct){
		case ERemConCoreApiButtonPress:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_PREVIOUS, KEY_DOWN));
			break;
		case ERemConCoreApiButtonRelease:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_PREVIOUS, KEY_UP));
			break;
		case ERemConCoreApiButtonClick:
			backwardtimer->start(KTimeOut);
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_PREVIOUS, KEY_DOWN));
		default:
			break;
		}
		break;
	}
	case ERemConCoreApiFastForward:
	{
		switch (aButtonAct){
		case ERemConCoreApiButtonPress:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_NEXT, KEY_DOWN));
			break;
		case ERemConCoreApiButtonRelease:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_NEXT, KEY_UP));
			break;
		case ERemConCoreApiButtonClick:
			forwardtimer->start(KTimeOut);
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_NEXT, KEY_DOWN));
		default:
			break;
		}
		break;
	}
	case ERemConCoreApiVolumeUp:
	{
		switch (aButtonAct){
		case ERemConCoreApiButtonPress:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_VOLUME_UP, KEY_DOWN));
			break;
		case ERemConCoreApiButtonRelease:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_VOLUME_UP, KEY_UP));
			break;
		case ERemConCoreApiButtonClick:
			voluptimer->start(KTimeOut);
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_VOLUME_UP, KEY_DOWN));
		default:
			break;
		}
		break;
	}
	case ERemConCoreApiVolumeDown:
	{
		switch (aButtonAct){
		case ERemConCoreApiButtonPress:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_VOLUME_DOWN, KEY_DOWN));
			break;
		case ERemConCoreApiButtonRelease:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_VOLUME_DOWN, KEY_UP));
			break;
		case ERemConCoreApiButtonClick:
			voldowntimer->start(KTimeOut);
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_VOLUME_DOWN, KEY_DOWN));
		default:
			break;
		}
		break;
	}
	case ERemConCoreApiBackward:
	{
		switch (aButtonAct)
		{
		case ERemConCoreApiButtonPress:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_PREVIOUS, KEY_DOWN));
			break;
		case ERemConCoreApiButtonRelease:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_PREVIOUS, KEY_UP));
			break;
		case ERemConCoreApiButtonClick:
			backwardtimer->start(KTimeOut);
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_PREVIOUS, KEY_DOWN));
		default:
			break;
		}
		break;
	}
	case ERemConCoreApiForward:
	{
		switch (aButtonAct)
		{
		case ERemConCoreApiButtonPress:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_NEXT, KEY_DOWN));
			break;
		case ERemConCoreApiButtonRelease:
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_NEXT, KEY_UP));
			break;
		case ERemConCoreApiButtonClick:
			forwardtimer->start(KTimeOut);
			NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_NEXT, KEY_DOWN));
		default:
			break;
		}
		break;
	}

	default:
		break;
	}
	//complete key event
	CompleteMediaKeyEvent( aOperationId );
}
Exemple #15
0
void SymbianMediaKeys::backwardtimerexpired(){
	backwardtimer->stop();
	NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_PREVIOUS, KEY_UP));
}
Exemple #16
0
// �Z�N�V�����^�C�������L���O�\��
void ST_RankingView() {
	int i, max, mode, tmp, tmp5, bps, bps1,bps2,s;

	mode = 1;

	while(1) {
		// �w�i�`��
		count++;
		if(background == 0) {
			for(i = 0; i <= 6; i++) {
				ExBltFastRect(4 + (mode >= 3) + (mode == 4), 96 * i - (count % 96) / 3, 0, 0, 0, 96, 240);
			}
		} else if(background == 1) {
			for(i = 0; i <= 6; i++) {
				ExBltFastRect(4 + (mode >= 3) + (mode == 4), 96 * i, 0, 0, 0, 96, 240);
			}
		} else {
			ExBltFast(30, 0, 0);
		}
		ExBltRect(77, 0, 208,  count % 320, 20, 320 - (count % 320), 8);
		ExBltRect(77, 320 - (count % 320), 208,  0, 20, count % 320, 8);

		ExBltRect(77, count % 320, 16,  0, 28, 320 - (count % 320), 8);
		ExBltRect(77, 0, 16, 320 - (count % 320), 28, count % 320, 8);

		//�A�h���X�w��
		if(mode == 0){
			tmp5 = 0;
		}else if(mode == 1){
			tmp5 = 4;
		}else if(mode == 2){
			tmp5 = 15;
		}else if(mode == 3){
			tmp5 = 30;
		}else if(mode == 4){
			tmp5 = 40;
		}else if(mode == 5){
			tmp5 = 60;
		}

		// ���[�h���\��
		if(mode == 0)
			printFont(11, 1, "- BEGINNER MODE -", 4);
		else if(mode == 1)
			printFont(11, 1, "-  MASTER MODE  -", 1);
		else if(mode == 2)
			printFont(9, 1, "-  MASTER GRADE4 MODE  -", 1);
		else if(mode == 3)
			printFont(11, 1, "-   20G MODE    -", 7);
		else if(mode == 4)
			printFont(11, 1, "-  DEVIL MODE   -", 2);
		else if(mode == 5)
			printFont(11, 1, "-  TOMOYO MODE   -", 3);

		if(mode == 5){
			printFont(1,  3, "STAGE",1);
			printFont(8,  3, "TIME", 1);
			printFont(15, 3, "USE", 1);
			printFont(20,  3, "STAGE",1);
			printFont(28,  3, "TIME", 1);
			printFont(35, 3, "USE", 1);
		}else if(mode < 5){
			printFont(2,  3, "LEVEL",1);
			printFont(12,  3, "TIME", 1);
			printFont(21, 3, "LVSTOP", 1);
			printFont(28, 3, "USE", 1);
			printFont(32, 3, "BLOCK/S ", 1);
		}

		// �\���������߂�
		if(mode == 0)
			max = 2;
		else if( (mode == 1) || (mode == 2)|| (mode == 3) )
			max = 10;
		else if(mode == 4)
			max = 13;
		else if(mode == 5)
			max =27;

		// �����L���O�\��
		for(i=0; i<max; i++) {
			if(st_end[i + tmp5] == 1)
				tmp = 4;
			else if(st_end[i + tmp5] == 2)
				tmp = 7;
			else
				tmp = 0;

			if(mode != 5){//���̑�
				if( ((mode == 1) || (mode == 2)|| (mode == 3)) && (i == 9) ){
					sprintf(string[0], " 900-999");
				} else if(mode <= 4){
					sprintf(string[0], "%4d-%3d", i*100, (i+1)*100);
				}

				printFont(1, 4+i, string[0], tmp);

				//�^�C��
				getTime(st_time[i + tmp5]);
				printFont(11, 4+i, string[0], tmp);

				//���x���X�g�b�v
				getSTime(st_lvstop[i + tmp5]);
				printFont(21, 4+i, string[0], tmp);

				//USE�u���b�N��
				sprintf(string[0],"%d",st_others[i + tmp5]);
				printFont(29, 4+i, string[0], tmp);

				//BPS
				bps = (st_others[i + tmp5] * 1000) / (st_time[i + tmp5] / 60);
				bps1 = bps / 1000;//����
				bps2 = bps % 1000;//���O��
				sprintf(string[0],"%d.",bps1);
				printFont(32, 4+i, string[0], tmp);
				if(bps2>=100){
				sprintf(string[0],"%3d",bps2);
				printFont(34, 4+i, string[0], tmp);
				}else if(bps2>=10){
				sprintf(string[0],"0%2d",bps2);
				printFont(34, 4+i, string[0], tmp);
				}else{
				sprintf(string[0],"00%d",bps2);
				printFont(34, 4+i, string[0], tmp);
				}
				if(mode==2){
					printFont(2, 28, "GRADE HISTORY", 2);
					for(s=0;s<5;s++){
					sprintf(string[0],"%d",grade_his[s]);
					printFont(3*s, 29, string[0], tmp);
					}
				}
			}else{ //TOMOYO
				if(i <= 19){
					sprintf(string[0], "%d",i+1);
					printFont(2, 4+i, string[0], tmp);

					//�^�C��
					getTime(st_time[i + tmp5]);
					printFont(6, 4+i, string[0], tmp);

					//�g�p�u���b�N��
					sprintf(string[0],"%d",st_others[i + tmp5]);
					printFont(16, 4+i, string[0], tmp);

				}else if(i > 19){
					sprintf(string[0], "EX%d",i - 19);
					printFont(20, i - 16, string[0], tmp);

					//�^�C��
					getTime(st_time[i + tmp5]);
					printFont(26, i - 16, string[0], tmp);

					//�g�p�u���b�N��
					sprintf(string[0],"%d",st_others[i + tmp5]);
					printFont(36, i-16, string[0], tmp);
				}
			}
		}

		// ���v���\��
		tmp = 0;
		for(i=0; i<max; i++) {
			tmp = tmp + st_time[i + tmp5];
		}
		printFont(1, 25, "TOTAL TIME", 1);
		getTime(tmp);
		printFont(12, 25, string[0], 2);

		KeyInput();

		if(getPushState(0, 4) || getPushState(0, 5)) {
			// A��B�Ŗ߂�
			return;
		}

		if(getPushState(0, 2)) {
			// ��
			PlaySE(5);
			mode--;
			if(mode < 1) mode = 5;
		}
		if(getPushState(0, 3)) {
			// ��
			PlaySE(5);
			mode++;
			if(mode > 5) mode = 1;
		}

		spriteTime();//halt
	}
}
Exemple #17
0
void SymbianMediaKeys::stoptimerexpired(){
	stoptimer->stop();
	NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_STOP, KEY_UP));
}
Exemple #18
0
void SymbianMediaKeys::playtimerexpired(){
	playtimer->stop();
	NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_MEDIA_PLAY_PAUSE, KEY_UP));
}
Exemple #19
0
void BlackberryMain::runMain() {
	bool running = true;
	while (running && !g_quitRequested) {
		input_state.mouse_valid = false;
		input_state.accelerometer_valid = false;
		while (true) {
			// Handle Blackberry events
			bps_event_t *event = NULL;
			bps_get_event(&event, 0);
			if (event == NULL)
				break; // Ran out of events
			int domain = bps_event_get_domain(event);
			if (domain == screen_get_domain()) {
				handleInput(screen_event_get_event(event));
			} else if (domain == navigator_get_domain()) {
				switch(bps_event_get_code(event))
				{
				case NAVIGATOR_INVOKE_TARGET:
					{
						const navigator_invoke_invocation_t *invoke = navigator_invoke_event_get_invocation(event);
						if(invoke) {
							boot_filename = navigator_invoke_invocation_get_uri(invoke)+7; // Remove file://
						}
					}
					break;
				case NAVIGATOR_ORIENTATION:
					sensor_remap_coordinates(navigator_event_get_orientation_angle(event));
					break;
				case NAVIGATOR_BACK:
				case NAVIGATOR_SWIPE_DOWN:
					NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_ESCAPE, KEY_DOWN));
					break;
				case NAVIGATOR_EXIT:
					return;
				}
			} else if (domain == sensor_get_domain()) {
				if (SENSOR_ACCELEROMETER_READING == bps_event_get_code(event)) {
					sensor_event_get_xyz(event, &(input_state.acc.y), &(input_state.acc.x), &(input_state.acc.z));
					AxisInput axis;
					axis.deviceId = DEVICE_ID_ACCELEROMETER;
					axis.flags = 0;

					axis.axisId = JOYSTICK_AXIS_ACCELEROMETER_X;
					axis.value = input_state.acc.x;
					NativeAxis(axis);

					axis.axisId = JOYSTICK_AXIS_ACCELEROMETER_Y;
					axis.value = input_state.acc.y;
					NativeAxis(axis);

					axis.axisId = JOYSTICK_AXIS_ACCELEROMETER_Z;
					axis.value = input_state.acc.z;
					NativeAxis(axis);
				}
			}
		}
		UpdateInputState(&input_state);
		NativeUpdate(input_state);
		// Work in Progress
		// Currently: Render to HDMI port (eg. 1080p) when in game. Render to device when in menu.
		// Idea: Render to all displays. Controls go to internal, game goes to external(s).
		if (GetUIState() == UISTATE_INGAME && !emulating) {
			emulating = true;
			switchDisplay(screen_emu);
			if (g_Config.iShowFPSCounter == 4) {
				int options = SCREEN_DEBUG_STATISTICS;
				screen_set_window_property_iv(screen_win[0], SCREEN_PROPERTY_DEBUG, &options);
			}
		} else if (GetUIState() != UISTATE_INGAME && emulating) {
			emulating = false;
			switchDisplay(screen_ui);
		}
		NativeRender();
		EndInputState(&input_state);
		time_update();
		// This handles VSync
		if (emulating)
			eglSwapBuffers(egl_disp[screen_emu], egl_surf[screen_emu]);
		else
			eglSwapBuffers(egl_disp[screen_ui], egl_surf[screen_ui]);
	}
}