-
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.
Added a keybinding to turn on or off.
- Loading branch information
1 parent
efffb5a
commit ca9c49c
Showing
13 changed files
with
180 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Created by .gitignore support plugin (hsz.mobi) | ||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm | ||
|
||
*.iml | ||
|
||
## Directory-based project format: | ||
.idea/ | ||
# if you remove the above rule, at least ignore the following: | ||
|
||
# User-specific stuff: | ||
# .idea/workspace.xml | ||
# .idea/tasks.xml | ||
# .idea/dictionaries | ||
|
||
# Sensitive or high-churn files: | ||
# .idea/dataSources.ids | ||
# .idea/dataSources.xml | ||
# .idea/sqlDataSources.xml | ||
# .idea/dynamic.xml | ||
# .idea/uiDesigner.xml | ||
|
||
# Gradle: | ||
# .idea/gradle.xml | ||
# .idea/libraries | ||
|
||
# Mongo Explorer plugin: | ||
# .idea/mongoSettings.xml | ||
|
||
## File-based project format: | ||
*.ipr | ||
*.iws | ||
|
||
## Plugin-specific files: | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
|
||
|
||
### Java template | ||
*.class | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
|
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
32 changes: 32 additions & 0 deletions
32
src/main/java/com/qkninja/clockhud/client/handler/KeyInputEventHandler.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,32 @@ | ||
package com.qkninja.clockhud.client.handler; | ||
|
||
import com.qkninja.clockhud.client.settings.KeyBindings; | ||
import com.qkninja.clockhud.reference.ConfigValues; | ||
import com.qkninja.clockhud.reference.Key; | ||
import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
import cpw.mods.fml.common.gameevent.InputEvent; | ||
|
||
public class KeyInputEventHandler | ||
{ | ||
|
||
private static Key getPressedKeyBinding() | ||
{ | ||
if (KeyBindings.toggle.isPressed()) | ||
return Key.TOGGLE; | ||
else return Key.UNKNOWN; | ||
} | ||
|
||
@SubscribeEvent | ||
public void handleKeyInputEvent(InputEvent.KeyInputEvent event) | ||
{ | ||
if (getPressedKeyBinding() == Key.TOGGLE) | ||
{ | ||
if (ConfigValues.guiActive) | ||
ConfigValues.guiActive = false; | ||
else | ||
ConfigValues.guiActive = true; | ||
} | ||
|
||
|
||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/qkninja/clockhud/client/settings/KeyBindings.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,10 @@ | ||
package com.qkninja.clockhud.client.settings; | ||
|
||
import com.qkninja.clockhud.reference.Names; | ||
import net.minecraft.client.settings.KeyBinding; | ||
import org.lwjgl.input.Keyboard; | ||
|
||
public class KeyBindings | ||
{ | ||
public static KeyBinding toggle = new KeyBinding(Names.Keys.TOGGLE, Keyboard.KEY_COMMA, Names.Keys.CATEGORY); | ||
} |
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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
package com.qkninja.clockhud.proxy; | ||
|
||
/** | ||
* Created by Sam on 2014-12-20. | ||
*/ | ||
public interface IProxy | ||
{ | ||
|
||
public void registerRenderers(); | ||
|
||
public void registerKeyBindings(); | ||
|
||
} |
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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
package com.qkninja.clockhud.proxy; | ||
|
||
/** | ||
* Created by Sam on 2014-12-20. | ||
*/ | ||
public class ServerProxy extends CommonProxy | ||
{ | ||
public void registerRenderers() {} | ||
|
||
public void registerKeyBindings() {} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/com/qkninja/clockhud/reference/ConfigValues.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,6 @@ | ||
package com.qkninja.clockhud.reference; | ||
|
||
public class ConfigValues | ||
{ | ||
public static boolean guiActive = true; | ||
} |
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,9 @@ | ||
package com.qkninja.clockhud.reference; | ||
|
||
/** | ||
* Enum to see what key is pressed. | ||
*/ | ||
public enum Key | ||
{ | ||
UNKNOWN, TOGGLE | ||
} |
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,10 @@ | ||
package com.qkninja.clockhud.reference; | ||
|
||
public final class Names | ||
{ | ||
public static final class Keys | ||
{ | ||
public static final String CATEGORY = "keys.clockhud.category"; | ||
public static final String TOGGLE = "keys.clockhud.toggle"; | ||
} | ||
} |
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,3 @@ | ||
# Keys | ||
keys.clockhud.category=Clock HUD | ||
keys.clockhud.toggle=Toggle |
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,17 @@ | ||
[ | ||
{ | ||
"modid": "ClockHUD", | ||
"name": "Clock HUD", | ||
"description": "A simple clock GUI to check the time.", | ||
"version": "1.7.0-1.0", | ||
"mcversion": "1.7.10", | ||
"url": "", | ||
"updateUrl": "", | ||
"authorList": [ "QKninja" ], | ||
"credits": "Created by QKninja", | ||
"logoFile": "", | ||
"parent":"", | ||
"screenshots": [], | ||
"dependencies": [] | ||
} | ||
] |