GetProperty
This function gets a command line property.
Syntax
- static std::string GetProperty(const std::string& key, const std::string defaultvalue="")
Parameters
- key: the name of the property to retrieve.
- defaultvalue: if the specified property is not found, this value will be returned.
Returns
Returns the specified command-line property.
Remarks
A command line property can be specified in the application command line with the following format, where [key] is the name of the property and [value] is the value to set:
+[key] [value]
You can set a property to 1 with the following syntax, where [key] is the name of the property:
-[key]
If the property value has spaces in it, use quotation marks to preserve the spaces:
+somekey "My key value"
You can include multiple properties in the command line:
+scene "Scenes/Start.scene" -fullscreen +screenwidth 1980 +screenheight 1080
Example
#include "Leadwerks.h"
using namespace Leadwerks;
int main(int argc, const char *argv[])
{
std::string propertyname = "fullscreen";
std::string defaultvalue = "1";
System::Print(propertyname+": "+System::GetProperty(propertyname,defaultvalue));
return 0;
}