mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 19:10:06 +00:00
Sweep time fix
This commit is contained in:
parent
4e61f82c5d
commit
adde167899
1 changed files with 9 additions and 8 deletions
|
|
@ -41,6 +41,7 @@ public:
|
||||||
vbo_ {GL_INVALID_INDEX},
|
vbo_ {GL_INVALID_INDEX},
|
||||||
vao_ {GL_INVALID_INDEX},
|
vao_ {GL_INVALID_INDEX},
|
||||||
texture_ {GL_INVALID_INDEX},
|
texture_ {GL_INVALID_INDEX},
|
||||||
|
sweepTimeString_ {},
|
||||||
sweepTimeNeedsUpdate_ {true}
|
sweepTimeNeedsUpdate_ {true}
|
||||||
{
|
{
|
||||||
// TODO: Manage font at the global level, texture at the view level
|
// TODO: Manage font at the global level, texture at the view level
|
||||||
|
|
@ -59,6 +60,7 @@ public:
|
||||||
GLuint vao_;
|
GLuint vao_;
|
||||||
GLuint texture_;
|
GLuint texture_;
|
||||||
|
|
||||||
|
std::string sweepTimeString_;
|
||||||
bool sweepTimeNeedsUpdate_;
|
bool sweepTimeNeedsUpdate_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -131,8 +133,6 @@ void OverlayLayer::render(const QMapbox::CustomLayerRenderParameters& params)
|
||||||
{
|
{
|
||||||
gl::OpenGLFunctions& gl = p->gl_;
|
gl::OpenGLFunctions& gl = p->gl_;
|
||||||
|
|
||||||
static std::string sweepTimeString;
|
|
||||||
|
|
||||||
if (p->sweepTimeNeedsUpdate_)
|
if (p->sweepTimeNeedsUpdate_)
|
||||||
{
|
{
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
|
|
@ -144,7 +144,7 @@ void OverlayLayer::render(const QMapbox::CustomLayerRenderParameters& params)
|
||||||
zoned_time zt = {current_zone(), sweepTime};
|
zoned_time zt = {current_zone(), sweepTime};
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << zt;
|
os << zt;
|
||||||
sweepTimeString = os.str();
|
p->sweepTimeString_ = os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
p->sweepTimeNeedsUpdate_ = false;
|
p->sweepTimeNeedsUpdate_ = false;
|
||||||
|
|
@ -160,10 +160,11 @@ void OverlayLayer::render(const QMapbox::CustomLayerRenderParameters& params)
|
||||||
gl.glUniformMatrix4fv(
|
gl.glUniformMatrix4fv(
|
||||||
p->uMVPMatrixLocation_, 1, GL_FALSE, glm::value_ptr(projection));
|
p->uMVPMatrixLocation_, 1, GL_FALSE, glm::value_ptr(projection));
|
||||||
|
|
||||||
if (sweepTimeString.length() > 0)
|
if (p->sweepTimeString_.length() > 0)
|
||||||
{
|
{
|
||||||
const float fontSize = 16.0f;
|
const float fontSize = 16.0f;
|
||||||
const float textLength = p->font_->TextLength(sweepTimeString, fontSize);
|
const float textLength =
|
||||||
|
p->font_->TextLength(p->sweepTimeString_, fontSize);
|
||||||
|
|
||||||
// Upper right panel vertices
|
// Upper right panel vertices
|
||||||
const float vertexLX =
|
const float vertexLX =
|
||||||
|
|
@ -186,7 +187,7 @@ void OverlayLayer::render(const QMapbox::CustomLayerRenderParameters& params)
|
||||||
gl.glDrawArrays(GL_TRIANGLES, 0, 6);
|
gl.glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||||
|
|
||||||
// Render time
|
// Render time
|
||||||
p->textShader_.RenderText(sweepTimeString,
|
p->textShader_.RenderText(p->sweepTimeString_,
|
||||||
params.width - 7.0f,
|
params.width - 7.0f,
|
||||||
static_cast<float>(params.height) -
|
static_cast<float>(params.height) -
|
||||||
16.0f, // 7.0f,
|
16.0f, // 7.0f,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue