-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added notes to testCannonCharges testCannonData of fields gets saved when closing while focused changed FrameConfig from int to float, more accurate, but using a lot of rounding calls
- Loading branch information
1 parent
f2706ed
commit 4de40e3
Showing
16 changed files
with
322 additions
and
202 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
42 changes: 42 additions & 0 deletions
42
src/main/java/the_dark_jumper/cannontracer/gui/guielements/CompactToggleValueFrame.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,42 @@ | ||
package the_dark_jumper.cannontracer.gui.guielements; | ||
|
||
import jumpercommons.GetterAndSetter; | ||
import the_dark_jumper.cannontracer.gui.IJumperGUI; | ||
import the_dark_jumper.cannontracer.gui.guielements.interfaces.IClickableFrame; | ||
import the_dark_jumper.cannontracer.gui.utils.FrameColors; | ||
import the_dark_jumper.cannontracer.gui.utils.FrameConfig; | ||
|
||
public class CompactToggleValueFrame extends BasicTextFrame implements IClickableFrame { | ||
public final GetterAndSetter<Boolean> source; | ||
public final String enabledText; | ||
public final String disabledText; | ||
|
||
public boolean isClicked = false; | ||
@Override public boolean getIsClicked() {return isClicked;} | ||
@Override | ||
public void setIsClicked(boolean isClicked) { | ||
if(isClicked) { | ||
boolean result = !source.get(); | ||
source.set(result); | ||
super.text = result ? enabledText : disabledText; | ||
} | ||
} | ||
|
||
public boolean hovered = false; | ||
@Override public boolean getHovered() {return hovered;} | ||
@Override public void setHovered(boolean hovered) {this.hovered = hovered;} | ||
|
||
public CompactToggleValueFrame(IJumperGUI parent, FrameConfig config, FrameColors colors, String enabledText, String disabledText, GetterAndSetter<Boolean> source) { | ||
super(parent, source.get() ? enabledText : disabledText, config, colors); | ||
this.source = source; | ||
this.enabledText = enabledText; | ||
this.disabledText = disabledText; | ||
} | ||
|
||
@Override | ||
public void drawTexts(float x1, float y1, float x2, float y2) { | ||
int height = Math.round((y2 + y1) / 2); | ||
int width = Math.round((x2 + x1) / 2); | ||
parent.drawCenteredString(minecraft.fontRenderer, text, width, height, source.get() ? colors.colorOn : colors.colorOff); | ||
} | ||
} |
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.