Pause
This function pauses the application time until Leadwerks::Time::Resume() is called. When the time is updated with a call to Leadwerks::Time::Update(), the time spent in the paused state will be subtracted from the time elapsed.
Syntax
Example
#include "Leadwerks.h"
using namespace Leadwerks;
Model* model = NULL;
bool paused = false;
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 pause and resume timing
if (window->KeyHit(Key::Space))
{
paused = !paused;
if (paused)
{
Leadwerks::Time::Pause();
}
else
{
Leadwerks::Time::Resume();
}
}
model->Turn(0,Leadwerks::Time::GetSpeed(),0);
Leadwerks::Time::Update();
world->Update();
world->Render();
context->SetBlendMode(Blend::Alpha);
context->DrawText("Time: "+String(Leadwerks::Time::GetCurrent()),2,2);
context->DrawText("Millisecs: "+String(Leadwerks::Time::Millisecs()),2,22);
context->Sync();
}
return 0;
}