Add basic movement
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user