-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added key event + input field component
- Loading branch information
kurrycat
committed
Oct 14, 2022
1 parent
993adb3
commit 4ba5737
Showing
16 changed files
with
366 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/io/github/kurrycat/mpkmod/compatability/MCClasses/Keyboard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.github.kurrycat.mpkmod.compatability.MCClasses; | ||
|
||
import io.github.kurrycat.mpkmod.compatability.API; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public class Keyboard { | ||
public static List<String> getPressedButtons() { | ||
return Interface.get().map(Interface::getPressedButtons).orElseGet(ArrayList::new); | ||
} | ||
|
||
public enum Modifier { | ||
CTRL, | ||
SHIFT, | ||
ALT, | ||
RCTRL, | ||
RSHIFT; | ||
} | ||
|
||
public interface Interface extends FunctionHolder { | ||
static Optional<Interface> get() { | ||
return API.getFunctionHolder(Interface.class); | ||
} | ||
|
||
List<String> getPressedButtons(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/io/github/kurrycat/mpkmod/events/OnKeyInputEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.github.kurrycat.mpkmod.events; | ||
|
||
public class OnKeyInputEvent extends Event { | ||
public int keyCode; | ||
public String key; | ||
public boolean pressed; | ||
|
||
public OnKeyInputEvent(int keyCode, String key, boolean pressed) { | ||
super(EventType.KEY_INPUT); | ||
this.keyCode = keyCode; | ||
this.key = key; | ||
this.pressed = pressed; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.