Delete src directory

This commit is contained in:
JoeMolinelli authored and GitHub committed 2026-08-04 17:49:40 -04:00
1 parent 1ecfc3c965
commit 5cdc6af9dd
44 files changed
-8125

No files matched your search

-46
View File
@@ -1,46 +0,0 @@
package components;
import java.util.ArrayList;
import java.util.List;
import org.joml.Vector2f;
import renderer.Texture;
public class Spritesheet {
private Texture texture;
private List<Sprite> sprites;
public Spritesheet(Texture texture, int spriteWidth, int spriteHeight, int numSprites, int spacing) {
this.sprites = new ArrayList<>();
this.texture = texture;
int currentX = 0;
int currentY = texture.getHeight() - spriteHeight;
for (int i = 0; i < numSprites; i++) {
float topY = (currentY + spriteHeight) / (float)texture.getHeight();;
float rightX = (currentX + spriteWidth) / (float)texture.getWidth();
float leftX = currentX / (float)texture.getWidth();
float bottomY = currentY / (float)texture.getHeight();;
Vector2f[] texCoords = {
new Vector2f(rightX, bottomY),
new Vector2f(rightX, topY),
new Vector2f(leftX, topY),
new Vector2f(leftX, bottomY)
};
Sprite sprite = new Sprite(this.texture, texCoords);
this.sprites.add(sprite);
currentX += spriteWidth + spacing;
if (currentX >= texture.getWidth()) {
currentX = 0;
currentY -= spriteHeight + spacing;
}
}
}
public Sprite getSprite(int index) {
return this.sprites.get(index);
}
}