-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b22fa4
commit da370fa
Showing
5 changed files
with
103 additions
and
32 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
common/src/main/kotlin/org/waste/of/time/gui/EnterTextField.kt
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,27 @@ | ||
package org.waste.of.time.gui | ||
|
||
import net.minecraft.client.MinecraftClient | ||
import net.minecraft.client.font.TextRenderer | ||
import net.minecraft.client.gui.widget.TextFieldWidget | ||
import net.minecraft.text.Text | ||
import org.lwjgl.glfw.GLFW | ||
import org.waste.of.time.manager.CaptureManager | ||
|
||
class EnterTextField( | ||
textRenderer: TextRenderer, x: Int, y: Int, width: Int, height: Int, message: Text, val client: MinecraftClient? | ||
) : TextFieldWidget(textRenderer, x, y, width, height, message) { | ||
|
||
override fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean { | ||
if (keyCode == GLFW.GLFW_KEY_ENTER) { | ||
if (CaptureManager.capturing) { | ||
client?.setScreen(null) | ||
CaptureManager.stop() | ||
} else { | ||
client?.setScreen(null) | ||
CaptureManager.start(text) | ||
} | ||
return true | ||
} | ||
return super.keyPressed(keyCode, scanCode, modifiers) | ||
} | ||
} |
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