Changeset 7358 for code/branches/notifications
- Timestamp:
- Sep 5, 2010, 10:26:37 PM (14 years ago)
- Location:
- code/branches/notifications
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/notifications/data/gui/scripts/KeyBindMenu.lua
r7163 r7358 113 113 return "Joystick " .. name 114 114 elseif( string.find(group, "JoyStickAxes") ~= nil ) then 115 return "Joystick Axis " .. string.sub(name, 5, 6) .. string.sub(name, string.find(name, 'Axis%d%d(.*)')+6)115 return "Joystick Axis " .. string.sub(name, 5, 6) .. string.sub(name, string.find(name, 'Axis%d%d(.*)')+6) 116 116 elseif( group == "MouseAxes" ) then 117 117 return "Mouse " .. string.sub(name, string.find(name, '.(.*)')+1) .. " " .. string.sub(name, 1, 1) .. "-Axis" -
code/branches/notifications/data/levels/tutorial.oxw
r7354 r7358 19 19 > 20 20 21 <CommandNotification preMessage=" Press '" postMessage="' to fire your primary weapon." command="fire 0">21 <CommandNotification preMessage="Move '" postMessage="' to look left." command="scale 1 rotateYaw"> 22 22 <events> 23 23 <trigger> -
code/branches/notifications/src/modules/notifications/dispatchers/CommandNotification.cc
r7285 r7358 38 38 #include "core/input/KeyBinderManager.h" 39 39 #include "core/input/KeyBinder.h" 40 #include "util/SubString.h" 40 41 41 42 #include <sstream> … … 88 89 std::stringstream stream; 89 90 stream << this->getPreMessage(); 90 //TODO: Add niceifyer. 91 stream << KeyBinderManager::getInstance().getCurrent()->getBinding(this->getCommand()); 91 stream << this->bindingNiceifyer(KeyBinderManager::getInstance().getCurrent()->getBinding(this->getCommand())); 92 92 stream << this->getPostMessage(); 93 std::string* message = new std::string(stream.str()); 94 return *message; 93 return *(new std::string(stream.str())); 94 } 95 96 /** 97 @brief 98 Transforms the input binding into a human readable form. 99 @param binding 100 The binding to be transformed 101 @return 102 Returns a human readable version of the input binding. 103 */ 104 const std::string& CommandNotification::bindingNiceifyer(const std::string& binding) 105 { 106 SubString* string = new SubString(binding, '.'); 107 std::string name = string->getString(1); 108 std::string group = string->getString(0); 109 110 std::stringstream stream; 111 if(group.compare("Keys") == 0) 112 stream << "Key " << name.substr(3); 113 else if(group.compare("MouseButtons") == 0) 114 stream << "Mouse " << name; 115 else if(group.compare("JoyStickButtons") == 0) 116 stream << "Joystick " << name; 117 else if(group.compare("JoyStickAxes") == 0) 118 stream << "Joystick Axis" << name.substr(5, 6) << name.substr(name.find("Axis")+6); 119 else if(group.compare("MouseAxes") == 0) 120 stream << "Mouse " << name.substr(1,3) << " " << name.substr(0, 1) << "-Axis"; 121 else 122 stream << binding; 123 124 delete string; 125 return *(new std::string(stream.str())); 95 126 } 96 127 -
code/branches/notifications/src/modules/notifications/dispatchers/CommandNotification.h
r7285 r7358 104 104 { this->postMessage_ = message; } 105 105 106 const std::string& bindingNiceifyer(const std::string& binding); 107 106 108 }; 107 109
Note: See TracChangeset
for help on using the changeset viewer.