]> icculus.org git repositories - divverent/nexuiz.git/blob - data/models/sprites/make-sprites.sh
use r_labelsprites DP feature for sprites; add script that generates the sprites
[divverent/nexuiz.git] / data / models / sprites / make-sprites.sh
1 width=256
2 height=64
3
4 sprwidth=256
5 sprheight=64
6
7 sprite()
8 {
9         name=$1
10         color=$2
11         bgcolor=$3
12         text=$4
13         svgwidth=512
14         svgheight=128
15
16         cat <<EOF >$name.svg
17 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
18 <!-- Created with Inkscape (http://www.inkscape.org/) -->
19 <svg
20    xmlns:dc="http://purl.org/dc/elements/1.1/"
21    xmlns:cc="http://web.resource.org/cc/"
22    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
23    xmlns:svg="http://www.w3.org/2000/svg"
24    xmlns="http://www.w3.org/2000/svg"
25    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
26    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
27    width="512"
28    height="128"
29    id="svg2"
30    sodipodi:version="0.32"
31    inkscape:version="0.45"
32    version="1.0"
33    inkscape:export-filename="bluebase.tga"
34    inkscape:export-xdpi="90"
35    inkscape:export-ydpi="90"
36    sodipodi:docname="template.svg"
37    sodipodi:docbase="/home/rpolzer/software/games/nexuiz/data/models/sprites"
38    inkscape:output_extension="org.inkscape.output.svg.inkscape"
39    sodipodi:modified="true">
40   <defs
41      id="defs4" />
42   <sodipodi:namedview
43      id="base"
44      pagecolor="#$bgcolor"
45      bordercolor="#666666"
46      borderopacity="1.0"
47      gridtolerance="10000"
48      guidetolerance="10"
49      objecttolerance="10"
50      inkscape:pageopacity="0"
51      inkscape:pageshadow="2"
52      inkscape:zoom="0.98994949"
53      inkscape:cx="375"
54      inkscape:cy="75.53288"
55      inkscape:document-units="px"
56      inkscape:current-layer="layer1"
57      width="512px"
58      height="128px"
59      showgrid="true"
60      gridspacingx="8px"
61      gridspacingy="8px"
62      gridempspacing="8"
63      inkscape:grid-points="true"
64      showguides="true"
65      inkscape:guide-bbox="true"
66      inkscape:window-width="849"
67      inkscape:window-height="590"
68      inkscape:window-x="198"
69      inkscape:window-y="66" />
70   <metadata
71      id="metadata7">
72     <rdf:RDF>
73       <cc:Work
74          rdf:about="">
75         <dc:format>image/svg+xml</dc:format>
76         <dc:type
77            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
78       </cc:Work>
79     </rdf:RDF>
80   </metadata>
81   <g
82      inkscape:label="Layer 1"
83      inkscape:groupmode="layer"
84      id="layer1">
85     <path
86        style="opacity:1;fill:#$color;fill-opacity:1;stroke:#$bgcolor;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.75294119"
87        d="M 256,126 L 280,102 L 264,102 L 264,62 L 248,62 L 248,102 L 232,102 L 256,126 z "
88        id="path1872"
89        sodipodi:nodetypes="cccccccc" />
90     <text
91        xml:space="preserve"
92        style="font-size:56px;font-weight:bold;text-align:center;text-anchor:middle;opacity:1;fill:#$color;fill-opacity:1;stroke:#$bgcolor;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.75294118"
93        x="255.49414"
94        y="49.957031"
95        id="text1874"><tspan
96          sodipodi:role="line"
97          id="tspan1876"
98          x="255.49414"
99          y="49.957031">$text</tspan></text>
100   </g>
101 </svg>
102 EOF
103         enlargex=$(($sprwidth - $width))
104         enlargey=$(($sprheight - $height))
105
106         
107
108         inkscape -z -w $sprwidth -h $sprheight \
109                 -a "$((-$enlargex * $svgwidth / $width / 2)):0:$(($svgwidth + $enlargex * $svgwidth / $width / 2)):$(($svgheight + $enlargey * $svgheight / $height))" \
110                 -e "$name.png" "$name.svg"
111         ./makespr32 -o "$name.sp2" -proj 5 "$name.png" $(($sprwidth / 2)) $(($sprheight - 1)) 0
112 }
113
114 sprite bluebase           0000ff 000000 "BLUE BASE"
115 sprite danger             ff0000 ffff00 "DANGER"
116 sprite flagcarrier        ffff00 000000 "FLAG CARRIER"
117 sprite helpme             ffff00 ff0000 "HELP ME"
118 sprite here               00ff00 000000 "HERE"
119 sprite key-dropped        00ffff 000000 "DROPPED KEY"
120 sprite keycarrier-blue    0000ff 000000 "KEY CARRIER"
121 sprite keycarrier-finish  00ffff 000000 "RUN HERE"
122 sprite keycarrier-friend  00ff00 000000 "KEY CARRIER"
123 sprite keycarrier-pink    ff00ff 000000 "KEY CARRIER"
124 sprite keycarrier-red     ff0000 000000 "KEY CARRIER"
125 sprite keycarrier-yellow  ffff00 000000 "KEY CARRIER"
126 sprite redbase            ff0000 000000 "RED BASE"
127 sprite waypoint           008080 000000 "WAYPOINT"