Skip to content

Commit

Permalink
make GuiTexture and Texture distinct types
Browse files Browse the repository at this point in the history
Rather than GuiTexture being a child type of
Texture.

This stops GuiTexture from being used in a place
that Texture would be used by accident.
  • Loading branch information
Pixaurora committed Jul 11, 2024
1 parent b3cc188 commit e032cbb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.pixaurora.kit_tunes.impl.ui.texture;

import net.pixaurora.kit_tunes.api.resource.ResourcePath;
import net.pixaurora.kit_tunes.impl.ui.math.Size;

public interface AbstractTexture {
public ResourcePath path();

public Size size();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.pixaurora.kit_tunes.impl.KitTunes;
import net.pixaurora.kit_tunes.impl.ui.math.Size;

public interface GuiTexture extends Texture {
public interface GuiTexture extends AbstractTexture {
public static GuiTexture of(ResourcePath path, Size size) {
return new TextureImpl(KitTunes.UI_LAYER.convertToGuiAsset(path), size);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
import net.pixaurora.kit_tunes.impl.resource.ResourcePathImpl;
import net.pixaurora.kit_tunes.impl.ui.math.Size;

public interface Texture {
public ResourcePath path();

public Size size();

public interface Texture extends AbstractTexture {
public static Texture of(String path, Size size) {
return of(ResourcePathImpl.fromString(path), size);
}
Expand Down

0 comments on commit e032cbb

Please sign in to comment.