Exemplo n.º 1
0
void KeyboardShortcut::interpret(const std::string& as, ShortcutMode mode)
{
	std::string s = as;
	std::string left = std::string(s, 0, s.find(">=")+1);
	std::string right = std::string(s, s.find(">=")+2, std::string::npos);
	while(left.find(">-") != std::string::npos)
	{
		size_t end = left.find(">-");
		KeyPress kp;
		kp.interpret(left.substr(0, end+1));
		keys.push_back(kp);
		left=left.substr(end+2, std::string::npos);
	}
	
	//Add the key that isn't seperated by a -
	KeyPress kp;
	kp.interpret(left);
	keys.push_back(kp);
	
	if(mode == GameGUIShortcuts)
		action = GameGUIKeyActions::getAction(right);
	if(mode == MapEditShortcuts)
		action = MapEditKeyActions::getAction(right);
}