本文整理汇总了C++中example_state_view::user_idle_time方法的典型用法代码示例。如果您正苦于以下问题:C++ example_state_view::user_idle_time方法的具体用法?C++ example_state_view::user_idle_time怎么用?C++ example_state_view::user_idle_time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类example_state_view
的用法示例。
在下文中一共展示了example_state_view::user_idle_time方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: user_idle
void user_idle(const example_state_view& state)
override
{
if(state.user_idle_time() > seconds_(1))
{
const float t = value(state.frame_duration())*60;
scale *= std::pow(1.f+0.05f*t, scale_dir);
if(scale < min_scale)
{
scale_dir *= -1.f;
ofs_x_dir *= -1.f;
ofs_y_dir *= ofs_x_dir;
scale = min_scale;
}
if(scale > max_scale)
{
scale_dir *= -1.f;
ofs_y_dir *= -1.f;
ofs_x_dir *= ofs_y_dir;
scale = max_scale;
}
offset_x += ofs_x_dir*t*scale/30;
offset_y += ofs_y_dir*t*scale/30;
gl.uniform(prog.offset_loc, offset_x, offset_y);
gl.uniform(prog.scale_loc, scale*aspect, scale);
}
}
示例2: user_idle
void user_idle(const example_state_view& state)
override
{
if(state.user_idle_time() > seconds_(1))
{
const float s = state.frame_duration().value()/5;
mod_cam_orbit(s*cam_dist_dir);
mod_cam_turns(s*cam_turn_dir);
mod_cam_pitch(s*cam_elev_dir);
set_projection(state);
}
}
示例3: user_idle
void user_idle(const example_state_view& state)
override
{
if(state.user_idle_time() > seconds_(1))
{
using namespace eagine::math;
float new_sc = float(smooth_lerp(
min_scale,
max_scale,
value(state.exec_time())*0.4f
));
scale = interpolate_linear(new_sc, scale, 0.9f);
gl.uniform(erg.scale_loc, scale, scale);
}
}
示例4: user_idle
void user_idle(const example_state_view& state)
override
{
if(state.user_idle_time() > seconds_(1))
{
const float s = value(state.frame_duration())*60;
const float dest_offset_x = -0.525929f;
const float dest_offset_y = -0.668547f;
const float c = 0.02f * s;
offset_x = c*dest_offset_x + (1-c)*offset_x;
offset_y = c*dest_offset_y + (1-c)*offset_y;
scale *= (1-0.01f*s);
if(scale < min_scale) scale = min_scale;
gl.uniform(offset_loc, offset_x, offset_y);
gl.uniform(scale_loc, scale*aspect, scale);
}
}
示例5: continue_running
bool continue_running(const example_state_view& state)
override
{
return state.user_idle_time() < seconds_(20);
}