本文整理汇总了C++中NativeWindow::getHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ NativeWindow::getHeight方法的具体用法?C++ NativeWindow::getHeight怎么用?C++ NativeWindow::getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NativeWindow
的用法示例。
在下文中一共展示了NativeWindow::getHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createWindow
ANKI_TEST(Ui, Ui)
{
Config cfg;
initConfig(cfg);
cfg.set("window.vsync", 1);
cfg.set("window.debugContext", 0);
cfg.set("width", 1024);
cfg.set("height", 760);
cfg.set("rsrc.dataPaths", "engine_data");
NativeWindow* win = createWindow(cfg);
Input* in = new Input();
GrManager* gr = createGrManager(cfg, win);
PhysicsWorld* physics;
ResourceFilesystem* fs;
ResourceManager* resource = createResourceManager(cfg, gr, physics, fs);
UiManager* ui = new UiManager();
ANKI_TEST_EXPECT_NO_ERR(in->init(win));
StagingGpuMemoryManager* stagingMem = new StagingGpuMemoryManager();
ANKI_TEST_EXPECT_NO_ERR(stagingMem->init(gr, cfg));
HeapAllocator<U8> alloc(allocAligned, nullptr);
ANKI_TEST_EXPECT_NO_ERR(ui->init(allocAligned, nullptr, resource, gr, stagingMem, in));
{
FontPtr font;
ANKI_TEST_EXPECT_NO_ERR(ui->newInstance(font, "UbuntuRegular.ttf", std::initializer_list<U32>{10, 20, 30, 60}));
CanvasPtr canvas;
ANKI_TEST_EXPECT_NO_ERR(ui->newInstance(canvas, font, 20, win->getWidth(), win->getHeight()));
IntrusivePtr<Label> label;
ANKI_TEST_EXPECT_NO_ERR(ui->newInstance(label));
Bool done = false;
while(!done)
{
ANKI_TEST_EXPECT_NO_ERR(in->handleEvents());
HighRezTimer timer;
timer.start();
canvas->handleInput();
if(in->getKey(KeyCode::ESCAPE))
{
done = true;
}
canvas->beginBuilding();
label->build(canvas);
TexturePtr presentTex = gr->acquireNextPresentableTexture();
FramebufferPtr fb;
{
TextureViewInitInfo init;
init.m_texture = presentTex;
TextureViewPtr view = gr->newTextureView(init);
FramebufferInitInfo fbinit;
fbinit.m_colorAttachmentCount = 1;
fbinit.m_colorAttachments[0].m_clearValue.m_colorf = {{1.0, 0.0, 1.0, 1.0}};
fbinit.m_colorAttachments[0].m_textureView = view;
fb = gr->newFramebuffer(fbinit);
}
CommandBufferInitInfo cinit;
cinit.m_flags = CommandBufferFlag::GRAPHICS_WORK | CommandBufferFlag::SMALL_BATCH;
CommandBufferPtr cmdb = gr->newCommandBuffer(cinit);
cmdb->setTextureBarrier(presentTex,
TextureUsageBit::NONE,
TextureUsageBit::FRAMEBUFFER_ATTACHMENT_WRITE,
TextureSubresourceInfo());
cmdb->beginRenderPass(fb, {{TextureUsageBit::FRAMEBUFFER_ATTACHMENT_WRITE}}, {});
canvas->appendToCommandBuffer(cmdb);
cmdb->endRenderPass();
cmdb->setTextureBarrier(presentTex,
TextureUsageBit::FRAMEBUFFER_ATTACHMENT_WRITE,
TextureUsageBit::PRESENT,
TextureSubresourceInfo());
cmdb->flush();
gr->swapBuffers();
stagingMem->endFrame();
timer.stop();
const F32 TICK = 1.0 / 30.0;
if(timer.getElapsedTime() < TICK)
{
HighRezTimer::sleep(TICK - timer.getElapsedTime());
}
}
}
delete ui;
//.........这里部分代码省略.........