GetSpeed

This function returns the application speed. The application speed is a value which can be used to modulate time-dependent variables to make actions occur at the same speed, regardless of frame rate.

Syntax

Returns

Returns the application speed.

Example

#include "Leadwerks.h"

using namespace Leadwerks;

Model* model = NULL;

int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = World::Create();
Camera* camera = Camera::Create();
camera->Move(0,0,-3);
Light* light = DirectionalLight::Create();
light->SetRotation(35,35,0);

model = Model::Box();
model->SetColor(0.0,0.0,1.0);

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;

//Press the space key to stop the program for one second
if (window->KeyHit(Key::Space)) Leadwerks::Time::Delay(1000);

model->Turn(0,Leadwerks::Time::GetSpeed(),0);

Leadwerks::Time::Update();
world->Update();
world->Render();

context->SetBlendMode(Blend::Alpha);
context->DrawText("Speed: "+String(Leadwerks::Time::GetSpeed()),2,2);

context->Sync();
}
return 0;
}