本文整理汇总了C++中Level::drawHUD方法的典型用法代码示例。如果您正苦于以下问题:C++ Level::drawHUD方法的具体用法?C++ Level::drawHUD怎么用?C++ Level::drawHUD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level
的用法示例。
在下文中一共展示了Level::drawHUD方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
//.........这里部分代码省略.........
Sampler samplerScreenquad(Sampler::MinLinear, Sampler::MagLinear, Sampler::ClampToEdge);
ShaderProgram *screenShader = Registry::shaders["screen"];
bool running = true;
bool titleScreen = true;
float currentTime = glfwGetTime();
level.init();
while (running) {
float dt = glfwGetTime() - currentTime;
currentTime = glfwGetTime();
input.poll();
if (glfwWindowShouldClose(window) || input.keyWasPressed(InputHandler::Quit))
running = false;
update(dt);
float speed = level.getShipSpeed();
tp.perspectiveProjection(58 + speed * 0.9, width, height, 0.1f, 100000);
if (speed > 0.1) {
titleScreen = false;
}
framebuffer.bind(Framebuffer::DrawFramebuffer);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
draw(tp);
framebuffer.unbind(Framebuffer::DrawFramebuffer);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_CULL_FACE);
postprocessShader.bind();
postprocessShader["u_ViewMatrix"].setMatrix4(tp.getViewMatrix());
postprocessShader["u_ProjectionMatrix"].setMatrix4(tp.getProjectionMatrix());
samplerScreenquad.bind(1);
gbufferDiffuse.bind(1);
samplerScreenquad.bind(2);
gbufferDepth.bind(2);
Registry::screenQuad->bind();
Registry::screenQuad->drawElements();
Registry::screenQuad->unbind();
postprocessShader.unbind();
glClear(GL_DEPTH_BUFFER_BIT);
level.drawHUD(width, height);
glEnable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
screenShader->bind();
samplerScreenquad.bind(1);
Registry::screenQuad->bind();
if (titleScreen) {
Registry::textures["screen-title"]->bind(1);
Registry::screenQuad->drawElements();
Registry::textures["screen-level"]->bind(1);
Registry::screenQuad->drawElements();
Registry::textures["screen-controls"]->bind(1);
Registry::screenQuad->drawElements();
} else if (level.isDead()) {
if (level.hasCrashed()) {
Registry::textures["screen-crashed"]->bind(1);
Registry::screenQuad->drawElements();
} else {
Registry::textures["screen-timeout"]->bind(1);
Registry::screenQuad->drawElements();
}
Registry::textures["screen-level"]->bind(1);
Registry::screenQuad->drawElements();
} else if (level.isWin()) {
Registry::textures["screen-won"]->bind(1);
Registry::screenQuad->drawElements();
Registry::textures["screen-level"]->bind(1);
Registry::screenQuad->drawElements();
}
Registry::screenQuad->unbind();
screenShader->unbind();
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glfwSwapBuffers(window);
}
Audio::cleanup();
glfwDestroyWindow(window);
glfwTerminate();
}