GetTime

This function gets a source's current time.

Syntax

Returns

Returns the source's current time, in seconds.

Example

#include "Leadwerks.h"

using namespace Leadwerks;

Source* source = NULL;

int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
//Load a sound
Sound* sound = Sound::Load("Sound/Music/menutheme.wav");

source = Source::Create();
source->SetSound(sound);
sound->Release();
source->SetLoopMode(true);
source->Play();

while (true)
{
//Press space key to pause/resume sound
if (window->KeyHit(Key::Space))
{
if (source->GetState() == Source::Paused)
{
source->Resume();
}
else
{
source->Pause();
}
}

if (window->Closed() || window->KeyDown(Key::Escape)) return false;
Leadwerks::Time::Update();
context->SetColor(0,0,0,0);
context->Clear();

context->SetColor(1,1,1,0);
context->SetBlendMode(Blend::Alpha);
context->DrawText("Time: "+String(source->GetTime()),2,2);
}
return 0;
}