void HexagonGame::drawText() { ostringstream s; s << "time: " << toStr(status.currentTime).substr(0, 5) << "\n"; if(levelStatus.tutorialMode) s << "tutorial mode" << "\n"; else if(Config::getOfficial()) s << "official mode" << "\n"; if(Config::getDebug()) s << "debug mode" << "\n"; if(levelStatus.swapEnabled) s << "swap enabled" << "\n"; if(Config::getInvincible()) s << "invincibility on" << "\n"; if(status.scoreInvalid) s << "score invalidated (performance issues)" << "\n"; if(status.hasDied) s << "press r to restart" << "\n"; if(Config::getShowFPS()) s << "FPS: " << window.getFPS() << "\n"; const auto& trackedVariables(levelStatus.trackedVariables); if(Config::getShowTrackedVariables() && !trackedVariables.empty()) { s << "\n"; for(const auto& t : trackedVariables) { if(!lua.doesVariableExist(t.variableName)) continue; string var{lua.readVariable<string>(t.variableName)}; s << t.displayName << ": " << var << "\n"; } } s.flush(); const Vec2f pos{15, 3}; const vector<Vec2f> offsets{{-1, -1}, {-1, 1}, {1, -1}, {1, 1}}; Color offsetColor{getColor(1)}; if(Config::getBlackAndWhite()) offsetColor = Color::Black; text.setString(s.str()); text.setCharacterSize(25 / Config::getZoomFactor()); text.setOrigin(0, 0); text.setColor(offsetColor); for(const auto& o : offsets) { text.setPosition(pos + o); render(text); } text.setColor(getColorMain()); text.setPosition(pos); render(text); if(messageText.getString() == "") return; messageText.setOrigin(getGlobalWidth(messageText) / 2.f, 0); messageText.setColor(offsetColor); for(const auto& o : offsets) { messageText.setPosition(Vec2f{Config::getWidth() / 2.f, Config::getHeight() / 6.f} + o); render(messageText); } messageText.setColor(getColorMain()); render(messageText); }
/** * This private method active attribute sizewindow * * * \param wHeight Height of window * \param wWidth Width of window * */ void DiVADisplay::onSizeWindow(unsigned int wHeight, unsigned int wWidth) { this->sizeWindow = true; float w1 = (float)getGlobalWidth(); float h1 = (float)getGlobalHeight(); float w2,h2; w2=w1; h2=h1; if (w1>wWidth) { w2 = (float)wWidth; h2 = h1*(wWidth/w1); } if (h2>h1) { h2 = (float)h1; w2 = w2*(h1/h2); } int he= (int)ceil(h2); int wi= (int)ceil(w2); this->wHeight = he; this->wWidth = wi; this->update = false; }