mirror of
https://github.com/Kapendev/parin.git
synced 2025-04-26 04:59:54 +03:00
New engine flag and some other stuff.
This commit is contained in:
parent
ce52c4cee4
commit
cb0cb5a904
5 changed files with 72 additions and 38 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue