Exemplo n.º 1
0
	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);
		}
	}
Exemplo n.º 2
0
	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);
		}
	}
Exemplo n.º 3
0
	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);
		}
	}
Exemplo n.º 4
0
	bool continue_running(const example_state_view& state)
	override
	{
		return state.user_idle_time() < seconds_(20);
	}
Exemplo n.º 5
0
	seconds_t<float> user_activity_time(void) const
	noexcept
	{	
		return seconds_(_usr_act_time);
	}
Exemplo n.º 6
0
	seconds_t<float> exec_time(void) const
	noexcept
	{
		return seconds_(_new_time);
	}
Exemplo n.º 7
0
	seconds_t<float> frame_duration(void) const
	noexcept
	{
		return seconds_(_new_time - _old_time);
	}