Added custom cursors

This commit is contained in:
2019-10-27 11:43:15 -05:00
parent a95849d5c7
commit cd7b71894d
12 changed files with 475 additions and 3 deletions

BIN
assets/cursors/attack.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

BIN
assets/cursors/move.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

BIN
assets/cursors/pointer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
assets/cursors/repair.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

BIN
assets/cursors/sell.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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="24"
height="24"
viewBox="0 0 6.35 6.3500002"
version="1.1"
id="svg8"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
sodipodi:docname="attack.svg"
inkscape:export-filename="/home/cyberarm/Code/i-mic-rts/assets/cursors/attack.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="16"
inkscape:cx="-1.7874162"
inkscape:cy="13.39135"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:showpageshadow="false"
inkscape:window-width="1920"
inkscape:window-height="1006"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true">
<inkscape:grid
type="xygrid"
id="grid815"
empspacing="8" />
</sodipodi:namedview>
<metadata
id="metadata5">
<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></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-290.64999)">
<path
style="fill:#a40000;stroke:#000000;stroke-width:0.26458335px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;paint-order:stroke fill markers"
d="M 3.9687501,290.91457 H 2.38125 l 0.79375,1.5875 z"
id="path1660"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:#a40000;stroke:#000000;stroke-width:0.26458335px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;paint-order:stroke fill markers"
d="M 2.38125,296.73541 H 3.9687501 L 3.175,295.14791 Z"
id="path1660-9"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:#a40000;stroke:#000000;stroke-width:0.26458335px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;paint-order:stroke fill markers"
d="m 6.0854201,294.61874 v -1.5875 l -1.5875,0.79375 z"
id="path1660-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:#a40000;stroke:#000000;stroke-width:0.26458335px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;paint-order:stroke fill markers"
d="m 0.26458006,293.03124 v 1.5875 l 1.58750004,-0.79375 z"
id="path1660-9-0"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<circle
style="fill:#a40000;fill-opacity:1;stroke:#000000;stroke-width:0.26458335;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill"
id="path1695"
cx="3.175"
cy="293.82498"
r="0.39687502" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

102
assets/svg/cursors/move.svg Normal file
View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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="24"
height="24"
viewBox="0 0 6.35 6.3500002"
version="1.1"
id="svg8"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
sodipodi:docname="move.svg"
inkscape:export-filename="/home/cyberarm/Code/i-mic-rts/assets/cursors/move.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.313709"
inkscape:cx="2.5988667"
inkscape:cy="17.551112"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:showpageshadow="false"
inkscape:window-width="1920"
inkscape:window-height="1006"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true">
<inkscape:grid
type="xygrid"
id="grid815"
empspacing="8" />
</sodipodi:namedview>
<metadata
id="metadata5">
<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"
transform="translate(0,-290.64999)">
<path
style="fill:#8ae234;stroke:#000000;stroke-width:0.26458335px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;paint-order:stroke fill markers"
d="M 3.9687501,290.91457 H 2.38125 l 0.79375,1.5875 z"
id="path1660"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:#8ae234;stroke:#000000;stroke-width:0.26458335px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;paint-order:stroke fill markers"
d="M 2.38125,296.73541 H 3.9687501 L 3.175,295.14791 Z"
id="path1660-9"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:#8ae234;stroke:#000000;stroke-width:0.26458335px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;paint-order:stroke fill markers"
d="m 6.0854201,294.61874 v -1.5875 l -1.5875,0.79375 z"
id="path1660-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:#8ae234;stroke:#000000;stroke-width:0.26458335px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;paint-order:stroke fill markers"
d="m 0.26458006,293.03124 v 1.5875 l 1.58750004,-0.79375 z"
id="path1660-9-0"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<circle
style="fill:#8ae234;fill-opacity:1;stroke:#000000;stroke-width:0.26458335;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill"
id="path1695"
cx="3.175"
cy="293.82498"
r="0.39687502" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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="24"
height="24"
viewBox="0 0 6.35 6.3500002"
version="1.1"
id="svg8"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
sodipodi:docname="pointer.svg"
inkscape:export-filename="/home/cyberarm/Code/i-mic-rts/assets/cursors/pointer.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="4.6561557"
inkscape:cy="9.4210568"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:showpageshadow="false"
inkscape:window-width="1920"
inkscape:window-height="1006"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid815"
empspacing="8" />
</sodipodi:namedview>
<metadata
id="metadata5">
<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></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-290.64999)">
<path
style="fill:#2e3436;stroke:none;stroke-width:0.37417737px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 2.9104231,295.67708 5.02709,293.56041 3.7041765,294.35417 Z"
id="path847"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
style="fill:#888a85;stroke:none;stroke-width:0.37417737px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 6.18e-6,290.64999 2.38125022,6.08542 1.3229168,-2.38125 z"
id="path817" />
<path
style="fill:#d3d7cf;stroke:none;stroke-width:0.37417737px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 6.1883327e-6,290.65 3.7041766,294.35417 6.0854202,293.03124 Z"
id="path819-3"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.26458334;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;paint-order:normal"
d="M 6.0854168,293.03124 0,290.64999 l 2.3812501,6.08542 1.3229166,-2.38125 z"
id="path876"
inkscape:connector-curvature="0"
inkscape:export-filename="/home/cyberarm/Code/i-mic-rts/assets/cursors/path876.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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="24"
height="24"
viewBox="0 0 6.35 6.3500002"
version="1.1"
id="svg8"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
sodipodi:docname="repair.svg"
inkscape:export-filename="/home/cyberarm/Code/i-mic-rts/assets/cursors/repair.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="5.0422067"
inkscape:cy="10.994319"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:showpageshadow="false"
inkscape:window-width="1920"
inkscape:window-height="1006"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true">
<inkscape:grid
type="xygrid"
id="grid815"
empspacing="8" />
</sodipodi:namedview>
<metadata
id="metadata5">
<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"
transform="translate(0,-290.64999)">
<path
style="fill:#888a85;fill-opacity:1;stroke:#000000;stroke-width:0.27986193;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill"
d="m 4.3623536,291.0545 -0.7915691,0.79156 c -0.1978922,0.1979 -0.3957844,0.79157 -0.1978922,0.98948 l -2.9683838,2.96837 0.7915691,0.79157 2.9683837,-2.96838 c 0.1978923,0.19788 0.791569,0 0.9894613,-0.1979 l 0.791569,-0.79157 -0.3957846,-0.39578 -0.791569,0.79158 c 0,0 -0.1978922,0.19789 -0.3957844,0 l -0.3957846,-0.3958 c -0.1978922,-0.19788 0,-0.39578 0,-0.39578 l 0.791569,-0.79157 z m -2.866525,4.44967 c 0.1374205,0.13741 0.1374205,0.36021 0,0.49764 -0.1374206,0.13742 -0.3602228,0.13742 -0.49764334,0 -0.13742045,-0.13743 -0.13742045,-0.36023 0,-0.49764 0.13742054,-0.13743 0.36022274,-0.13743 0.49764334,0 z"
id="rect1597"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccccccsssss" />
<path
style="fill:#babdb6;fill-opacity:1;stroke:none;stroke-width:0.27986193;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill"
d="m 4.3615963,291.05399 -0.7914788,0.79148 c -0.1978941,0.1979 -0.3959434,0.79161 -0.1980493,0.98952 l -2.968208,2.96821 0.39573633,0.39573 0.19768585,-0.19768 c -0.13742525,-0.13743 -0.13741485,-0.36028 2.4e-6,-0.49769 0.13742162,-0.13743 0.36026242,-0.13743 0.49768762,0 l 2.6685715,-2.66857 -0.1980509,-0.19806 c -0.1978862,-0.19788 3.61e-4,-0.39573 3.61e-4,-0.39573 l 0.7914788,-0.79148 z"
id="path3457"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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="24"
height="24"
viewBox="0 0 6.35 6.3500002"
version="1.1"
id="svg8"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
sodipodi:docname="sell.svg"
inkscape:export-filename="/home/cyberarm/Code/i-mic-rts/assets/cursors/sell.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="16"
inkscape:cx="-6.3469363"
inkscape:cy="11.061168"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:showpageshadow="false"
inkscape:window-width="1920"
inkscape:window-height="1006"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true">
<inkscape:grid
type="xygrid"
id="grid815"
empspacing="8" />
</sodipodi:namedview>
<metadata
id="metadata5">
<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"
transform="translate(0,-290.64999)">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.89141893px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;fill:#f57900;fill-opacity:1;stroke:#000000;stroke-width:0.26458334;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill"
x="0.9012059"
y="303.51636"
id="text1576"
transform="scale(1.0257972,0.97485154)"><tspan
sodipodi:role="line"
id="tspan1574"
x="0.9012059"
y="303.51636"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.89141893px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';fill:#f57900;stroke:#000000;stroke-width:0.26458334;stroke-miterlimit:2;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill">$</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -33,12 +33,12 @@ class IMICRTS
end
end
flow do
button("Accept", width: 0.4) do
flow(width: 1.0) do
button("Accept", width: 0.5) do
push_state(Game)
end
button("Back", width: 0.4, margin_left: 20) do
button("Back", align: :right) do
push_state(MainMenu)
end
end

View File

@@ -4,6 +4,7 @@ class IMICRTS
def setup
@last_update_time = Gosu.milliseconds
@mouse = CyberarmEngine::Vector.new
@cursor = Gosu::Image.new("#{IMICRTS::ASSETS_PATH}/cursors/pointer.png")
self.caption = "#{IMICRTS::NAME} (#{IMICRTS::VERSION} #{IMICRTS::VERSION_NAME})"
if ARGV.join.include?("--debug-game")
@@ -15,6 +16,12 @@ class IMICRTS
end
end
def draw
@cursor.draw(mouse_x, mouse_y, Float::INFINITY)
super
end
def update
@mouse.x, @mouse.y = self.mouse_x, self.mouse_y
super
@@ -22,6 +29,10 @@ class IMICRTS
@last_update_time = Gosu.milliseconds
end
def needs_cursor?
return false
end
def close
push_state(Closing) unless current_state.is_a?(Closing)
end