本文整理汇总了C++中Time::GetElapsedTime方法的典型用法代码示例。如果您正苦于以下问题:C++ Time::GetElapsedTime方法的具体用法?C++ Time::GetElapsedTime怎么用?C++ Time::GetElapsedTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Time
的用法示例。
在下文中一共展示了Time::GetElapsedTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleTouchBegin
//Touch Input
void UI::HandleTouchBegin(StringHash eventType, VariantMap& eventData)
{
if (inputDisabled_ || consoleVisible_)
return;
using namespace TouchBegin;
int touchId = eventData[P_TOUCHID].GetInt();
int px = eventData[P_X].GetInt();
int py = eventData[P_Y].GetInt();
static double last_time = 0;
static int counter = 1;
Time* t = GetSubsystem<Time>();
double time = t->GetElapsedTime() * 1000;
if (time < last_time + 600)
counter++;
else
counter = 1;
last_time = time;
rootWidget_->InvokePointerDown(px, py, counter, TB_MODIFIER_NONE, true, touchId);
}
示例2: HandleMouseButtonDown
void UI::HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
{
if (inputDisabled_ || consoleVisible_)
return;
using namespace MouseButtonDown;
unsigned button = eventData[P_BUTTON].GetUInt();
IntVector2 pos;
pos = GetSubsystem<Input>()->GetMousePosition();
Input* input = GetSubsystem<Input>();
int qualifiers = input->GetQualifiers();
#ifdef ATOMIC_PLATFORM_WINDOWS
bool superdown = input->GetKeyDown(KEY_LCTRL) || input->GetKeyDown(KEY_RCTRL);
#else
bool superdown = input->GetKeyDown(KEY_LGUI) || input->GetKeyDown(KEY_RGUI);
#endif
MODIFIER_KEYS mod = GetModifierKeys(qualifiers, superdown);
static double last_time = 0;
static int counter = 1;
Time* t = GetSubsystem<Time>();
double time = t->GetElapsedTime() * 1000;
if (time < last_time + 600)
counter++;
else
counter = 1;
last_time = time;
if (button == MOUSEB_RIGHT)
rootWidget_->InvokeRightPointerDown(pos.x_, pos.y_, counter, mod);
else
rootWidget_->InvokePointerDown(pos.x_, pos.y_, counter, mod, false);
}
示例3: FixedUpdate
void CustomLogic::FixedUpdate(float timeStep)
{
if (!mat) return;
#define M_PI 3.14159265358979323846S
float loopPlayTime = 4.0f;
Time* time = GetSubsystem<Time>();
float elapsed = time->GetElapsedTime();
float r = sinf((elapsed / loopPlayTime) * (2 * M_PI)) * 0.5f + 0.25f;
float g = sinf((elapsed / loopPlayTime + 0.33333333f) * 2 * M_PI) * 0.5f + 0.25f;
float b = sinf((elapsed / loopPlayTime + 0.66666666f) * 2 * M_PI) * 0.5f + 0.25f;
float invNorm = 1.0f / (r + g + b);
//r *= invNorm;
//g *= invNorm;
//b *= invNorm;
float d = sin(elapsed / (loopPlayTime / 4.0f)) * 4;
Vector3 rgb(r, g, b);
rgb.Normalize();
mat->SetShaderParameter("ChannelFactor", rgb);
//mat->SetShaderParameter("Displacement", d);
//mat->SetShaderParameter("Range", Vector2(0.0f, 1.0f)); // control ramp texture color
//mat->SetShaderParameter("ClipRange", 1.0f);
}