コード例 #1
0
ファイル: Paddle.cpp プロジェクト: BrandonSchaefer/BouncyBall
void Paddle::HandleCollision(sbe::Rect const& bound)
{
  // if we collid with top/bottom make sure we do the diff
  // of the remaining space (otherwise it looks ugly!)
  if (y() < bound.y())
  {
    int diff = y() - bound.y();
    UpdateY(-diff);
  }
  else if (y() + height() > bound.height())
  {
    int diff = y() + height() - bound.height();
    UpdateY(-diff);
  }
}
コード例 #2
0
ファイル: Paddle.cpp プロジェクト: BrandonSchaefer/BouncyBall
void Paddle::UpdatePosition(sbe::World::Ptr const& world)
{
  if (paused_)
    return;

  sbe::Rect const& bound = world->Boundary();

  UpdateVelocity();
  UpdateY(vel_y_);
  HandleCollision(bound);
}
コード例 #3
0
ファイル: Screen.cpp プロジェクト: Meraz/3D2_Project
void Screen::Update()
{	
	UpdateY();

	float lWalkingSpeed = gPlayerMovementSpeed;

	if(GetAsyncKeyState(VK_LSHIFT) & 0x8000 && mState != falling)
		lWalkingSpeed = gPlayerMovementSpeed*2;
		
	KeyBoardMovement(lWalkingSpeed, mDeltaTime);
		
	mWorldHandler->Update(mDeltaTime);
	mParticleHandler->Update(mDeltaTime, mGameTime);
	
	UpdateSunWVP();
	mGameTimer->Tick();
	mDeltaTime = mGameTimer->GetDeltaTime();
	mGameTime = mGameTimer->GetGameTime();

	//tror det är skillnaden i position i z ledet som ska in som offset, might be wrong, kör på 50 sålänge
	GetCamera().BuildViewReflection(50.0f);
	GetCamera().RebuildView();	
}