add better reticule, properly toggle visibility

This commit is contained in:
yuni 2024-04-28 03:15:20 +02:00
parent fc4cc8cdad
commit 310be85e05
3 changed files with 107 additions and 12 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

92
media/reticule4.svg Normal file
View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="200"
height="200"
viewBox="0 0 52.916666 52.916666"
version="1.1"
id="svg1"
sodipodi:docname="reticule4.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
inkscape:export-filename="reticule4.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#000000"
bordercolor="#999999"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="4.395"
inkscape:cx="85.324232"
inkscape:cy="125.25597"
inkscape:window-width="2880"
inkscape:window-height="1685"
inkscape:window-x="0"
inkscape:window-y="80"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
inkscape:export-bgcolor="#00000000" />
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="font-variation-settings:'wght' 700;fill:none;stroke:#bf1351;stroke-width:1.32291667;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
id="path2-2"
sodipodi:type="arc"
sodipodi:cx="26.458332"
sodipodi:cy="26.45833"
sodipodi:rx="24.89185"
sodipodi:ry="24.891848"
sodipodi:start="1.0471976"
sodipodi:end="2.0943951"
sodipodi:open="true"
sodipodi:arc-type="arc"
d="m 38.904256,48.015303 a 24.89185,24.891848 0 0 1 -24.891849,0" />
<ellipse
style="font-variation-settings:'wght' 700;fill:#bf1351;fill-opacity:1;stroke:none;stroke-width:1.05833333;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
id="path3"
cx="26.458332"
cy="26.45833"
rx="1.0895884"
ry="1.0895883" />
<path
style="font-variation-settings:'wght' 700;fill:none;stroke:#bf1351;stroke-width:1.32291667;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
id="path2-2-9-9"
sodipodi:type="arc"
sodipodi:cx="26.458332"
sodipodi:cy="26.45833"
sodipodi:rx="24.89185"
sodipodi:ry="24.891848"
sodipodi:start="5.4105207"
sodipodi:end="6.1086524"
sodipodi:open="true"
sodipodi:arc-type="arc"
d="M 42.458505,7.3900689 A 24.89185,24.891848 0 0 1 50.972018,22.135906" />
<path
style="font-variation-settings:'wght' 700;fill:none;stroke:#bf1351;stroke-width:1.32291667;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
id="path2-2-9-9-1-7"
sodipodi:type="arc"
sodipodi:cx="26.458332"
sodipodi:cy="26.45833"
sodipodi:rx="24.89185"
sodipodi:ry="24.891848"
sodipodi:start="3.3161256"
sodipodi:end="4.0142573"
sodipodi:open="true"
sodipodi:arc-type="arc"
d="M 1.9446458,22.135906 A 24.89185,24.891848 0 0 1 10.45816,7.3900683" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -290,28 +290,31 @@ fn setup(
});
// Add Reticule
let reticule_handle: Handle<Image> = asset_server.load("sprites/reticule3.png");
commands.spawn(NodeBundle {
style: Style {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
align_items: AlignItems::Center,
justify_content: JustifyContent::SpaceAround,
let reticule_handle: Handle<Image> = asset_server.load("sprites/reticule4.png");
commands.spawn((
NodeBundle {
style: Style {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
align_items: AlignItems::Center,
justify_content: JustifyContent::SpaceAround,
..default()
},
visibility,
..default()
},
..default()
}).with_children(|builder| {
ToggleableHudElement,
)).with_children(|builder| {
builder.spawn((
ImageBundle {
image: UiImage::new(reticule_handle),
style: Style {
width: Val::VMin(3.0),
height: Val::VMin(3.0),
width: Val::VMin(5.0),
height: Val::VMin(5.0),
..Default::default()
},
..Default::default()
},
ToggleableHudElement,
Reticule,
));
});