Add basic movement

This commit is contained in:
2023-11-12 19:04:25 +01:00
parent 526d292fb5
commit bf543330e5
10 changed files with 52 additions and 5 deletions

View File

@@ -85,6 +85,7 @@ bool init(Game *game) {
ECS_SYSTEM(ECS, updateAnimations, EcsOnUpdate, Animation, TextureRegion);
ECS_SYSTEM(ECS, renderEntities, EcsOnUpdate, Position, Size, Rotation, TextureRegion);
ECS_SYSTEM(ECS, updatePos, EcsOnUpdate, Position, TextureRegion);
return true;
}
@@ -119,6 +120,8 @@ void update(float dt, Game *game) {
game->camera.zoom += ((float) GetMouseWheelMove() * 0.05f);
Vector2 worldPos = GetScreenToWorld2D(GetMousePosition(), game->camera);
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
game->targetPos = worldPos;
int tileX = (int) worldPos.x / 16;
int tileY = (int) worldPos.y / 16;
@@ -165,7 +168,7 @@ void imguiRender(float dt, Game *game) {
}
if (igCollapsingHeader_TreeNodeFlags("Entities", 0)) {
igSliderFloat("Frame duration", &game->frameDuration, 0.0f, 1.0f, NULL, 0);
}
igEnd();
igShowDemoWindow(NULL);