Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HUD image (waypoint) docs #14235

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 12 additions & 8 deletions doc/lua_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1678,10 +1678,12 @@ type are ignored.

Displays an image on the HUD.

* `scale`: The scale of the image, with 1 being the original texture size.
Only the X coordinate scale is used (positive values).
Negative values represent that percentage of the screen it
should take; e.g. `x=-100` means 100% (width).
* `scale`: The scale of the image, with `{x = 1, y = 1}` being the original texture size.
appgurueu marked this conversation as resolved.
Show resolved Hide resolved
The `x` and `y` fields apply to the respective axes.
Positive values scale the source image.
Negative values represent percentages relative to screen dimensions.
Example: `{x = -20, y = 3}` means the image will be drawn 20% of screen width wide,
and 3 times as high as the source image is.
* `text`: The name of the texture that is displayed.
* `alignment`: The alignment of the image.
* `offset`: offset in pixels from position.
Expand Down Expand Up @@ -1748,10 +1750,12 @@ Displays distance to selected world position.

Same as `image`, but does not accept a `position`; the position is instead determined by `world_pos`, the world position of the waypoint.

* `scale`: The scale of the image, with 1 being the original texture size.
Only the X coordinate scale is used (positive values).
Negative values represent that percentage of the screen it
should take; e.g. `x=-100` means 100% (width).
* `scale`: The scale of the image, with `{x = 1, y = 1}` being the original texture size.
The `x` and `y` fields apply to the respective axes.
Positive values scale the source image.
Negative values represent percentages relative to screen dimensions.
Example: `{x = -20, y = 3}` means the image will be drawn 20% of screen width wide,
and 3 times as high as the source image is.
* `text`: The name of the texture that is displayed.
* `alignment`: The alignment of the image.
* `world_pos`: World position of the waypoint.
Expand Down
3 changes: 2 additions & 1 deletion games/devtest/mods/testhud/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ minetest.register_chatcommand("hudwaypoints", {
type = "image_waypoint",
text = "testhud_waypoint.png",
world_pos = player:get_pos(),
scale = {x = 3, y = 3},
-- 20% of screen width, 3x image height
scale = {x = -20, y = 3},
offset = {x = 0, y = -32}
}
if not player_waypoints[name] then
Expand Down