Ejemplo n.º 1
0
  void ScreenShaker::ApplyMatrix() {
	if (shake) {
	  auto amplitude = (1.0 - shakeTimer / shakeTime) * 1.0;
	  auto angle = shakeTimer / shakeTime * M_PI * 2.0f * 10.0f;
	  SetTranslate(amplitude * sin(angle), 0);
	}
	else {
	  SetTranslate(0, 0);
	}
  }
Ejemplo n.º 2
0
  void ScreenShaker::Update(double dt) {
	if (shake) {
	  shakeTimer += dt;
	  if (shakeTimer > shakeTime) {
		shake = false;
		SetTranslate(0, 0);
		shakeTimer = 0.0f;
	  }
	  else {
		auto amplitude = (1.0 - shakeTimer / shakeTime) * 5.0;
		auto angle = shakeTimer / shakeTime * M_PI * 2.0f * 10.0f;
		SetTranslate(amplitude * sin(angle), 0);
	  }
	}
  }
Ejemplo n.º 3
0
  void App::Draw() {
	SetProjection(fieldWidth, fieldHeight);

	if (!progress.IsPaused()) {
	  shaker.ApplyMatrix();
	  asteroids.Draw();
	  spliceAsteroids.Draw();
	  stars.Draw();
	  for (int i = 0; i < maxPlayersCount; i++) {
		players[i].Draw();
	  }
	  DrawNumber(false,
				 fieldWidth - 5.0f,
				 fieldHeight - 10.0f,
				 1,
				 1.5,
				 progress.GetLevel());
	  DrawNumber(true,
				 5.0f,
				 fieldHeight - 10.0f,
				 1,
				 1.5,
				 scoreTotal);
	}

	SetTranslate(0, 0);
	progress.Draw();
  }
Ejemplo n.º 4
0
Kylin::Factor* Kylin::ActionDispatcher::Fire( KUINT uGID,const KPoint3& kPos )
{
	Factor* pFactor = Fire(uGID);
	SAFE_CALL(pFactor,SetTranslate(kPos));

	return pFactor;
}
Ejemplo n.º 5
0
//-------------------------------------------------------------------------------
// @ Obstacle::Obstacle()
//-------------------------------------------------------------------------------
// Constructor
//-------------------------------------------------------------------------------
Obstacle::Obstacle() : SimObject()
{
    SetTranslate( IvVector3( 0.0f, 3.0f, 0.0f ) );
    
    mElasticity = 0.25f;
    SetMass(20.0f);

}   // End of Obstacle::Obstacle()
Ejemplo n.º 6
0
//-------------------------------------------------------------------------------
// @ Obstacle::Update()
//-------------------------------------------------------------------------------
// Main update loop
//-------------------------------------------------------------------------------
void
Obstacle::Update( float dt )
{   
    if (IvGame::mGame->mEventHandler->IsKeyDown(' '))
    {
        SetTranslate( IvVector3( 0.0f, 3.0f, 0.0f ) );
        mRotate.Identity();
        mVelocity.Zero();
        mAngularMomentum.Zero();
        mAngularVelocity.Zero();
    }

    SimObject::Update( dt );
}
Ejemplo n.º 7
0
void GSkybox::Draw()
{
    if(_is_inited)
    {
        if(_camera_pos_getter)
        {
            SetTranslate(_camera_pos_getter());
        }

        GLint OldCullFaceMode;
        glGetIntegerv(GL_CULL_FACE_MODE, &OldCullFaceMode);
        GLint OldDepthFuncMode;
        glGetIntegerv(GL_DEPTH_FUNC, &OldDepthFuncMode);

        glCullFace(GL_FRONT);
        glDepthFunc(GL_LEQUAL);

        glUseProgram(_program);
        {
            _cube_tex_obj.Bind(GL_TEXTURE0);

            glUniform1f(_scaleUniformLocal,_scale);
            glUniform4fv(_colorUniformLocal,1,glm::value_ptr(_color));
            glUniform3fv(_moveUniformLocal,1,glm::value_ptr(_translate));
            if(_view_matrix_getter && _viewMatrixUniformLocal!=-1)
            {
                glm::mat4x4 view_matrix;
                _view_matrix_getter(view_matrix);
                glUniformMatrix4fv(_viewMatrixUniformLocal,1,GL_FALSE,glm::value_ptr(view_matrix));
            }
            if(_projection_matrix_getter && _projectionMatrixUniformLocal!=-1)
            {
                glm::mat4x4 projection_matrix;
                _projection_matrix_getter(projection_matrix);
                glUniformMatrix4fv(_projectionMatrixUniformLocal,1,GL_FALSE,glm::value_ptr(projection_matrix));
            }

            glBindVertexArray(_vertex_arr_obj);
            //glDrawElements(GL_TRIANGLES,16,GL_UNSIGNED_INT,BUFF_OFFSET(0));
            glDrawElements(GL_TRIANGLE_STRIP,8,GL_UNSIGNED_INT,BUFF_OFFSET(0));
            glDrawElements(GL_TRIANGLE_STRIP,8,GL_UNSIGNED_INT,BUFF_OFFSET(9*sizeof(GLuint)));
            glBindVertexArray(0);
        }
        glUseProgram(0);

        glCullFace(OldCullFaceMode);
        glDepthFunc(OldDepthFuncMode);
    }
}
Ejemplo n.º 8
0
hsMatrix44 &hsMatrix44::MakeTranslateMat(const hsVector3 *trans)
{
    Reset();
    SetTranslate(trans);
    return *this;
}
Ejemplo n.º 9
0
void TranslateTransform2::SetTranslate(const Point& point)
{
    SetTranslate(new PointValue(point));
}
Ejemplo n.º 10
0
Archivo: App.cpp Proyecto: edvorg/chair
void App::Draw() {
	SetProjection(fieldWidth, fieldHeight);

	SetTranslate(0, 0);
	progress.Draw();

	if (!progress.IsPaused()) {

		// background

		SetTranslate(0, 0);
		shaker.ApplyMatrix();

		drawTexture(texture, backPos, 0, 100, fieldHeight, 1.0f / 100, 1.0f);
		drawTexture(texture, backPos + 100, 0, 100, fieldHeight, 1.0f / 100, 1.0f);

		// debug data

		SetTranslate(25 - camPos, 0);
		shaker.ApplyMatrix();

		world.DrawDebugData();

		// platforms

		drawTexture(bottom,
					borderBodies[0]->GetPosition().x - 100,
					0,
					200,
					8,
					1.0f / fieldWidth * 3.0f,
					1.0f);
		drawTexture(top,
					borderBodies[1]->GetPosition().x - 100,
					fieldHeight - 13,
					200,
					13,
					1 / fieldWidth * 2.0f,
					1.0f);
		drawTexture(bottom,
					borderBodies[2]->GetPosition().x - 100,
					0,
					200,
					8,
					1.0f / fieldWidth * 3.0f,
					1.0f);
		drawTexture(top,
					borderBodies[3]->GetPosition().x - 100,
					fieldHeight - 13,
					200,
					13,
					1 / fieldWidth * 2.0f,
					1.0f);

		// creature

		drawCreature(playerBodiesPoints, b2Color(playerColorRState, playerColorGState, playerColorBState), 1, playerStatePoint);
		drawEyes(playerEyesBodiesPoints, playerBodiesPoints);

		// numbers

		SetTranslate(0, 0);
		shaker.ApplyMatrix();

		DrawNumber(false,
				   fieldWidth - 5.0f,
				   fieldHeight - 10.0f,
				   1,
				   1.5,
				   progress.GetLevel());
	}
}