-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move computer button textures to a sprite sheet
- Loading branch information
Showing
16 changed files
with
132 additions
and
36 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
50 changes: 50 additions & 0 deletions
50
projects/common/src/client/java/dan200/computercraft/client/gui/GuiSprites.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,50 @@ | ||
// SPDX-FileCopyrightText: 2023 The CC: Tweaked Developers | ||
// | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package dan200.computercraft.client.gui; | ||
|
||
import dan200.computercraft.api.ComputerCraftAPI; | ||
import net.minecraft.client.renderer.texture.TextureAtlasSprite; | ||
import net.minecraft.client.renderer.texture.TextureManager; | ||
import net.minecraft.client.resources.TextureAtlasHolder; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Sprite sheet for | ||
*/ | ||
public class GuiSprites extends TextureAtlasHolder { | ||
public static final ResourceLocation SPRITE = new ResourceLocation(ComputerCraftAPI.MOD_ID, "gui"); | ||
private static final ResourceLocation ATLAS = SPRITE.withPath(x -> "textures/atlas/" + x + ".png"); | ||
|
||
public static final ResourceLocation TURNED_OFF = new ResourceLocation(ComputerCraftAPI.MOD_ID, "gui/buttons/turned_off"); | ||
public static final ResourceLocation TURNED_OFF_HOVER = new ResourceLocation(ComputerCraftAPI.MOD_ID, "gui/buttons/turned_off_hover"); | ||
|
||
public static final ResourceLocation TURNED_ON = new ResourceLocation(ComputerCraftAPI.MOD_ID, "gui/buttons/turned_on"); | ||
public static final ResourceLocation TURNED_ON_HOVER = new ResourceLocation(ComputerCraftAPI.MOD_ID, "gui/buttons/turned_on_hover"); | ||
|
||
public static final ResourceLocation TERMINATE = new ResourceLocation(ComputerCraftAPI.MOD_ID, "gui/buttons/terminate"); | ||
public static final ResourceLocation TERMINATE_HOVER = new ResourceLocation(ComputerCraftAPI.MOD_ID, "gui/buttons/terminate_hover"); | ||
|
||
private static @Nullable GuiSprites instance; | ||
|
||
private GuiSprites(TextureManager textureManager) { | ||
super(textureManager, ATLAS, SPRITE); | ||
} | ||
|
||
public static GuiSprites initialise(TextureManager textureManager) { | ||
if (instance != null) throw new IllegalStateException("GuiSprites has already been initialised"); | ||
return instance = new GuiSprites(textureManager); | ||
} | ||
|
||
public static TextureAtlasSprite get(ResourceLocation sprite) { | ||
if (instance == null) throw new IllegalStateException("GuiSprites has not been initialised"); | ||
return instance.getSprite(sprite); | ||
} | ||
|
||
public static TextureAtlasSprite getOrHovered(boolean hovered, ResourceLocation normal, ResourceLocation hover) { | ||
return get(hovered ? hover : normal); | ||
} | ||
} |
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
Binary file removed
BIN
-303 Bytes
projects/common/src/main/resources/assets/computercraft/textures/gui/buttons.png
Binary file not shown.
Binary file added
BIN
+145 Bytes
...mmon/src/main/resources/assets/computercraft/textures/gui/buttons/terminate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+144 Bytes
...rc/main/resources/assets/computercraft/textures/gui/buttons/terminate_hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+145 Bytes
...mon/src/main/resources/assets/computercraft/textures/gui/buttons/turned_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+145 Bytes
...c/main/resources/assets/computercraft/textures/gui/buttons/turned_off_hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+146 Bytes
...mmon/src/main/resources/assets/computercraft/textures/gui/buttons/turned_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+146 Bytes
...rc/main/resources/assets/computercraft/textures/gui/buttons/turned_on_hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
10 changes: 10 additions & 0 deletions
10
projects/fabric/src/generated/resources/assets/computercraft/atlases/gui.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
10 changes: 10 additions & 0 deletions
10
projects/forge/src/generated/resources/assets/computercraft/atlases/gui.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.