185 //SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450)); |
187 //SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450)); |
186 {$IFDEF IPHONEOS} |
188 {$IFDEF IPHONEOS} |
187 {*MoveCamera is in uWord.pas -- conflicts with other commands*} |
189 {*MoveCamera is in uWord.pas -- conflicts with other commands*} |
188 {*Keys are in uKeys.pas*} |
190 {*Keys are in uKeys.pas*} |
189 SDL_MOUSEBUTTONDOWN: begin |
191 SDL_MOUSEBUTTONDOWN: begin |
|
192 AddFileLog('********************************************* touch down'); |
|
193 |
190 mouseState:= SDL_GetMouseState(0, @x, @y); |
194 mouseState:= SDL_GetMouseState(0, @x, @y); |
|
195 |
191 if x <= 50 then |
196 if x <= 50 then |
192 begin |
197 begin |
193 {$IFDEF DEBUGFILE} |
198 {$IFDEF DEBUGFILE} |
194 AddFileLog('Wheel -- x: ' + inttostr(x) + ' y: ' + inttostr(y)); |
199 AddFileLog('Wheel -- x: ' + inttostr(x) + ' y: ' + inttostr(y)); |
195 {$ENDIF} |
200 {$ENDIF} |
213 end;*} |
218 end;*} |
214 |
219 |
215 if (y > 430) and (x > 50) and (x <= 135) then |
220 if (y > 430) and (x > 50) and (x <= 135) then |
216 begin |
221 begin |
217 {$IFDEF DEBUGFILE} |
222 {$IFDEF DEBUGFILE} |
218 AddFileLog('Space -- x: ' + inttostr(x) + ' y: ' + inttostr(y)); |
223 AddFileLog('Enter -- x: ' + inttostr(x) + ' y: ' + inttostr(y)); |
219 {$ENDIF} |
224 {$ENDIF} |
220 ParseCommand('ljump', true); |
225 uKeys.enterKey:=true; |
221 end; |
226 end; |
222 if (y > 430) and (x > 185) and (x <= 270) then |
227 if (y > 430) and (x > 185) and (x <= 270) then |
223 begin |
228 begin |
224 {$IFDEF DEBUGFILE} |
229 {$IFDEF DEBUGFILE} |
225 AddFileLog('Backspace -- x: ' + inttostr(x) + ' y: ' + inttostr(y)); |
230 AddFileLog('Backspace -- x: ' + inttostr(x) + ' y: ' + inttostr(y)); |
226 {$ENDIF} |
231 {$ENDIF} |
227 ParseCommand('hjump', true); |
232 uKeys.backspaceKey:=true; |
|
233 |
228 end; |
234 end; |
229 if (y <= 50) and (x > 50) and (x <= 270) then |
235 if (y <= 50) and (x > 50) and (x <= 270) then |
230 begin |
236 begin |
231 {$IFDEF DEBUGFILE} |
237 {$IFDEF DEBUGFILE} |
232 AddFileLog('Backspace -- x: ' + inttostr(x) + ' y: ' + inttostr(y)); |
238 AddFileLog('Space DOWN -- x: ' + inttostr(x) + ' y: ' + inttostr(y)); |
233 {$ENDIF} |
239 {$ENDIF} |
234 //ParseCommand('hjump', true); |
240 uKeys.spaceKey:= true; |
|
241 uKeys.isAttacking:= true; |
|
242 end |
|
243 else |
|
244 begin |
|
245 AddFileLog('Space UP -- x: ' + inttostr(x) + ' y: ' + inttostr(y)); |
|
246 uKeys.isAttacking:= false; |
235 end; |
247 end; |
236 end; |
248 end; |
237 SDL_MOUSEBUTTONUP: begin |
249 SDL_MOUSEBUTTONUP: begin |
|
250 AddFileLog('********************************************* touch up'); |
|
251 |
|
252 if bShowAmmoMenu = true then ParseCommand('/put', true); |
|
253 |
238 mouseState:= SDL_GetMouseState(0, @x, @y); |
254 mouseState:= SDL_GetMouseState(0, @x, @y); |
239 {* open ammo menu *} |
255 {* open ammo menu *} |
240 if (y > 430) and (x > 270) then |
256 if (y > 430) and (x > 270) then |
241 begin |
257 begin |
242 {$IFDEF DEBUGFILE} |
258 {$IFDEF DEBUGFILE} |
258 //AddFileLog('which: ' + inttostr(event.jaxis.which) + ' axis: ' + inttostr(event.jaxis.axis) + ' value: ' + inttostr(event.jaxis.value)); |
274 //AddFileLog('which: ' + inttostr(event.jaxis.which) + ' axis: ' + inttostr(event.jaxis.axis) + ' value: ' + inttostr(event.jaxis.value)); |
259 if (event.jaxis.axis = 0) and (CurrentTeam <> nil) then |
275 if (event.jaxis.axis = 0) and (CurrentTeam <> nil) then |
260 begin |
276 begin |
261 if (modulo(event.jaxis.value) > (oldJoy + 400)) or (modulo(event.jaxis.value) < (oldJoy - 400)) then |
277 if (modulo(event.jaxis.value) > (oldJoy + 400)) or (modulo(event.jaxis.value) < (oldJoy - 400)) then |
262 begin |
278 begin |
263 if event.jaxis.value > 1500 then ParseCommand('+right', true) else |
279 if event.jaxis.value > 1500 then |
264 if event.jaxis.value <= -1500 then ParseCommand('+left', true) else |
280 begin |
265 if (event.jaxis.value > 0) and (event.jaxis.value <= 1500) then ParseCommand('-right', true) else |
281 if dir <> right then ParseCommand('-left', true); |
266 if (event.jaxis.value <= 0) and (event.jaxis.value > -1500) then ParseCommand('-left', true); |
282 ParseCommand('+right', true); |
|
283 dir:= right; |
|
284 end |
|
285 else |
|
286 if event.jaxis.value <= -1500 then |
|
287 begin |
|
288 if dir <> left then ParseCommand('-right', true); |
|
289 ParseCommand('+left', true); |
|
290 dir:= left; |
|
291 end |
|
292 else |
|
293 if (event.jaxis.value > 0) and (event.jaxis.value <= 1500) then ParseCommand('-right', true) |
|
294 else |
|
295 if (event.jaxis.value <= 0) and (event.jaxis.value > -1500) then ParseCommand('-left', true); |
267 {$IFDEF DEBUGFILE} |
296 {$IFDEF DEBUGFILE} |
268 AddFileLog('Joystick value: ' + inttostr(event.jaxis.value) + ' oldJoy: ' + inttostr(oldJoy)); |
297 AddFileLog('Joystick value: ' + inttostr(event.jaxis.value) + ' oldJoy: ' + inttostr(oldJoy)); |
269 {$ENDIF} |
298 {$ENDIF} |
270 oldJoy:= modulo(event.jaxis.value); |
299 oldJoy:= modulo(event.jaxis.value); |
271 end; |
300 end; |