New engine flag and some other stuff.

This commit is contained in:
Kapendev 2025-04-16 04:54:13 +03:00
parent ce52c4cee4
commit cb0cb5a904
5 changed files with 72 additions and 38 deletions

View file

@ -5,7 +5,7 @@ import parin;
auto atlas = TextureId();
auto map = TileMap();
auto camera = Camera(0, 0, true);
auto tile = Tile(16, 16, 145);
auto tile = Tile(16, 145);
auto tileFlip = Flip.none;
void ready() {
@ -24,15 +24,15 @@ bool update(float dt) {
foreach (point; map.gridPoints(camera.area)) {
if (map[point] < 0) continue;
auto area = Rect(map.toWorldPoint(point), map.tileSize);
while (area.hasIntersection(tile.area)) {
while (area.hasIntersection(Rect(tile.position, tile.size))) {
tile.position -= wasd * Vec2(dt);
camera.position = tile.position + tile.size * Vec2(0.5f);
}
}
// Draw the world.
camera.attach();
drawTile(atlas, tile, DrawOptions(tileFlip));
drawTileMap(atlas, map, camera);
drawTile(atlas, tile, DrawOptions(tileFlip));
camera.detach();
return false;
}