equal
deleted
inserted
replaced
158 procedure MainLoop; |
158 procedure MainLoop; |
159 var PrevTime, |
159 var PrevTime, |
160 CurrTime: Longword; |
160 CurrTime: Longword; |
161 event: TSDL_Event; |
161 event: TSDL_Event; |
162 {$IFDEF TOUCHINPUT} |
162 {$IFDEF TOUCHINPUT} |
163 type TDirection = (nodir, left, right); |
|
164 var tiltValue: LongInt; |
163 var tiltValue: LongInt; |
165 direction: TDirection = nodir; |
|
166 movedbybuttons: boolean = false; |
|
167 {$ENDIF} |
164 {$ENDIF} |
168 begin |
165 begin |
169 PrevTime:= SDL_GetTicks; |
166 PrevTime:= SDL_GetTicks; |
170 repeat |
167 repeat |
171 while SDL_PollEvent(@event) <> 0 do |
168 while SDL_PollEvent(@event) <> 0 do |
172 {$IFDEF TOUCHINPUT} |
|
173 if (direction <> nodir) and (movedbybuttons = true) then |
|
174 begin |
|
175 WriteLnToConsole('* Hedgehog moving *'); |
|
176 uKeys.isWalking:= true; |
|
177 if direction = left then uKeys.leftKey:= true |
|
178 else if direction = right then uKeys.rightKey:= true; |
|
179 end |
|
180 else uKeys.isWalking:= false; |
|
181 {$ENDIF} |
|
182 case event.type_ of |
169 case event.type_ of |
183 {$IFDEF SDL13} |
170 {$IFDEF SDL13} |
184 SDL_WINDOWEVENT: |
171 SDL_WINDOWEVENT: |
185 {$ELSE} |
172 {$ELSE} |
186 SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode); |
173 SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode); |