mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2026-01-06 19:22:38 +01:00
Merge branch 'feature/insert-key-remapping' into develop
This commit is contained in:
commit
35f060451b
8
src/main/scala/ocelot/desktop/Keymap.scala
Normal file
8
src/main/scala/ocelot/desktop/Keymap.scala
Normal file
@ -0,0 +1,8 @@
|
||||
package ocelot.desktop
|
||||
|
||||
import org.lwjgl.input.Keyboard
|
||||
|
||||
/** The default Ocelot keymap (unless overridden by the setting). */
|
||||
object Keymap {
|
||||
val Insert: Int = Keyboard.KEY_INSERT
|
||||
}
|
||||
@ -44,6 +44,8 @@ class Settings(val config: Config) extends SettingsData {
|
||||
windowSize.y -= 16
|
||||
}
|
||||
|
||||
keymapInsert = config.getIntOrElse("ocelot.keymap.insert", Keymap.Insert)
|
||||
|
||||
recentWorkspace = config.getOptionalString("ocelot.workspace.recent")
|
||||
pinNewWindows = config.getBooleanOrElse("ocelot.workspace.pinNewWindows", default = true)
|
||||
unfocusedWindowTransparency = config.getDoubleOrElse("ocelot.workspace.unfocusedWindowTransparency", 0.5)
|
||||
@ -105,6 +107,9 @@ object Settings extends Logging {
|
||||
|
||||
def withValue(path: String, value: Option[Any]): Config =
|
||||
config.withValue(path, ConfigValueFactory.fromAnyRef(value.orNull))
|
||||
|
||||
def withValue(path: String, value: Int): Config =
|
||||
config.withValue(path, ConfigValueFactory.fromAnyRef(value))
|
||||
}
|
||||
|
||||
class Int2D(var x: Int, var y: Int) {
|
||||
@ -186,6 +191,7 @@ object Settings extends Logging {
|
||||
.withValuePreserveOrigin("ocelot.window.fullscreen", settings.windowFullscreen)
|
||||
.withValuePreserveOrigin("ocelot.window.disableVsync", settings.disableVsync)
|
||||
.withValuePreserveOrigin("ocelot.window.debugLwjgl", settings.debugLwjgl)
|
||||
.withValue("ocelot.keymap.insert", settings.keymapInsert)
|
||||
.withValue("ocelot.workspace.recent", settings.recentWorkspace)
|
||||
.withValuePreserveOrigin("ocelot.workspace.pinNewWindows", settings.pinNewWindows)
|
||||
.withValuePreserveOrigin("ocelot.workspace.unfocusedWindowTransparency", settings.unfocusedWindowTransparency)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package ocelot.desktop.util
|
||||
|
||||
import ocelot.desktop.Keymap
|
||||
import ocelot.desktop.Settings.Int2D
|
||||
import ocelot.desktop.util.SettingsData.Fields
|
||||
|
||||
@ -33,6 +34,8 @@ class SettingsData {
|
||||
var disableVsync: Boolean = false
|
||||
var debugLwjgl: Boolean = false
|
||||
|
||||
var keymapInsert: Int = Keymap.Insert
|
||||
|
||||
var recentWorkspace: Option[String] = None
|
||||
|
||||
var pinNewWindows: Boolean = true
|
||||
|
||||
@ -15,7 +15,6 @@ import ocelot.desktop.util.{DrawUtils, Logging}
|
||||
import ocelot.desktop.windows.ScreenWindow._
|
||||
import ocelot.desktop.{ColorScheme, OcelotDesktop, Settings}
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
import org.lwjgl.input.Keyboard
|
||||
import totoro.ocelot.brain.entity.Screen
|
||||
import totoro.ocelot.brain.nbt.NBTTagCompound
|
||||
import totoro.ocelot.brain.util.Tier
|
||||
@ -59,7 +58,7 @@ class ScreenWindow(screenNode: ScreenNode) extends BasicWindow with Logging {
|
||||
screen.keyDown(event.char, event.code, OcelotDesktop.player)
|
||||
|
||||
// note: in OpenComputers, key_down signal is fired __before__ clipboard signal
|
||||
if (event.code == Keyboard.KEY_INSERT)
|
||||
if (event.code == Settings.get.keymapInsert)
|
||||
screen.clipboard(UiHandler.clipboard, OcelotDesktop.player)
|
||||
|
||||
case KeyEvent.State.Release =>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user