add compass background

This commit is contained in:
whosit 2021-05-28 14:13:03 +03:00
parent b49427f283
commit 99fd9076e7
13 changed files with 85 additions and 3 deletions

65
compass_arrow.svg Normal file
View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="32.0px"
height="32.0px"
viewBox="0 0 32.0 32.0"
version="1.1"
id="SVGRoot"
sodipodi:docname="compass_arrow.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<defs
id="defs58" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="31.678384"
inkscape:cx="15.467295"
inkscape:cy="17.482307"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="true"
inkscape:window-width="2556"
inkscape:window-height="1416"
inkscape:window-x="1280"
inkscape:window-y="20"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid67"
empspacing="8" />
</sodipodi:namedview>
<metadata
id="metadata61">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:7.7;stroke-dasharray:none;stroke-opacity:1"
d="M 16,19 18,16 16,4 14,16 Z"
id="path76"
sodipodi:nodetypes="ccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -98,7 +98,8 @@ local function hide_hud_waypoint(player)
local player_name = player:get_player_name()
local hud = player_waypoints[player_name]
player_waypoints[player_name] = nil
hud:hide(player)
hud.waypoint:hide(player)
player:hud_remove(hud.background)
end
@ -120,6 +121,13 @@ local function show_hud_waypoint(player, compass_item_meta)
local size = {x=-9, y=-16}
local alignment = {x=100/9*1.47,y=100/16*1.63} -- near compass in your hand
local background = player:hud_add({
hud_elem_type = "image",
scale = size,
text = "waypoint_compass_background.png",
alignment = alignment,
})
local waypoint = waypoint_lib.WaypointHUD:new(player, waypoint_pos,
waypoint_name, waypoint_color,
@ -134,7 +142,7 @@ local function show_hud_waypoint(player, compass_item_meta)
player_name ..
" got their HUD stuck on screen?")
end
player_waypoints[player_name] = waypoint
player_waypoints[player_name] = {waypoint = waypoint, background = background}
end
@ -151,7 +159,7 @@ local function update_hud_waypoint(player, itemstack, force)
local waypoint_pos = get_compass_meta_pos(meta)
-- remove different waypoint if it exists
if player_waypoints[player_name] and
(player_waypoints[player_name].point_pos ~= waypoint_pos
(player_waypoints[player_name].waypoint.point_pos ~= waypoint_pos
or force
or not get_compass_meta_is_set(meta)) then

9
make_compass_textures.sh Normal file
View File

@ -0,0 +1,9 @@
input="compass_arrow.svg"
size=64
angles=9
for rot in `seq 0 $((angles - 1))`; do
#inkscape -w ${size} -h ${size} compass_arrow.svg -o "$out"
angle=$((90 / angles * rot))
out="textures/waypoint_compass_arrow_"$(printf "%03d" $angle)".png"
convert -density 384 -background none -distort SRT $angle -gravity center -resize ${size}x${size} "$input" "$out"
done

Binary file not shown.

Before

Width:  |  Height:  |  Size: 801 B

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 932 B

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 933 B

After

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 900 B

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 939 B

After

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 925 B

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 935 B

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 887 B

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 898 B

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB