-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #3 closes #7 closes #16 closes #17 Signed-off-by: Lyzev <[email protected]>
- Loading branch information
Showing
84 changed files
with
2,837 additions
and
607 deletions.
There are no files selected for viewing
Submodule Settings
updated
from cd48e0 to da7896
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
24 changes: 24 additions & 0 deletions
24
src/main/java/dev/lyzev/schizoid/mixins/minecraft/client/MixinKeyboard.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,24 @@ | ||
/* | ||
* Copyright (c) 2024. Schizoid | ||
* All rights reserved. | ||
*/ | ||
|
||
package dev.lyzev.schizoid.mixins.minecraft.client; | ||
|
||
import dev.lyzev.api.events.EventKeystroke; | ||
import net.minecraft.client.Keyboard; | ||
import org.lwjgl.glfw.GLFW; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(Keyboard.class) | ||
public class MixinKeyboard { | ||
|
||
@Inject(method = "onKey", at = @At("TAIL")) | ||
private void onKey(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) { | ||
if (key != GLFW.GLFW_KEY_UNKNOWN) | ||
new EventKeystroke(window, key, scancode, action, modifiers).fire(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/dev/lyzev/schizoid/mixins/minecraft/client/MixinMinecraftClient.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,22 @@ | ||
/* | ||
* Copyright (c) 2024. Schizoid | ||
* All rights reserved. | ||
*/ | ||
|
||
package dev.lyzev.schizoid.mixins.minecraft.client; | ||
|
||
import dev.lyzev.api.events.EventWindowResize; | ||
import net.minecraft.client.MinecraftClient; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(MinecraftClient.class) | ||
public class MixinMinecraftClient { | ||
|
||
@Inject(method = "onResolutionChanged", at = @At("TAIL")) | ||
private void onResolutionChanged(CallbackInfo ci) { | ||
EventWindowResize.INSTANCE.fire(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/dev/lyzev/schizoid/mixins/minecraft/client/MixinMouse.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,25 @@ | ||
/* | ||
* Copyright (c) 2024. Schizoid | ||
* All rights reserved. | ||
*/ | ||
|
||
package dev.lyzev.schizoid.mixins.minecraft.client; | ||
|
||
import dev.lyzev.api.events.EventKeystroke; | ||
import dev.lyzev.api.events.EventMouseClick; | ||
import net.minecraft.client.Mouse; | ||
import org.lwjgl.glfw.GLFW; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(Mouse.class) | ||
public class MixinMouse { | ||
|
||
@Inject(method = "onMouseButton", at = @At("TAIL")) | ||
private void onMouseButton(long window, int button, int action, int mods, CallbackInfo ci) { | ||
if (button != GLFW.GLFW_KEY_UNKNOWN) | ||
new EventMouseClick(window, button, action, mods).fire(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) 2024. Schizoid | ||
* All rights reserved. | ||
*/ | ||
|
||
package dev.lyzev.api.glfw | ||
|
||
enum class GLFWKey(val code: Int) { | ||
NONE(-1), MOUSE_BUTTON_LEFT(0), MOUSE_BUTTON_RIGHT(1), MOUSE_BUTTON_MIDDLE(2), SPACE(32), APOSTROPHE(39), COMMA(44), MINUS( | ||
45 | ||
), | ||
PERIOD( | ||
46 | ||
), | ||
SLASH(47), KEY_0(48), KEY_1(49), KEY_2(50), KEY_3(51), KEY_4(52), KEY_5( | ||
53 | ||
), | ||
KEY_6(54), KEY_7(55), KEY_8(56), KEY_9(57), SEMICOLON(59), EQUAL( | ||
61 | ||
), | ||
A(65), B(66), C(67), D(68), E(69), F(70), G(71), H(72), I(73), J( | ||
74 | ||
), | ||
K(75), L(76), M(77), N(78), O(79), P(80), Q(81), R(82), S(83), T( | ||
84 | ||
), | ||
U(85), V(86), W(87), X(88), Y(90), Z(89), LEFT_BRACKET(91), BACKSLASH( | ||
92 | ||
), | ||
RIGHT_BRACKET(93), GRAVE_ACCENT(96), WORLD_1(161), WORLD_2( | ||
162 | ||
), | ||
ESCAPE(256), ENTER(257), TAB(258), BACKSPACE(259), INSERT( | ||
260 | ||
), | ||
DELETE(261), RIGHT(262), LEFT(263), DOWN(264), UP(265), PAGE_UP( | ||
266 | ||
), | ||
PAGE_DOWN(267), HOME(268), END(269), CAPS_LOCK(280), SCROLL_LOCK( | ||
281 | ||
), | ||
NUM_LOCK(282), PRINT_SCREEN(283), PAUSE(284), F1(290), F2(291), F3( | ||
292 | ||
), | ||
F4(293), F5(294), F6(295), F7(296), F8(297), F9(298), F10(299), F11( | ||
300 | ||
), | ||
F12(301), F13(302), F14(303), F15(304), F16(305), F17(306), F18( | ||
307 | ||
), | ||
F19(308), F20(309), F21(310), F22(311), F23(312), F24(313), F25( | ||
314 | ||
), | ||
KP_0(320), KP_1(321), KP_2(322), KP_3(323), KP_4(324), KP_5( | ||
325 | ||
), | ||
KP_6(326), KP_7(327), KP_8(328), KP_9(329), KP_DECIMAL( | ||
330 | ||
), | ||
KP_DIVIDE(331), KP_MULTIPLY(332), KP_SUBTRACT(333), KP_ADD( | ||
334 | ||
), | ||
KP_ENTER(335), KP_EQUAL(336), LEFT_SHIFT(340), LEFT_CONTROL( | ||
341 | ||
), | ||
LEFT_ALT(342), LEFT_SUPER(343), RIGHT_SHIFT(344), RIGHT_CONTROL( | ||
345 | ||
), | ||
RIGHT_ALT(346), RIGHT_SUPER(347), MENU(348); | ||
|
||
companion object { | ||
operator fun get(keyCode: Int): GLFWKey = entries.firstOrNull { it.code == keyCode } ?: NONE | ||
} | ||
} |
Oops, something went wrong.