本文整理汇总了C++中Render类的典型用法代码示例。如果您正苦于以下问题:C++ Render类的具体用法?C++ Render怎么用?C++ Render使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Render类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char* args[] )
{
Render render;
render.init();
int i = 0;
while(render.running)
{
render.event();
render.draw();
if((render.checkNow)&&(i == render.speed))
{
render.check();
}
i++;
if(i > render.speed) i = 0;
}
//Quit SDL
SDL_Quit();
return 0;
}
示例2: translateQuad
/*! jesli widoczny to go narysuje
*/
void SpriteCmp::draw( Entity e , const ShapeDef& shapeDef)
{
SpriteInfo * spriteInfo = 0;
if(e.getId() == 0)
{
spriteInfo = &untexturedSprite;
}else{
spriteInfo = BaseType::get( e );
if( ! spriteInfo ) return;
}
Render * r = game->getRender();
if( spriteInfo->visible )
{
Vec2Quad shape;
translateQuad( shapeDef.rect, shapeDef.pos, &shape );
if(shapeDef.angle)
rotateQuad(shape,shapeDef.angle,shapeDef.pos,&shape);
r->drawAtlas( spriteInfo->tex,
spriteInfo->textureNumber, shape,
Render::CoordSpace_e( spriteInfo->coordSpace ),
spriteInfo->color,
shapeDef.depth );
}
}
示例3: TEST
TEST(Render, DefaultBackgroundModeWithNonzeroTransparentIndex)
{
Document* doc = new Document;
doc->sprites().add(Sprite::createBasicSprite(ImageSpec(ColorMode::INDEXED, 2, 2)));
doc->sprite()->setTransparentColor(2); // Transparent color is index 2
EXPECT_TRUE(!doc->sprite()->root()->firstLayer()->isBackground());
Image* src = doc->sprite()->root()->firstLayer()->cel(0)->image();
clear_image(src, 2);
put_pixel(src, 1, 1, 1);
std::unique_ptr<Image> dst(Image::create(IMAGE_INDEXED, 2, 2));
clear_image(dst.get(), 1);
EXPECT_2X2_PIXELS(dst.get(), 1, 1, 1, 1);
Render render;
render.renderSprite(dst.get(), doc->sprite(), frame_t(0));
EXPECT_2X2_PIXELS(dst.get(), 2, 2, 2, 1); // Indexed transparent
dst.reset(Image::create(IMAGE_RGB, 2, 2));
clear_image(dst.get(), 1);
EXPECT_2X2_PIXELS(dst.get(), 1, 1, 1, 1);
render.renderSprite(dst.get(), doc->sprite(), frame_t(0));
color_t c1 = doc->sprite()->palette(0)->entry(1);
EXPECT_NE(0, c1);
EXPECT_2X2_PIXELS(dst.get(), 0, 0, 0, c1); // RGB transparent
}
示例4: RenderOnScreen
void SpriteRenderer::RenderOnScreen()
{
Render* render = Render::getInstance();
int drawX = static_cast<int>(entity->GetTransform()->GetPoint().GetX()) - (width / 2);
int drawY = static_cast<int>(window->GetBox().GetHeight()) - (static_cast<int>(entity->GetTransform()->GetPoint().GetY()) + (height / 2));
render->DrawTextureToScreen(image, window, drawX, drawY, width, height, imageCrop.GetX(), imageCrop.GetY(), imageCrop.GetWidth(), imageCrop.GetHeight(), entity->GetTransform()->GetRotation());
}
示例5:
void pymms::gui::GUIWindowManager::__render()
{
Render* pRenderer = S_Render::get_instance();
GUIWindow* pWindow = (!m_vecWindows.empty()?m_vecWindows.front():0);
if(pWindow && pWindow->getActive())
{
if(!pWindow->getOverlay())
{
pRenderer->prepare_new_image();
pWindow->render();
pRenderer->draw_and_release("Window");
}
else
{
pRenderer->wait_and_aquire();
if (m_windowOverlay.elements.size() > 0)
m_windowOverlay.partial_cleanup();
pWindow->render(&m_windowOverlay);
pRenderer->draw_and_release("Window", true);
}
}
}
示例6: lock
void pymms::gui::GUIWindowManager::unregisterWindow(GUIWindow* pWindow)
{
ost::MutexLock lock(m_windowManagerLock);
Render* pRenderer = S_Render::get_instance();
for (std::vector<GUIWindow*>::iterator i = m_vecWindows.begin(),
end = m_vecWindows.end(); i != end; i++) {
if((*i) == pWindow)
{
if(pWindow->getOverlay())
{
pRenderer->wait_and_aquire();
m_windowOverlay.cleanup();
pRenderer->image_mut.leaveMutex();
}
m_vecWindows.erase(i);
pWindow->setActive(false);
GUIWindow* pFrontWindow = (!m_vecWindows.empty()?m_vecWindows.front():0);
if(pFrontWindow)
pFrontWindow->setActive(true);
__render();
return;
}
}
}
示例7:
TrackballMaterial::~TrackballMaterial(){
Render* r = Application::instance()->getRender();
if (il)
r->deleteIL(il);
if (shader)
r->deleteShader(shader);
}
示例8: QLabel
RenderPanel::RenderPanel(CommandQueue *c, MainWindow *mw)
{
cmdq = c;
fundolb = new QLabel(this);
screenW = 750;
screenH = 550;
Render *r = new Render(screenW, screenH, c);
connect(r, SIGNAL(renderizado(const QImage &)), this, SLOT(update(const QImage &)), Qt::QueuedConnection);
connect(r, SIGNAL(feedBackBondary(bool)),this, SLOT(feedBackBondary(bool)));
connect(this, SIGNAL(atualizaTamanho(int, int)), r, SLOT(updateScreen(int, int)), Qt::QueuedConnection);
connect(this, SIGNAL(enviaArquivo(const QString &)), r, SLOT(recebeArquivo(const QString &)), Qt::QueuedConnection);
QImage tmp(screenW, screenH,QImage::Format_ARGB32_Premultiplied);
QPainter p;
p.begin(&tmp);
p.fillRect(tmp.rect(), Qt::white);
p.end();
fundolb->setPixmap(QPixmap::fromImage(tmp));
fundolb->show();
m_mw = mw;
repaint();
r->start();
}
示例9: forNode
void forNode(Node *node){
Render *render = newRender();
if(render){
forNodeDrv(node,render);
render->destroy(render);
}
}
示例10: Draw
void UITexture::Draw(Render& p) {
p.Box(0, 0, this->W, this->H, this->BackgroundColor);
if (this->TextureHandle == 0) return;
p.SetTexture(this->TextureHandle);
p.PutTexture(0, 0, (float)this->W, (float)this->H, this->TextureStart.X, this->TextureStart.Y, this->TextureEnd.X, this->TextureEnd.Y, this->DrawColor);
}
示例11: Draw
void UIDropDown::Draw(Render& p) {
p.Box(0, 0, this->W, this->H, this->BorderColor);
p.Box(1, 1, this->W - 2, this->H - 2, this->BackColor);
Vector2 apos = this->GetAbsoluteLocation();
p.SetDrawingOffset((int)apos.X + 2, (int)apos.Y);
UILabel::Draw(p);
}
示例12: return
void *Render::run(void *data)
{
Render *render = (Render*) data;
(void)data;
render->setImg();
render->sfmlLaunch();
return (NULL);
}
示例13: RE_engine_test_break
int RE_engine_test_break(RenderEngine *engine)
{
Render *re = engine->re;
if (re)
return re->test_break(re->tbh);
return 0;
}
示例14: RE_engine_update_result
void RE_engine_update_result(RenderEngine *engine, RenderResult *result)
{
Render *re = engine->re;
if (result) {
result->renlay = result->layers.first; /* weak, draws first layer always */
re->display_update(re->duh, result, NULL);
}
}
示例15: RE_engine_update_progress
void RE_engine_update_progress(RenderEngine *engine, float progress)
{
Render *re = engine->re;
if (re) {
CLAMP(progress, 0.0f, 1.0f);
re->progress(re->prh, progress);
}
}