equal
deleted
inserted
replaced
119 end; |
119 end; |
120 end; |
120 end; |
121 |
121 |
122 // Takes a control name (e.g. 'quit') and returns the corresponding |
122 // Takes a control name (e.g. 'quit') and returns the corresponding |
123 // human-readable key name from SDL. |
123 // human-readable key name from SDL. |
124 // FIXME: Does not work 100% for all keys yet, but at least it no |
|
125 // longer hardcodes any key name. |
|
126 // TODO: Localize |
124 // TODO: Localize |
127 function KeyBindToName(bind: shortstring): shortstring; |
125 function KeyBindToName(bind: shortstring): shortstring; |
128 var code: LongInt; |
126 var code: LongInt; |
129 name: shortstring; |
127 name: shortstring; |
130 begin |
128 begin |
139 KeyBindToName:= 'Esc' |
137 KeyBindToName:= 'Esc' |
140 else if (length(name) <> 0) then |
138 else if (length(name) <> 0) then |
141 KeyBindToName:= name |
139 KeyBindToName:= name |
142 else |
140 else |
143 begin |
141 begin |
144 WriteLnToConsole('Error: KeyBindToName('+bind+') failed to find SDL key name!'); |
142 if KeyNames[code] <> '' then |
145 KeyBindToName:= trmsg[sidUnknownKey]; |
143 // Return Hedgewars internal key name if SDL key name is empty |
|
144 KeyBindToName:= KeyNames[code] |
|
145 else |
|
146 begin |
|
147 WriteLnToConsole('Error: KeyBindToName('+bind+'): Hedgewars does not have internal key name for given bind!'); |
|
148 KeyBindToName:= trmsg[sidUnknownKey]; |
|
149 end; |
146 end; |
150 end; |
147 end; |
151 end; |
148 end; |
152 end; |
149 |
153 |
150 (* |
154 (* |