Fix invalid number of entity set sprite columns evaluation
This commit is contained in:
@@ -2,8 +2,6 @@ package com.bartlomiejpluta.base.engine.world.entity.config;
|
||||
|
||||
import com.bartlomiejpluta.base.api.move.Direction;
|
||||
import lombok.Data;
|
||||
import org.joml.Vector2i;
|
||||
import org.joml.Vector2ic;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -13,23 +11,6 @@ import java.util.Map;
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "app.sprite.entity")
|
||||
public class EntitySpriteConfiguration {
|
||||
private EntitySpriteDimensionConfiguration dimension;
|
||||
private int defaultSpriteColumn;
|
||||
private Map<Direction, Integer> spriteDirectionRows;
|
||||
|
||||
public static class EntitySpriteDimensionConfiguration {
|
||||
private final Vector2i vector = new Vector2i();
|
||||
|
||||
public Vector2ic asVector() {
|
||||
return vector;
|
||||
}
|
||||
|
||||
public void setRows(int rows) {
|
||||
this.vector.y = rows;
|
||||
}
|
||||
|
||||
public void setCols(int cols) {
|
||||
this.vector.x = cols;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.bartlomiejpluta.base.engine.world.entity.model.DefaultEntity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.joml.Vector2f;
|
||||
import org.joml.Vector2fc;
|
||||
import org.joml.Vector2ic;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -26,7 +25,6 @@ public class DefaultEntityManager implements EntityManager {
|
||||
|
||||
private final Map<Direction, Integer> spriteDirectionRows;
|
||||
private final Map<Direction, Vector2fc> spriteDefaultRows;
|
||||
private final Vector2ic entitySpriteDimension;
|
||||
|
||||
private Mesh mesh;
|
||||
|
||||
@@ -35,7 +33,6 @@ public class DefaultEntityManager implements EntityManager {
|
||||
this.meshManager = meshManager;
|
||||
this.entitySetManager = entitySetManager;
|
||||
|
||||
this.entitySpriteDimension = configuration.getDimension().asVector();
|
||||
this.spriteDirectionRows = configuration.getSpriteDirectionRows();
|
||||
|
||||
var defaultSpriteColumn = configuration.getDefaultSpriteColumn();
|
||||
|
||||
@@ -101,7 +101,7 @@ public class DefaultEntity extends MovableSprite implements Entity {
|
||||
@Override
|
||||
protected Vector2fc[] getSpriteAnimationFramesPositions() {
|
||||
var row = spriteDirectionRows.get(faceDirection);
|
||||
var frames = material.getTexture().getRows();
|
||||
var frames = material.getTexture().getColumns();
|
||||
var array = new Vector2f[frames];
|
||||
|
||||
for (int column = 0; column < frames; ++column) {
|
||||
|
||||
@@ -6,10 +6,6 @@ app:
|
||||
|
||||
sprite:
|
||||
entity:
|
||||
dimension:
|
||||
rows: 4
|
||||
cols: 4
|
||||
|
||||
default-sprite-column: 0
|
||||
|
||||
sprite-direction-rows:
|
||||
|
||||
Reference in New Issue
Block a user