paul.w Posted April 29, 2014 Share Posted April 29, 2014 Hi How do I display text that can change (get its value from a variable ) with this size using a ttf font; see images: It MUST be allways in front of anything like setOrder(100); Link to comment
azagniy Posted May 8, 2014 Share Posted May 8, 2014 Hi paul. Make sure that your widget was added in to gui later than other widgets. And yours widget will be always in front. To change text or size using ttf font see the simple sample: #include <unigine.h> WidgetLabel label; Gui gui; float time = 0.0f; float size = 15.0f; int init() { gui = engine.getGui(); label = new WidgetLabel(gui,""); label.setFontOutline(true); label.setFont("core/gui/fontbi.ttf"); gui.addChild(label,GUI_ALIGN_CENTER); return 1; } int shutdown() { delete label; return 1; } int update() { float ifps = engine.game.getIFps(); time += ifps; int s = time % 60.0f; int m = (time / 60.0f) % 60.0f; size = (size > 40.0f) ? 15.0f : size + ifps * 25.0f; label.setFontSize(ceil(size)); label.setText(format("%i:%i",m,s)); return 1; } Link to comment
Recommended Posts