MCPcopy Create free account
hub / github.com/Aloshi/EmulationStation / resolveExp

Method resolveExp

src/components/ThemeComponent.cpp:323–336  ·  view source on GitHub ↗

takes a string containing a mathematical expression (possibly including variables) and resolves it to a float value

Source from the content-addressed store, hash-verified

321
322//takes a string containing a mathematical expression (possibly including variables) and resolves it to a float value
323float ThemeComponent::resolveExp(std::string str, float defaultVal)
324{
325 if(str.empty())
326 return defaultVal;
327
328 MathExp exp;
329 exp.setExpression(str);
330
331 //set variables
332 exp.setVariable("headerHeight", (float)(FONT_SIZE_LARGE / Renderer::getScreenHeight()));
333 exp.setVariable("infoWidth", mFloatMap["listOffsetX"]);
334
335 return exp.eval();
336}
337
338//takes a string of hex and resolves it to an integer
339unsigned int ThemeComponent::resolveColor(std::string str, unsigned int defaultColor)

Callers

nothing calls this directly

Calls 5

setExpressionMethod · 0.80
setVariableMethod · 0.80
evalMethod · 0.80
getScreenHeightFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected