-
Notifications
You must be signed in to change notification settings - Fork 13
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
Showing
8 changed files
with
108 additions
and
34 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
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
14 changes: 14 additions & 0 deletions
14
smylib/core/src/main/java/net/smyler/smylib/gui/sprites/WarningWidget.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,14 @@ | ||
package net.smyler.smylib.gui.sprites; | ||
|
||
import net.smyler.smylib.Identifier; | ||
import net.smyler.smylib.gui.widgets.SpriteWidget; | ||
|
||
public class WarningWidget extends SpriteWidget { | ||
|
||
private static final Identifier TEXTURE = new Identifier("terramap", "textures/gui/widgets.png"); | ||
private static final Sprite SPRITE = new Sprite(TEXTURE, 256d, 256d, 15d, 54d, 30d, 69d); | ||
|
||
public WarningWidget(float x, float y, int z) { | ||
super(x, y, z, SPRITE); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
smylib/core/src/main/java/net/smyler/smylib/gui/widgets/SpriteWidget.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,28 @@ | ||
package net.smyler.smylib.gui.widgets; | ||
|
||
import net.smyler.smylib.gui.sprites.Sprite; | ||
import net.smyler.smylib.gui.containers.WidgetContainer; | ||
import net.smyler.smylib.gui.DrawContext; | ||
|
||
public class SpriteWidget extends AbstractSolidWidget { | ||
|
||
|
||
private final Sprite sprite; | ||
|
||
public SpriteWidget(float x, float y, int z, Sprite sprite) { | ||
super(x, y, z, (float)sprite.width(), (float)sprite.height()); | ||
this.sprite = sprite; | ||
} | ||
|
||
@Override | ||
public void draw(DrawContext context, float x, float y, float mouseX, float mouseY, boolean hovered, boolean focused, WidgetContainer parent) { | ||
context.drawSprite(x, y, this.sprite); | ||
} | ||
|
||
public SpriteWidget setPosition(float x, float y) { | ||
this.x = x; | ||
this.y = y; | ||
return this; | ||
} | ||
|
||
} |
28 changes: 0 additions & 28 deletions
28
smylib/core/src/main/java/net/smyler/smylib/gui/widgets/WarningWidget.java
This file was deleted.
Oops, something went wrong.