Add cursors
This commit is contained in:
@@ -94,7 +94,7 @@ void inputUnitAction(Game *game, InputState *input) {
|
||||
input->cursor = CURSOR_COLLECT_GOLD;
|
||||
break;
|
||||
case RES_FOOD:
|
||||
//input->cursor = CURSOR_COLLECT_FOOD;
|
||||
input->cursor = CURSOR_FARM;
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
@@ -343,22 +343,37 @@ void drawPlayerInputUI() {
|
||||
DrawRectangleLines(area.x, area.y, area.width, area.height, RED);
|
||||
}
|
||||
|
||||
Vector2 point = input->mouseWorld;
|
||||
Rectangle texRect = {0, 0, 0, 0};
|
||||
switch (input->cursor) {
|
||||
case CURSOR_COLLECT_WOOD: {
|
||||
const Vector2 point = input->mouseWorld;
|
||||
DrawCircle(point.x, point.y, 2.0f, RED);
|
||||
DrawText("Collect wood", point.x, point.y, 10.0f, RED);
|
||||
case CURSOR_COLLECT_WOOD:
|
||||
texRect = getTextureRect(getItemTile(ITEM_AXE));
|
||||
break;
|
||||
}
|
||||
case CURSOR_COLLECT_GOLD: {
|
||||
const Vector2 point = input->mouseWorld;
|
||||
DrawCircle(point.x, point.y, 2.0f, RED);
|
||||
DrawText("Collect gold", point.x, point.y, 10.0f, RED);
|
||||
case CURSOR_COLLECT_GOLD:
|
||||
texRect = getTextureRect(getItemTile(ITEM_PICKAXE));
|
||||
break;
|
||||
case CURSOR_FARM:
|
||||
texRect = getTextureRect(getItemTile(ITEM_SYTHE));
|
||||
break;
|
||||
case CURSOR_ATTACK:
|
||||
texRect = getTextureRect(getItemTile(ITEM_CUTLASS));
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (texRect.width != 0 && texRect.height != 0) {
|
||||
Texture tiles = game->tileset.tiles;
|
||||
f32 size = 35.0 / game->camera.zoom;
|
||||
Rectangle dst = {
|
||||
point.x - size * 0.5f,
|
||||
point.y - size * 0.5f,
|
||||
size, size
|
||||
};
|
||||
point.y -= texRect.height;
|
||||
|
||||
DrawTexturePro(tiles, texRect, dst, Vector2Zero(), 0.0f, WHITE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ecs_entity_t queryEntity(BzSpatialGrid *entityGrid, Vector2 point, ecs_entity_t tag) {
|
||||
|
||||
Reference in New Issue
Block a user