bool j1Console::OnCommand(const Command* command, const p2DynArray<p2SString>& arguments, p2SString& return_message) { bool ret = true; if(command == quit) { App->Quit(); return_message.create("Bye!"); } else if(command == list) { return_message.create("Commands: "); uint size = commands.Count(); for(uint i = 0; i < size; ++i) { return_message += commands[i].name; if(i < size - 1) return_message += ", "; } return_message += "\nCvars: "; size = cvars.Count(); for(uint i = 0; i < size; ++i) { return_message += cvars[i].name; if(i < size - 1) return_message += ", "; } } return ret; }
//GuiLabel Functions void GuiLabel::SetText(p2SString t) { if (tex) SDL_DestroyTexture(tex); text = t.GetString(); tex = App->font->Print(text.GetString()); uint w, h; App->tex->GetSize(tex, w, h); SetSize(w, h); }
void fCVar::SetValueToFloat(p2SString& value) { fValue = atof(value.GetString()); }
fCVar::fCVar(p2SString& sValue) : CVar(sValue) { fValue = atof(sValue.GetString()); }
CVar::CVar(const p2SString& nameIdentifier) { sValue.create(nameIdentifier.GetString()); }
void iCVar::SetValueToInt(p2SString& value) { iValue = atoi(value.GetString()); }
iCVar::iCVar(p2SString& sValue) : CVar(sValue) { iValue = atoi(sValue.GetString()); }