void BTStatBlock::draw(BTDisplay &d, int x, int y, ObjectSerializer *pc) { int xMult, yMult; SDL_Rect dst; d.getMultiplier(xMult, yMult); dst.x = (x + position.x) * xMult; dst.y = (y + position.y) * yMult; dst.w = position.w * xMult; dst.h = position.h * yMult; XMLAction *state = pc->find(attribute, NULL); if (state) { switch(state->getType()) { case XMLTYPE_BOOL: if (*(reinterpret_cast<bool*>(state->object))) d.drawFont("true", dst, d.getBlack(), (BTDisplay::alignment)align); else d.drawFont("false", dst, d.getBlack(), (BTDisplay::alignment)align); break; case XMLTYPE_INT: if (state->data) { d.drawFont(reinterpret_cast<ValueLookup*>(state->data)->getName(*(reinterpret_cast<int*>(state->object))).c_str(), dst, d.getBlack(), (BTDisplay::alignment)align); } else { int val = *(reinterpret_cast<int*>(state->object)) + modifier; if (negate) val *= -1; if ((maxValue != -1) && (maxValue < val)) { d.drawFont(overflow, dst, d.getBlack(), (BTDisplay::alignment)align); } else { char tmp[40]; snprintf(tmp, 40, "%d", val); d.drawFont(tmp, dst, d.getBlack(), (BTDisplay::alignment)align); } } break; case XMLTYPE_UINT: { /* char tmp[40]; snprintf(tmp, 40, "%u", *(reinterpret_cast<unsigned int*>(state->object))); line.back() += tmp;*/ break; } case XMLTYPE_STRING: d.drawFont(*(reinterpret_cast<char**>(state->object)), dst, d.getBlack(), (BTDisplay::alignment)align); break; case XMLTYPE_BITFIELD: default: break; } } }
void BTPrint::draw(BTDisplay &d, int x, int y, ObjectSerializer *pc) { int xMult, yMult; SDL_Rect dst; d.getMultiplier(xMult, yMult); dst.x = (x + position.x) * xMult; dst.y = (y + position.y) * yMult; dst.w = position.w * xMult; dst.h = position.h * yMult; d.drawFont(text, dst, d.getBlack(), (BTDisplay::alignment)align); }