@@ -142,6 +142,7 @@ class Cake : KtxApplicationAdapter, KtxInputAdapter {
142
142
}
143
143
144
144
Cmd .AddCommand (" precache" ) {
145
+ // todo: check the game state first, do not precache in the middle of the game
145
146
Com .Printf (" precache - loading resources\n " )
146
147
val precache_spawncount = it[1 ].toInt()
147
148
// no udp downloads anymore!!
@@ -165,45 +166,9 @@ class Cake : KtxApplicationAdapter, KtxInputAdapter {
165
166
handlers.add(menuStage)
166
167
}
167
168
// delegate the rest to the current 3d screen
168
- handlers.add(
169
- object : InputProcessor {
170
- override fun keyDown (keycode : Int ): Boolean {
171
- return game3dScreen?.keyDown(keycode) ? : false
172
- }
173
-
174
- override fun keyUp (keycode : Int ): Boolean {
175
- return game3dScreen?.keyUp(keycode) ? : false
176
- }
177
-
178
- override fun keyTyped (character : Char ): Boolean {
179
- return game3dScreen?.keyTyped(character) ? : false
180
- }
181
-
182
- override fun touchDown (screenX : Int , screenY : Int , pointer : Int , button : Int ): Boolean {
183
- return game3dScreen?.touchDown(screenX, screenY, pointer, button) ? : false
184
- }
185
-
186
- override fun touchUp (screenX : Int , screenY : Int , pointer : Int , button : Int ): Boolean {
187
- return game3dScreen?.touchUp(screenX, screenY, pointer, button) ? : false
188
- }
189
-
190
- override fun touchCancelled (screenX : Int , screenY : Int , pointer : Int , button : Int ): Boolean {
191
- return game3dScreen?.touchCancelled(screenX, screenY, pointer, button) ? : false
192
- }
193
-
194
- override fun touchDragged (screenX : Int , screenY : Int , pointer : Int ): Boolean {
195
- return game3dScreen?.touchDragged(screenX, screenY, pointer) ? : false
196
- }
197
-
198
- override fun mouseMoved (screenX : Int , screenY : Int ): Boolean {
199
- return game3dScreen?.mouseMoved(screenX, screenY) ? : false
200
- }
201
-
202
- override fun scrolled (amountX : Float , amountY : Float ): Boolean {
203
- return game3dScreen?.scrolled(amountX, amountY) ? : false
204
- }
205
- }
206
- )
169
+ game3dScreen?.let { screen ->
170
+ handlers.add(object : InputProcessor by screen {})
171
+ }
207
172
Gdx .input.inputProcessor = InputMultiplexer (
208
173
this , // global input processor to control console and menu
209
174
* handlers.toTypedArray()
0 commit comments