mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-04 20:57:49 +00:00
GEEKING
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
#include "stdafx.h"
|
||||
#include "Gui/EquationDisplay.h"
|
||||
#include "Util/IMetric.h"
|
||||
|
||||
namespace RBX {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// EquationDisplay
|
||||
//
|
||||
|
||||
EquationDisplay::EquationDisplay(
|
||||
const std::string& title,
|
||||
const std::string& eqText)
|
||||
:
|
||||
TextDisplay(title, title),
|
||||
equation(eqText)
|
||||
{}
|
||||
|
||||
|
||||
EquationDisplay::EquationDisplay(
|
||||
const std::string& title,
|
||||
const std::string& label,
|
||||
const std::string& eqText)
|
||||
: TextDisplay(title, label)
|
||||
, equation(eqText)
|
||||
{}
|
||||
|
||||
|
||||
std::string EquationDisplay::getLabel() const
|
||||
{
|
||||
const Instance* root = Instance::getRootAncestor(this);
|
||||
const IMetric* metric = dynamic_cast<const IMetric*>(root);
|
||||
if (metric) {
|
||||
RBXASSERT(metric);
|
||||
std::string answer = metric->getMetric(equation);
|
||||
return label + " " + answer;
|
||||
}
|
||||
else {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
void EquationDisplay::render2d(Adorn* adorn)
|
||||
{
|
||||
if (isVisible())
|
||||
{
|
||||
label2d(
|
||||
adorn,
|
||||
getLabel(),
|
||||
fontColor,
|
||||
borderColor,
|
||||
align);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user