void TitleScreenGatherInput(bool* Continue) { SDL_Event ev; while (SDL_PollEvent(&ev)) { if (IsExitGameEvent(&ev)) { *Continue = false; TitleScreenEnd(); return; } InputOnEvent(&ev); for (int i = 0; i < MAX_PLAYERS; i++) { players[i].AccelX = GetMovement(i); } #ifdef __GCW0__ // Enable/disable G-Sensor based on up/down if (ev.type == SDL_KEYUP && (ev.key.keysym.sym == SDLK_UP || ev.key.keysym.sym == SDLK_DOWN)) { InputSwitchJoystick(ev.key.keysym.sym == SDLK_UP ? -1 : 1); SoundPlay(SoundScore, 1.0); } #endif } }
void CEntity::UpdateMovement(Ogre::Real ElapsedTime) { //Also update walk/idle animation? if( IsMoving() ){ Ogre::Real LenghtLeftToGo = (GetDestination() - GetPosition()).length(); Ogre::Vector3 Movement = GetMovement(); Ogre::Vector3 CorrectedMovement = ( Movement * ElapsedTime ); //Set the right angle for the entity mNode->lookAt( GetDestination(), Ogre::Node::TS_WORLD ); if( CorrectedMovement.length() < LenghtLeftToGo ){ //Not at destination yet, just move mNode->translate( CorrectedMovement ); }else{ //Arrived at destination mNode->setPosition( GetDestination() ); ReachedDestination(); //TODO: If there is a next destination then go there with the frametime left of this movement. //(Loop till all frametime is used for movement) //Example: if there are 3 destinations left, and the first 2 will be reached //in 2 seconds. //If the user has a slow computer that updates the frame every 2,5 seconds, //then it should first use x seconds to reach destination one, then check //for how many seconds left, and use those to go to the next node and so on. } } }
//----------------------------------------------------------------------------- // Purpose: Returns the ground speed of the specifed sequence. //----------------------------------------------------------------------------- float StudioModel::GetGroundSpeed( int iSequence ) { Vector vecMove; QAngle vecAngles; GetMovement( iSequence, 0, 1, vecMove, vecAngles ); float t = GetDuration( iSequence ); float flGroundSpeed = 0; if (t > 0) { flGroundSpeed = vecMove.Length() / t; } return flGroundSpeed; }
wxString IACSystem::ToString(bool includePosition) const { wxString t; t.Append(GetType(m_type) + wxT(" ")); if (!GetValue().IsEmpty()) { t.Append(wxT("(") + GetValue() + wxT(") ")); } if (!GetIntensity().IsEmpty()) { t.Append(wxT(" ") + GetIntensity() + wxT(" ")); } if (m_char >= 0) { t.Append(GetCharacteristic(m_char) + wxT("\n")); } if (includePosition) { t.Append(PositionsToString() + wxT("\n")); } t.Append(GetMovement()); return t; }
void Mouse::Check() { pMovement = GetMovement(); if (!Enabled) return; pPosition.X += pMovement.X; pPosition.Y += pMovement.Y; if (pPosition.X < 0.0f) pPosition.X = 0.0f; if (pPosition.Y < 0.0f) pPosition.Y = 0.0f; if (pPosition.X > 1.0f) pPosition.X = 1.0f; if (pPosition.Y > 1.0f) pPosition.Y = 1.0f; //CheckButton(Keys::LButton); //CheckButton(Keys::RButton); //CheckButton(Keys::MButton); //CheckButton(Keys::XButton1); //CheckButton(Keys::XButton2); //float s = Scripting::GetMouseSensitivity(); //NetHook::DisplayText("Mouse: " + pPosition.X.ToString("F2") + " " + pPosition.Y.ToString("F2") + " " + s.ToString("F2") + " " + bDrawn.ToString(), 2000); }
void GameGatherInput(bool* Continue) { #ifndef DREAMCAST SDL_Event ev; while (SDL_PollEvent(&ev)) { InputOnEvent(&ev); if (IsPauseEvent(&ev)) Pause = !Pause; else if (IsExitGameEvent(&ev)) { *Continue = false; return; } } #endif for (int i = 0; i < MAX_PLAYERS; i++) { if (!players[i].Alive) continue; players[i].AccelX = GetMovement(i); } }