|
|
@ -9,6 +9,7 @@ import mightypork.gamecore.input.events.KeyEvent; |
|
|
|
import mightypork.gamecore.input.events.MouseButtonEvent; |
|
|
|
import mightypork.gamecore.input.events.MouseButtonEvent; |
|
|
|
import mightypork.gamecore.input.events.MouseMotionEvent; |
|
|
|
import mightypork.gamecore.input.events.MouseMotionEvent; |
|
|
|
import mightypork.utils.interfaces.Updateable; |
|
|
|
import mightypork.utils.interfaces.Updateable; |
|
|
|
|
|
|
|
import mightypork.utils.logging.Log; |
|
|
|
import mightypork.utils.math.constraints.vect.Vect; |
|
|
|
import mightypork.utils.math.constraints.vect.Vect; |
|
|
|
import mightypork.utils.math.constraints.vect.var.VectVar; |
|
|
|
import mightypork.utils.math.constraints.vect.var.VectVar; |
|
|
|
|
|
|
|
|
|
|
@ -51,15 +52,25 @@ public class LwjglInputModule extends InputModule implements Updateable { |
|
|
|
protected void initDevices() |
|
|
|
protected void initDevices() |
|
|
|
{ |
|
|
|
{ |
|
|
|
try { |
|
|
|
try { |
|
|
|
Mouse.create(); |
|
|
|
tryCreate(); |
|
|
|
Keyboard.create(); |
|
|
|
|
|
|
|
Keyboard.enableRepeatEvents(false); |
|
|
|
Keyboard.enableRepeatEvents(false); |
|
|
|
|
|
|
|
|
|
|
|
} catch (final LWJGLException e) { |
|
|
|
} catch (final LWJGLException e) { |
|
|
|
throw new RuntimeException("Failed to initialize input devices.", e); |
|
|
|
throw new RuntimeException("Failed to initialize input devices.", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void tryCreate() throws LWJGLException |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (Display.isCreated()) { |
|
|
|
|
|
|
|
Mouse.create(); |
|
|
|
|
|
|
|
Keyboard.create(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void initKeyCodes() |
|
|
|
protected void initKeyCodes() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -206,8 +217,16 @@ public class LwjglInputModule extends InputModule implements Updateable { |
|
|
|
{ |
|
|
|
{ |
|
|
|
// was destroyed or not initialized
|
|
|
|
// was destroyed or not initialized
|
|
|
|
if (!Display.isCreated()) return; |
|
|
|
if (!Display.isCreated()) return; |
|
|
|
if (!Mouse.isCreated()) return; |
|
|
|
|
|
|
|
if (!Keyboard.isCreated()) return; |
|
|
|
if (!Mouse.isCreated() || !Keyboard.isCreated()) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
tryCreate(); |
|
|
|
|
|
|
|
} catch (final LWJGLException e) { |
|
|
|
|
|
|
|
Log.e(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!Mouse.isCreated() || !Keyboard.isCreated()) return; |
|
|
|
|
|
|
|
|
|
|
|
Display.processMessages(); |
|
|
|
Display.processMessages(); |
|
|
|
|
|
|
|
|
|
|
|