reorganize playfield and linear view textures
BIN
assets/textures/density graph/dots.png
Normal file
After Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.6 MiB |
BIN
assets/textures/playfield/button.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
assets/textures/playfield/collision.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
assets/textures/playfield/selected.png
Normal file
After Width: | Height: | Size: 9.1 KiB |
112
images/button.svg
Normal file
@ -0,0 +1,112 @@
|
||||
<?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.916665 52.916668"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
sodipodi:docname="button.svg"
|
||||
inkscape:export-filename="/home/symeon/Projets/feis/assets/textures/playfield/button.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="namedview7"
|
||||
pagecolor="#808080"
|
||||
bordercolor="#cccccc"
|
||||
borderopacity="1"
|
||||
inkscape:pageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="true"
|
||||
units="px"
|
||||
width="200px"
|
||||
inkscape:zoom="2.1064798"
|
||||
inkscape:cx="97.556122"
|
||||
inkscape:cy="58.865981"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1012"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid824"
|
||||
spacingx="2.6458333"
|
||||
spacingy="2.6458333"
|
||||
empspacing="10" />
|
||||
</sodipodi:namedview>
|
||||
<defs
|
||||
id="defs2">
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow"
|
||||
id="filter2632"
|
||||
x="-0.136063"
|
||||
y="-0.136063"
|
||||
width="1.272126"
|
||||
height="1.272126">
|
||||
<feFlood
|
||||
flood-opacity="1"
|
||||
flood-color="rgb(0,0,0)"
|
||||
result="flood"
|
||||
id="feFlood2622" />
|
||||
<feComposite
|
||||
in="flood"
|
||||
in2="SourceGraphic"
|
||||
operator="out"
|
||||
result="composite1"
|
||||
id="feComposite2624" />
|
||||
<feGaussianBlur
|
||||
in="composite1"
|
||||
stdDeviation="3"
|
||||
result="blur"
|
||||
id="feGaussianBlur2626" />
|
||||
<feOffset
|
||||
dx="0"
|
||||
dy="0"
|
||||
result="offset"
|
||||
id="feOffset2628" />
|
||||
<feComposite
|
||||
in="offset"
|
||||
in2="SourceGraphic"
|
||||
operator="in"
|
||||
result="composite2"
|
||||
id="feComposite2630" />
|
||||
</filter>
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Calque 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<path
|
||||
id="rect1000"
|
||||
style="display:inline;fill:#ffffff;fill-opacity:0.260019;stroke-width:16.252;stroke-linejoin:round;stroke-opacity:0.335246;paint-order:markers stroke fill"
|
||||
d="M 0,0 V 200 H 200 V 0 Z M 28.888672,20 H 171.11133 C 176.03577,20 180,23.964228 180,28.888672 V 171.11133 C 180,176.03577 176.03577,180 171.11133,180 H 28.888672 C 23.964228,180 20,176.03577 20,171.11133 V 28.888672 C 20,23.964228 23.964228,20 28.888672,20 Z"
|
||||
transform="scale(0.26458333)"
|
||||
inkscape:export-filename="/home/symeon/Projets/feis/assets/textures/edit_textures/button.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96" />
|
||||
<path
|
||||
id="rect848"
|
||||
style="fill:#000000;fill-opacity:0.817194;stroke-width:16.252;stroke-linejoin:round;stroke-opacity:0.335246;paint-order:markers stroke fill"
|
||||
d="M 0,0 V 200 H 200 V 0 Z m 20,10 h 160 c 5.54,0 10,4.46 10,10 v 160 c 0,5.54 -4.46,10 -10,10 H 20 c -5.54,0 -10,-4.46 -10,-10 V 20 c 0,-5.54 4.46,-10 10,-10 z"
|
||||
transform="scale(0.26458333)" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1;stroke-width:4.30001;stroke-linejoin:round;stroke-opacity:0.335246;paint-order:markers stroke fill;filter:url(#filter2632)"
|
||||
id="rect2092"
|
||||
width="52.916664"
|
||||
height="52.916664"
|
||||
x="0"
|
||||
y="0"
|
||||
ry="0" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.7 KiB |
153
images/collision.svg
Normal file
@ -0,0 +1,153 @@
|
||||
<?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.916665 52.916668"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
sodipodi:docname="collision.svg"
|
||||
inkscape:export-filename="/home/symeon/Projets/feis/assets/textures/playfield/collision.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:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#000000"
|
||||
bordercolor="#cccccc"
|
||||
borderopacity="1"
|
||||
inkscape:pageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="false"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="true"
|
||||
units="px"
|
||||
width="200px"
|
||||
inkscape:zoom="2.9790123"
|
||||
inkscape:cx="96.508497"
|
||||
inkscape:cy="123.53088"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1012"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:object-paths="true">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid824"
|
||||
spacingx="2.6458333"
|
||||
spacingy="2.6458333"
|
||||
empspacing="10" />
|
||||
</sodipodi:namedview>
|
||||
<defs
|
||||
id="defs2">
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow"
|
||||
id="filter12090"
|
||||
x="-0.050393701"
|
||||
y="-0.050393701"
|
||||
width="1.1007874"
|
||||
height="1.1007874">
|
||||
<feFlood
|
||||
flood-opacity="1"
|
||||
flood-color="rgb(255,249,0)"
|
||||
result="flood"
|
||||
id="feFlood12080" />
|
||||
<feComposite
|
||||
in="SourceGraphic"
|
||||
in2="flood"
|
||||
operator="in"
|
||||
result="composite1"
|
||||
id="feComposite12082" />
|
||||
<feGaussianBlur
|
||||
in="composite1"
|
||||
stdDeviation="1"
|
||||
result="blur"
|
||||
id="feGaussianBlur12084" />
|
||||
<feOffset
|
||||
dx="0"
|
||||
dy="0"
|
||||
result="offset"
|
||||
id="feOffset12086" />
|
||||
<feComposite
|
||||
in="offset"
|
||||
in2="SourceGraphic"
|
||||
operator="out"
|
||||
result="composite2"
|
||||
id="feComposite12088" />
|
||||
</filter>
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow"
|
||||
id="filter12310"
|
||||
x="-0.2015748"
|
||||
y="-0.2015748"
|
||||
width="1.4031496"
|
||||
height="1.4031496">
|
||||
<feFlood
|
||||
flood-opacity="1"
|
||||
flood-color="rgb(255,249,0)"
|
||||
result="flood"
|
||||
id="feFlood12300" />
|
||||
<feComposite
|
||||
in="flood"
|
||||
in2="SourceGraphic"
|
||||
operator="out"
|
||||
result="composite1"
|
||||
id="feComposite12302" />
|
||||
<feGaussianBlur
|
||||
in="composite1"
|
||||
stdDeviation="4"
|
||||
result="blur"
|
||||
id="feGaussianBlur12304" />
|
||||
<feOffset
|
||||
dx="0"
|
||||
dy="0"
|
||||
result="offset"
|
||||
id="feOffset12306" />
|
||||
<feComposite
|
||||
in="SourceGraphic"
|
||||
in2="offset"
|
||||
operator="in"
|
||||
result="composite2"
|
||||
id="feComposite12308" />
|
||||
</filter>
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Calque 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<rect
|
||||
style="fill:#ff0014;fill-opacity:1;stroke:none;stroke-width:0.2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill;filter:url(#filter12090)"
|
||||
id="rect11366"
|
||||
width="47.625"
|
||||
height="47.625"
|
||||
x="2.6458333"
|
||||
y="2.6458333"
|
||||
ry="2.6458333" />
|
||||
<rect
|
||||
style="display:inline;fill:#ff0014;fill-opacity:1;stroke:none;stroke-width:0.2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill;filter:url(#filter12310)"
|
||||
id="rect12110"
|
||||
width="47.625"
|
||||
height="47.625"
|
||||
x="2.6458333"
|
||||
y="2.6458333"
|
||||
ry="2.6458333" />
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#rect12110"
|
||||
id="use12403"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.3 KiB |
82
images/density graph dots.svg
Normal file
@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="48"
|
||||
height="24"
|
||||
viewBox="0 0 12.7 6.3500002"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
sodipodi:docname="linear view dots.svg"
|
||||
inkscape:export-filename="/home/symeon/Projets/feis/assets/textures/linear view/dots.png"
|
||||
inkscape:export-xdpi="24"
|
||||
inkscape:export-ydpi="24"
|
||||
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="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#cccccc"
|
||||
borderopacity="1"
|
||||
inkscape:pageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="true"
|
||||
units="px"
|
||||
width="10px"
|
||||
inkscape:zoom="11.313708"
|
||||
inkscape:cx="31.333669"
|
||||
inkscape:cy="7.9549513"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1012"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid824"
|
||||
spacingx="0.52916666"
|
||||
spacingy="0.52916666"
|
||||
empspacing="12" />
|
||||
</sodipodi:namedview>
|
||||
<defs
|
||||
id="defs2" />
|
||||
<g
|
||||
inkscape:label="Calque 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<rect
|
||||
style="fill:#dadada;fill-opacity:1;stroke-width:0.8;stroke-linejoin:round;paint-order:markers stroke fill"
|
||||
id="rect1422"
|
||||
width="4.2333331"
|
||||
height="4.2333331"
|
||||
x="1.0583332"
|
||||
y="1.0583333" />
|
||||
<rect
|
||||
style="fill:#a5a5a5;fill-opacity:1;stroke-width:0.2;stroke-linejoin:round;paint-order:markers stroke fill"
|
||||
id="rect1902"
|
||||
width="2.1166666"
|
||||
height="2.1166666"
|
||||
x="2.1166666"
|
||||
y="2.1166668" />
|
||||
<rect
|
||||
style="fill:#d70034;fill-opacity:1;stroke-width:2.11666667;stroke-linejoin:bevel;paint-order:stroke fill markers;stroke-miterlimit:4;stroke-dasharray:none;stroke:#aa002a;stroke-opacity:1"
|
||||
id="rect3864"
|
||||
width="4.2333331"
|
||||
height="4.2333331"
|
||||
x="7.4083333"
|
||||
y="1.0583332" />
|
||||
<rect
|
||||
style="fill:#ff003d;fill-opacity:1;stroke-width:0.2;stroke-linejoin:round;paint-order:markers stroke fill"
|
||||
id="rect3866"
|
||||
width="2.1166666"
|
||||
height="2.1166666"
|
||||
x="8.4666662"
|
||||
y="2.1166666" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.5 KiB |
153
images/selected.svg
Normal file
@ -0,0 +1,153 @@
|
||||
<?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.916665 52.916668"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
sodipodi:docname="selected.svg"
|
||||
inkscape:export-filename="/home/symeon/Projets/feis/assets/textures/playfield/selected.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:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#000000"
|
||||
bordercolor="#cccccc"
|
||||
borderopacity="1"
|
||||
inkscape:pageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="false"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="true"
|
||||
units="px"
|
||||
width="200px"
|
||||
inkscape:zoom="2.1064798"
|
||||
inkscape:cx="96.606671"
|
||||
inkscape:cy="123.42867"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1012"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:object-paths="true">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid824"
|
||||
spacingx="2.6458333"
|
||||
spacingy="2.6458333"
|
||||
empspacing="10" />
|
||||
</sodipodi:namedview>
|
||||
<defs
|
||||
id="defs2">
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow"
|
||||
id="filter11162"
|
||||
x="-0.2015748"
|
||||
y="-0.2015748"
|
||||
width="1.4031496"
|
||||
height="1.4031496">
|
||||
<feFlood
|
||||
flood-opacity="1"
|
||||
flood-color="rgb(255,249,0)"
|
||||
result="flood"
|
||||
id="feFlood11152" />
|
||||
<feComposite
|
||||
in="flood"
|
||||
in2="SourceGraphic"
|
||||
operator="out"
|
||||
result="composite1"
|
||||
id="feComposite11154" />
|
||||
<feGaussianBlur
|
||||
in="composite1"
|
||||
stdDeviation="4"
|
||||
result="blur"
|
||||
id="feGaussianBlur11156" />
|
||||
<feOffset
|
||||
dx="0"
|
||||
dy="0"
|
||||
result="offset"
|
||||
id="feOffset11158" />
|
||||
<feComposite
|
||||
in="offset"
|
||||
in2="SourceGraphic"
|
||||
operator="in"
|
||||
result="composite2"
|
||||
id="feComposite11160" />
|
||||
</filter>
|
||||
<filter
|
||||
style="color-interpolation-filters:sRGB;"
|
||||
inkscape:label="Drop Shadow"
|
||||
id="filter11626"
|
||||
x="-0.050393701"
|
||||
y="-0.050393701"
|
||||
width="1.1007874"
|
||||
height="1.1007874">
|
||||
<feFlood
|
||||
flood-opacity="1"
|
||||
flood-color="rgb(255,249,0)"
|
||||
result="flood"
|
||||
id="feFlood11616" />
|
||||
<feComposite
|
||||
in="flood"
|
||||
in2="SourceGraphic"
|
||||
operator="in"
|
||||
result="composite1"
|
||||
id="feComposite11618" />
|
||||
<feGaussianBlur
|
||||
in="composite1"
|
||||
stdDeviation="1"
|
||||
result="blur"
|
||||
id="feGaussianBlur11620" />
|
||||
<feOffset
|
||||
dx="0"
|
||||
dy="0"
|
||||
result="offset"
|
||||
id="feOffset11622" />
|
||||
<feComposite
|
||||
in="offset"
|
||||
in2="SourceGraphic"
|
||||
operator="out"
|
||||
result="composite2"
|
||||
id="feComposite11624" />
|
||||
</filter>
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Calque 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<rect
|
||||
style="display:inline;fill:#fff700;fill-opacity:1;stroke:none;stroke-width:0.2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill;filter:url(#filter11162)"
|
||||
id="rect10946"
|
||||
width="47.625"
|
||||
height="47.625"
|
||||
x="2.6458333"
|
||||
y="2.6458333"
|
||||
ry="2.6458333" />
|
||||
<rect
|
||||
style="display:inline;fill:#fff700;fill-opacity:1;stroke:none;stroke-width:0.2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill;filter:url(#filter11626)"
|
||||
id="rect11366"
|
||||
width="47.625"
|
||||
height="47.625"
|
||||
x="2.6458333"
|
||||
y="2.6458333"
|
||||
ry="2.6458333" />
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#rect10946"
|
||||
id="use3180"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.3 KiB |
@ -1,4 +1,5 @@
|
||||
#include "playfield.hpp"
|
||||
#include <SFML/Graphics/RenderTexture.hpp>
|
||||
#include <SFML/Graphics/Text.hpp>
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <filesystem>
|
||||
@ -8,62 +9,50 @@
|
||||
#include "better_note.hpp"
|
||||
#include "config.hpp"
|
||||
#include "toolbox.hpp"
|
||||
#include "utf8_sfml_redefinitions.hpp"
|
||||
#include "utf8_strings.hpp"
|
||||
|
||||
const std::string texture_file = "textures/edit_textures/game_front_edit_tex_1.tex.png";
|
||||
|
||||
Playfield::Playfield(std::filesystem::path assets_folder) :
|
||||
long_note(assets_folder / "textures" / "long"),
|
||||
texture_path(assets_folder / texture_file)
|
||||
{
|
||||
long_note(assets_folder / "textures" / "long")
|
||||
{
|
||||
if (sf::Shader::isAvailable()) {
|
||||
chord_tint_shader.emplace();
|
||||
const auto shader_path = assets_folder / "shaders" / "chord_tint.frag";
|
||||
if (not std::filesystem::is_regular_file(shader_path)) {
|
||||
throw std::runtime_error(fmt::format("File {} does not exist", path_to_utf8_encoded_string(shader_path)));
|
||||
}
|
||||
if (not chord_tint_shader->load_from_path(assets_folder / "shaders" / "chord_tint.frag", sf::Shader::Fragment)) {
|
||||
if (not chord_tint_shader->load_from_path(shader_path, sf::Shader::Fragment)) {
|
||||
throw std::runtime_error(fmt::format("Could not open fragment shader {}", path_to_utf8_encoded_string(shader_path)));
|
||||
};
|
||||
chord_tint_shader->setUniform("texture", sf::Shader::CurrentTexture);
|
||||
}
|
||||
if (not base_texture.load_from_path(texture_path)) {
|
||||
std::cerr << "Unable to load texture " << texture_path;
|
||||
throw std::runtime_error("Unable to load texture " + path_to_utf8_encoded_string(texture_path));
|
||||
}
|
||||
base_texture.setSmooth(true);
|
||||
const std::filesystem::path folder = assets_folder / "textures" / "playfield";
|
||||
const auto load_texture_and_sprite = [&](const std::string& file, feis::Texture& tex, sf::Sprite& sprite){
|
||||
const auto path = folder / file;
|
||||
if (not tex.load_from_path(path)) {
|
||||
throw std::runtime_error(fmt::format(
|
||||
"Unable to load texture {}",
|
||||
path_to_utf8_encoded_string(path)
|
||||
));
|
||||
}
|
||||
tex.setSmooth(true);
|
||||
sprite.setTexture(tex);
|
||||
};
|
||||
load_texture_and_sprite("button.png", button_texture, button);
|
||||
load_texture_and_sprite("selected.png", note_selected_texture, note_selected);
|
||||
load_texture_and_sprite("collision.png", note_collision_texture, note_collision);
|
||||
|
||||
button.setTexture(base_texture);
|
||||
button.setTextureRect({0, 0, 192, 192});
|
||||
|
||||
button_pressed.setTexture(base_texture);
|
||||
button_pressed.setTextureRect({192, 0, 192, 192});
|
||||
|
||||
note_selected.setTexture(base_texture);
|
||||
note_selected.setTextureRect({384, 0, 192, 192});
|
||||
|
||||
note_collision.setTexture(base_texture);
|
||||
note_collision.setTextureRect({576, 0, 192, 192});
|
||||
|
||||
if (not long_note_marker_layer.create(400, 400)) {
|
||||
throw std::runtime_error("Unable to create Playfield's long_note_marker_layer");
|
||||
}
|
||||
long_note_marker_layer.setSmooth(true);
|
||||
|
||||
if (not long_note.layer.create(400, 400)) {
|
||||
throw std::runtime_error("Unable to create Playfield's long_note.laye");
|
||||
}
|
||||
long_note.layer.setSmooth(true);
|
||||
|
||||
if (not chord_marker_layer.create(400, 400)) {
|
||||
throw std::runtime_error("Unable to create Playfield's chord_marker_layer");
|
||||
}
|
||||
chord_marker_layer.setSmooth(true);
|
||||
|
||||
if (not note_numbers_layer.create(400, 400)) {
|
||||
throw std::runtime_error("Unable to create Playfield's chord_marker_layer");
|
||||
}
|
||||
note_numbers_layer.setSmooth(true);
|
||||
const auto create_layer = [](sf::RenderTexture& tex, const std::string& name){
|
||||
if (not tex.create(400, 400)) {
|
||||
throw std::runtime_error("Unable to create " + name);
|
||||
}
|
||||
tex.setSmooth(true);
|
||||
};
|
||||
create_layer(long_note.layer, "long note layer");
|
||||
create_layer(chord_marker_layer, "chord marker layer");
|
||||
create_layer(note_numbers_layer, "note numbers layer");
|
||||
|
||||
const auto font_path = assets_folder / "fonts" / "NotoSans-Bold.ttf";
|
||||
if (not note_numbers_font.load_from_path(font_path)) {
|
||||
|
@ -17,9 +17,10 @@
|
||||
class Playfield {
|
||||
public:
|
||||
Playfield(std::filesystem::path assets_folder);
|
||||
feis::Texture base_texture;
|
||||
feis::Texture button_texture;
|
||||
feis::Texture note_selected_texture;
|
||||
feis::Texture note_collision_texture;
|
||||
sf::Sprite button;
|
||||
sf::Sprite button_pressed;
|
||||
sf::Sprite note_selected;
|
||||
sf::Sprite note_collision;
|
||||
|
||||
@ -86,7 +87,6 @@ private:
|
||||
const config::Playfield& config
|
||||
);
|
||||
|
||||
const std::filesystem::path texture_path;
|
||||
std::optional<feis::Shader> chord_tint_shader;
|
||||
|
||||
feis::Font note_numbers_font;
|
||||
|
@ -1,15 +1,13 @@
|
||||
#include "density_graph.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
|
||||
#include "utf8_strings.hpp"
|
||||
|
||||
const std::string texture_file = "textures/edit_textures/game_front_edit_tex_1.tex.png";
|
||||
|
||||
DensityGraph::DensityGraph(std::filesystem::path assets, const config::Config& config) :
|
||||
texture_path(assets / texture_file),
|
||||
collision_zone(config.editor.collision_zone)
|
||||
{
|
||||
const std::filesystem::path texture_path = assets / "textures" / "density graph" / "dots.png";
|
||||
if (!base_texture.load_from_path(texture_path)) {
|
||||
std::cerr << "Unable to load texture " << texture_path;
|
||||
throw std::runtime_error("Unable to load texture " + path_to_utf8_encoded_string(texture_path));
|
||||
@ -17,10 +15,10 @@ DensityGraph::DensityGraph(std::filesystem::path assets, const config::Config& c
|
||||
base_texture.setSmooth(true);
|
||||
|
||||
normal_square.setTexture(base_texture);
|
||||
normal_square.setTextureRect({456, 270, 6, 6});
|
||||
normal_square.setTextureRect({0, 0, 6, 6});
|
||||
|
||||
collision_square.setTexture(base_texture);
|
||||
collision_square.setTextureRect({496, 270, 6, 6});
|
||||
collision_square.setTextureRect({6, 0, 6, 6});
|
||||
}
|
||||
|
||||
void DensityGraph::update(
|
||||
|
@ -39,7 +39,6 @@ public:
|
||||
);
|
||||
|
||||
private:
|
||||
const std::filesystem::path texture_path;
|
||||
const sf::Time& collision_zone;
|
||||
|
||||
void compute_densities(
|
||||
|