I would like to make Inkscape the editor for the game I'm making. At the moment, however, it's not very easy to do without a "template" or some sort of variable scripting:
I found out about the SVG "use" tag yesterday, but I need something more powerful. Here's my current setup:
Code: Select all
<defs id="templates">
<g id="template_area_capital">
<path id="template_area_capital_crosshair"
d="m -7.5,0 15,0 -7.5,0 0,-7.5 0,15 0,-7.5"
style="stroke:#000000;stroke-width:0.05012808;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
<circle id="template_area_capital_circle" cx = "0" cy = "0" r = "7.5"
style="fill:#003f7f;fill-opacity:0.49803922;stroke:#000000;stroke-width:0.05012808;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
<rect id="template_area_capital_port" width = ".5" height = ".5" x = "-.25" y = "-.25"
style="fill:none; stroke:#0000ff; stroke-width:0.025; stroke-miterlimit:4; stroke-opacity:1; stroke-dasharray:none" />
</g>
</defs>
And the use command:
Code: Select all
<use id="city_E_Syracuse_L_Syracusae" xlink:href="#template_area_capital"
x="1145.5" y="1399" height="1" width="1" />
---------------
This is the hypothetical ideal:
Code: Select all
<defs id="templates">
<g id="template_point">
switch ($subtype) {
case "empire capital": ("template_point_circle").fill = "red"; // Or use a hex value..
case "capital": ("template_point_circle").fill = "blue";
case "city": ("template_point_circle").fill = "green";
case "fort": ("template_point_circle").fill = "purple";
}
<path id="template_point_crosshair"
d="m -7.5,0 15,0 -7.5,0 0,-7.5 0,15 0,-7.5"
style="stroke:#000000;stroke-width:0.05012808;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
<circle id="template_point_circle" cx = "0" cy = "0" r = $size
style="fill:#003f7f;fill-opacity:0.49803922;stroke:#000000;stroke-width:0.05012808;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
<rect id="template_point_port" width = ".5" height = ".5" x = (-.25+$portx) y = (-.25+$porty)
style="fill:none; stroke:#0000ff; stroke-width:0.025; stroke-miterlimit:4; stroke-opacity:1; stroke-dasharray:none" />
</g>
</defs>
Code: Select all
<use id="city_E_Syracuse_L_Syracusae" xlink:href="#template_point"
x="1145.5"
y="1399"
size = "7.5"
subtype = "capital"
portx = "5"
porty = "10"
/>
I'd also like to be able to move the rectangle (id="template_point_port") using the inkscape GUI move command and have it update portx and porty. Similarly with circle size and color-- if the GUI changes those properties, the subtype and width would be affected as well.
Any way to do this or anything close to it in Inkscape? Many thanks.