Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading LWJGL to version 3 #3969

Merged
merged 51 commits into from
Oct 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7da81a4
feat(LWJGL3): initial migrate
DarkWeird May 18, 2020
7d5d908
fix: keyboard binding id from lwjgl's to tera's
DarkWeird May 19, 2020
c6c7a98
fix: save window position and window size on exit
DarkWeird May 20, 2020
22950e9
chore: refactor GL and GLFW debug/error callbacks
DarkWeird May 20, 2020
d15eeec
Fix: WindowResizeCallback creates only 1 time on window creation
DarkWeird May 20, 2020
9c7cb57
Fix: Return SkySphere! and glu's Sphere related things
DarkWeird May 20, 2020
feaa3a1
Fix: Settings Resolution restored now!
DarkWeird May 21, 2020
3689c8d
chore(LWJGL3): expose lwjgl3 libs to modules
DarkWeird May 21, 2020
b615a28
fix(LWJGL3): fix disable vSync
DarkWeird May 22, 2020
4cde3a8
fix(LWJGL3): fixed mouse scroll. before was delta=0
DarkWeird May 22, 2020
47b2ec1
fix(Lwjgl3): reordered lwjgl3 natives init and direct implement os de…
DarkWeird May 24, 2020
cdd6282
fix(Lwjgl3): fixed Resolution, switching DesplayModes
DarkWeird May 24, 2020
1d44358
chore(LWJGL3): Remove static getter for window/display size
DarkWeird May 24, 2020
1e0a822
fix(LWJGL3): Fix FrameLimit
DarkWeird May 24, 2020
760f8c4
fix(LWJGL3): Merge keys and chars from callbacks together.
DarkWeird May 25, 2020
35af4a3
chore(LWJGL3): refactor Sync(framelimiter) names.
DarkWeird May 25, 2020
ec23566
fix(LWJGL3): fix OpenGL's messages
DarkWeird May 25, 2020
f9d94a3
chore(LWJGL3): cleanup commented code/todos. PixelFormat(depth bits) …
DarkWeird May 25, 2020
8c1499c
fix(LWJGL3): revert .idea configs
DarkWeird May 25, 2020
3d78b7a
fix(LWJGL3): make OS detection for determinate platform path - lwjgl-…
DarkWeird May 25, 2020
10f639b
chore(lwjgl3): update LWJGL3 for DAG
DarkWeird Jun 8, 2020
b377ec1
Merge remote-tracking branch 'tera/develop' into lwjgl3
DarkWeird Jun 8, 2020
4246b76
fix(lwjgl3): Fix lwjgl2's GLContext -> lwjgl3's GL in SpritePraticleR…
DarkWeird Jun 8, 2020
7bacf1c
feat(lwjgl3): Update for LWJGL3
DarkWeird Jul 2, 2020
a5401d2
Merge remote-tracking branch 'tera/develop' into lwjgl3
DarkWeird Jul 2, 2020
8c53d5f
refactor(lwjgl3):JavaDocs, CheckStyle issues, remove unused code
DarkWeird Jul 6, 2020
1d998f6
refactor(lwjgl3):Remove UnusedCode
DarkWeird Jul 6, 2020
f023fc5
feat(LWJGL3, NUI): Split "Raw Input keys" and "Char Input" in InputSy…
DarkWeird Jul 9, 2020
35a226b
feat(LWJGL3, NUI): Return OS's input events callback, consume key eve…
DarkWeird Jul 13, 2020
0c4eb7f
Merge remote-tracking branch 'tera/develop' into lwjgl3
DarkWeird Jul 28, 2020
6ba9cea
chore(lwjgl3): move GLFW SplashScreen code to `splash-screen` library.
DarkWeird Jul 28, 2020
e212aa3
feat(lwjgl3): gradle task determinate Mac now. idea's run configs hav…
DarkWeird Jul 28, 2020
0883df8
Merge PR #3969
Cervator Aug 2, 2020
0bbe546
chore: conflict resolution
Cervator Aug 2, 2020
599d487
chore: use snapshot splash-screen for now
Cervator Aug 2, 2020
9607b98
Merge remote-tracking branch 'tera/develop' into lwjgl3
DarkWeird Aug 4, 2020
d6e7fb3
Merge remote-tracking branch 'origin/develop' into lwjgl3
DarkWeird Aug 31, 2020
83cc4a0
fix(nui): NUI extraction compability
DarkWeird Sep 2, 2020
cc3082f
Bump up teranui's version
DarkWeird Sep 2, 2020
74aa3cc
Merge remote-tracking branch 'origin/develop' into lwjgl3
DarkWeird Oct 12, 2020
6029073
chore(lwjgl3): minor refactoring
DarkWeird Oct 12, 2020
9928964
fix: fix lwjgl3 running for Mac OS
DarkWeird Oct 13, 2020
4d3909c
feat(LWGJL3): twaek mouse delta
pollend Oct 18, 2020
ce88be5
Update LwjglMouseDevice.java
pollend Oct 18, 2020
7800b19
Merge pull request #1 from pollend/DwarkWeird-lwgjl3-input-tweak
DarkWeird Oct 18, 2020
b123c1c
feat(lwjgl3): Fix Gradle's run configuration for MacOS
DarkWeird Oct 19, 2020
e8a4e1b
chore(lwjgl3): Change to usage not depricated code for OpenVRStereoCa…
DarkWeird Oct 19, 2020
0050696
Merge remote-tracking branch 'origin/develop' into lwjgl3
DarkWeird Oct 21, 2020
02736ba
Merge branch 'develop' into lwjgl3
DarkWeird Oct 23, 2020
adb8075
fix(build): added "java-platform" gradle plagin for "platform"/BOM de…
DarkWeird Oct 23, 2020
c83655f
fix(lwjgl3): fix lgtm issues
DarkWeird Oct 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(LWJGL3, NUI): Split "Raw Input keys" and "Char Input" in InputSy…
…stem and NUI.

Input system and NUI have separate *Char(Event,Action) for text input now.
UIWidget have onCharInput method now.
All Key actions and events haven't inputCharacter(text) now. only raw keys.
  • Loading branch information
DarkWeird committed Jul 9, 2020
commit f023fc572254f78e3d0aa5b9085970b9ab73f4d4
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2020 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.input;

import com.google.common.collect.Queues;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
Expand All @@ -16,8 +19,9 @@
import org.terasology.input.Keyboard.Key;
import org.terasology.input.Keyboard.KeyId;
import org.terasology.input.cameraTarget.CameraTargetSystem;
import org.terasology.input.device.KeyboardAction;
import org.terasology.input.device.CharKeyboardAction;
import org.terasology.input.device.KeyboardDevice;
import org.terasology.input.device.RawKeyboardAction;
import org.terasology.input.events.KeyEvent;
import org.terasology.input.internal.BindableButtonImpl;
import org.terasology.logic.players.LocalPlayer;
Expand Down Expand Up @@ -91,7 +95,7 @@ private void setUpLocalPlayer(Context context) {
private void registerEntityKeyCapturing() {
/*
* KeyUpEvent and KeyDownEvent are singletons with a single instance that gets reset each time.
* Therefore it is not possible to capture multiple events with an ArgumentCaptor
* Therefore it is not possible to capture multiple events with an ArgumentCaptor
* because previous instances become invalid.
* For this reason, the data of these events is captured to a separate class.
*/
Expand Down Expand Up @@ -145,14 +149,12 @@ public void testSingleKeyPress() {
assertEquals(clientEntityKeyEvents.size(), 1);
CapturedKeyEvent clientEvent = clientEntityKeyEvents.get(0);
assertEquals(clientEvent.key, Key.W);
assertEquals(clientEvent.keyCharacter, characterFor(Key.W));
assertEquals(clientEvent.delta, delta);
assertEquals(clientEvent.delta, delta, 0f);
assertEquals(clientEvent.buttonState, ButtonState.DOWN);

assertEquals(characterEntityKeyEvents.size(), 1);
CapturedKeyEvent characterEvent = characterEntityKeyEvents.get(0);
assertEquals(characterEvent.key, Key.W);
assertEquals(characterEvent.keyCharacter, characterFor(Key.W));
assertEquals(characterEvent.delta, delta);
assertEquals(characterEvent.buttonState, ButtonState.DOWN);
}
Expand All @@ -167,14 +169,12 @@ public void testSingleKeyRelease() {
assertEquals(clientEntityKeyEvents.size(), 1);
CapturedKeyEvent clientEvent = clientEntityKeyEvents.get(0);
assertEquals(clientEvent.key, Key.W);
assertEquals(clientEvent.keyCharacter, characterFor(Key.W));
assertEquals(clientEvent.delta, delta);
assertEquals(clientEvent.delta, delta, 0f);
assertEquals(clientEvent.buttonState, ButtonState.UP);

assertEquals(characterEntityKeyEvents.size(), 1);
CapturedKeyEvent characterEvent = characterEntityKeyEvents.get(0);
assertEquals(characterEvent.key, Key.W);
assertEquals(characterEvent.keyCharacter, characterFor(Key.W));
assertEquals(characterEvent.delta, delta);
assertEquals(characterEvent.buttonState, ButtonState.UP);
}
Expand Down Expand Up @@ -223,13 +223,13 @@ private void pressAndReleaseKey(Key key) {
}

private void pressKey(Key key) {
KeyboardAction keyboardAction = new KeyboardAction(key, ButtonState.DOWN, characterFor(key));
testKeyboard.add(keyboardAction);
RawKeyboardAction rawKeyboardAction = new RawKeyboardAction(key, ButtonState.DOWN);
testKeyboard.add(rawKeyboardAction);
}

private void releaseKey(Key key) {
KeyboardAction keyboardAction = new KeyboardAction(key, ButtonState.UP, characterFor(key));
testKeyboard.add(keyboardAction);
RawKeyboardAction rawKeyboardAction = new RawKeyboardAction(key, ButtonState.UP);
testKeyboard.add(rawKeyboardAction);
}

private static char characterFor(Key key) {
Expand All @@ -244,25 +244,30 @@ private static char characterFor(Key key) {

private static class TestKeyboard implements KeyboardDevice {

private Queue<KeyboardAction> queue = new LinkedBlockingQueue<>();
private Queue<RawKeyboardAction> queue = new LinkedBlockingQueue<>();

@Override
public Queue<KeyboardAction> getInputQueue() {
public Queue<RawKeyboardAction> getInputQueue() {
return queue;
}

@Override
public Queue<CharKeyboardAction> getCharInputQueue() {
return Queues.newArrayDeque();
}

@Override
public boolean isKeyDown(int key) {
return false;
}

public void add(KeyboardAction action) {
public void add(RawKeyboardAction action) {
queue.add(action);
}

}

@RegisterBindButton(id = "testEvent", description = "${engine-tests:menu#theTestEvent}", repeating = false, category = "tests")
@RegisterBindButton(id = "testEvent", description = "${engine-tests:menu#theTestEvent}", category = "tests")
@DefaultBinding(type = InputType.KEY, id = Keyboard.KeyId.T)
public class TestEventButton extends BindButtonEvent {
//the annotations are not used in this tests but represent the way a binding is registered by default
Expand All @@ -272,13 +277,11 @@ private static class CapturedKeyEvent {

public Input key;
public float delta;
public char keyCharacter;
private ButtonState buttonState;

public CapturedKeyEvent(KeyEvent event) {
CapturedKeyEvent(KeyEvent event) {
key = event.getKey();
delta = event.getDelta();
keyCharacter = event.getKeyCharacter();
buttonState = event.getState();
}

Expand Down
Loading