本文整理汇总了C++中SurfacePtr::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ SurfacePtr::draw方法的具体用法?C++ SurfacePtr::draw怎么用?C++ SurfacePtr::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SurfacePtr
的用法示例。
在下文中一共展示了SurfacePtr::draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
}
t += 30;
//ray_length = sin(t/1000.0f);
buffer[buffer_pos % buffer.size()] = pos;
buffer_pos += 1;
Display::push_framebuffer(framebuffer);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (true)
{
if (false)
{
for(size_t i = 0; i < std::min(buffer_pos, buffer.size()); ++i)
{
size_t idx = (buffer_pos - buffer.size() + i) % buffer.size();
pos = buffer[idx];
float n = static_cast<float>(buffer.size());
if (false)
{ // after image motion blur
n = static_cast<float>(i) / ((n * n + n) / 2.0f);
}
else
{ // simple trail, doesn't fade out
n = 1.0f / n;
}
surface->draw(SurfaceDrawingParameters()
.set_scale(1.0f)
.set_pos(pos - Vector2f(surface->get_width()/2, surface->get_height()/2))
.set_blend_func(GL_SRC_ALPHA, GL_ONE)
.set_color(Color(1.0f, 1.0f, 1.0f, n)));
}
}
else
{
int n = 32;
for(int i = 0; i < n; ++i)
{
surface->draw(SurfaceDrawingParameters()
.set_scale(1.0f)
.set_pos((static_cast<float>(i)/static_cast<float>(n-1)) * pos
+ (static_cast<float>(n-i-1)/static_cast<float>(n-1)) * last_pos
- Vector2f(surface->get_width()/2, surface->get_height()/2))
.set_blend_func(GL_SRC_ALPHA, GL_ONE)
.set_color(Color(1.0f, 1.0f, 1.0f, 1.0f / static_cast<float>(n))));
}
}
}
else
{
int n = 100;
for(int i = 0; i < n; ++i)
{
float scale = 1.0f + static_cast<float>(i) / static_cast<float>(n) * ray_length;
if (true)
surface->draw(SurfaceDrawingParameters()
.set_scale(scale)
.set_pos(Vector2f(512, 288) - Vector2f(surface->get_width()/2 * scale,
surface->get_height()/2 * scale)