mirror of
https://github.com/Stefan-5422/School-Programming-Projekt-022022.git
synced 2026-09-06 23:35:09 +02:00
Calculate max amount of rendered chunks based on window size
This commit is contained in:
@@ -5,10 +5,6 @@ import com.yes.yes.utils.*;
|
||||
|
||||
public class PlaceBehaviour extends Component {
|
||||
|
||||
/**
|
||||
* @param entity
|
||||
* @param blockContainer
|
||||
*/
|
||||
public PlaceBehaviour(Entity entity, BlockContainer blockContainer) {
|
||||
super(entity, blockContainer);
|
||||
}
|
||||
@@ -34,7 +30,7 @@ public class PlaceBehaviour extends Component {
|
||||
item.setPart(i, i1, new Square());
|
||||
}
|
||||
}
|
||||
parent.getChildren().add(item);
|
||||
// parent.getChildren().add(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -76,12 +76,10 @@ public class PlayerManager {
|
||||
|
||||
double offset = Chunk.CHUNK_SIZE * Chunk.ENTITY_SIZE;
|
||||
|
||||
int loadedChunksX = (int) Math.ceil(world.getScene().getWidth() / Chunk.CHUNK_SIZE / Chunk.ENTITY_SIZE) + 1;
|
||||
int loadedChunksY = (int) Math.ceil(world.getScene().getHeight() / Chunk.CHUNK_SIZE / Chunk.ENTITY_SIZE) + 1;
|
||||
|
||||
//TODO: Calculate amount of chunks based on window size
|
||||
|
||||
int loadedChunksX = 5;
|
||||
int loadedChunksY = 5;
|
||||
|
||||
System.out.println("X:" + loadedChunksX + " Y:" + loadedChunksY);
|
||||
|
||||
int chunkX = -(int) Math.floor((world.getTranslateX() + offset) / Chunk.CHUNK_SIZE / Chunk.ENTITY_SIZE);
|
||||
int chunkY = -(int) Math.floor((world.getTranslateY() + offset) / Chunk.CHUNK_SIZE / Chunk.ENTITY_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user