diff options
-rw-r--r-- | .gitignore | 10 | ||||
-rw-r--r-- | Makefile | 62 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | data/icons/external.png | bin | 0 -> 239 bytes | |||
-rw-r--r-- | data/icons/feed.png | bin | 0 -> 519 bytes | |||
-rw-r--r-- | data/icons/gender.png | bin | 0 -> 567 bytes | |||
-rw-r--r-- | data/icons/lang/ar.png | bin | 0 -> 313 bytes | |||
-rw-r--r-- | data/icons/lang/cs.png | bin | 0 -> 138 bytes | |||
-rw-r--r-- | data/icons/lang/da.png | bin | 0 -> 150 bytes | |||
-rw-r--r-- | data/icons/lang/de.png | bin | 0 -> 92 bytes | |||
-rw-r--r-- | data/icons/lang/en.png | bin | 0 -> 215 bytes | |||
-rw-r--r-- | data/icons/lang/es.png | bin | 0 -> 93 bytes | |||
-rw-r--r-- | data/icons/lang/fi.png | bin | 0 -> 148 bytes | |||
-rw-r--r-- | data/icons/lang/fr.png | bin | 0 -> 91 bytes | |||
-rw-r--r-- | data/icons/lang/he.png | bin | 0 -> 189 bytes | |||
-rw-r--r-- | data/icons/lang/hu.png | bin | 0 -> 108 bytes | |||
-rw-r--r-- | data/icons/lang/id.png | bin | 0 -> 96 bytes | |||
-rw-r--r-- | data/icons/lang/it.png | bin | 0 -> 91 bytes | |||
-rw-r--r-- | data/icons/lang/ja.png | bin | 0 -> 112 bytes | |||
-rw-r--r-- | data/icons/lang/ko.png | bin | 0 -> 164 bytes | |||
-rw-r--r-- | data/icons/lang/nl.png | bin | 0 -> 94 bytes | |||
-rw-r--r-- | data/icons/lang/no.png | bin | 0 -> 125 bytes | |||
-rw-r--r-- | data/icons/lang/pl.png | bin | 0 -> 89 bytes | |||
-rw-r--r-- | data/icons/lang/pt-br.png | bin | 0 -> 338 bytes | |||
-rw-r--r-- | data/icons/lang/pt-pt.png | bin | 0 -> 217 bytes | |||
-rw-r--r-- | data/icons/lang/ro.png | bin | 0 -> 114 bytes | |||
-rw-r--r-- | data/icons/lang/ru.png | bin | 0 -> 96 bytes | |||
-rw-r--r-- | data/icons/lang/sk.png | bin | 0 -> 260 bytes | |||
-rw-r--r-- | data/icons/lang/sv.png | bin | 0 -> 326 bytes | |||
-rw-r--r-- | data/icons/lang/tr.png | bin | 0 -> 160 bytes | |||
-rw-r--r-- | data/icons/lang/uk.png | bin | 0 -> 105 bytes | |||
-rw-r--r-- | data/icons/lang/vi.png | bin | 0 -> 215 bytes | |||
-rw-r--r-- | data/icons/lang/zh.png | bin | 0 -> 121 bytes | |||
-rw-r--r-- | data/icons/plat/and.png | bin | 0 -> 378 bytes | |||
-rw-r--r-- | data/icons/plat/bdp.png | bin | 0 -> 389 bytes | |||
-rw-r--r-- | data/icons/plat/dos.png | bin | 0 -> 801 bytes | |||
-rw-r--r-- | data/icons/plat/drc.png | bin | 0 -> 678 bytes | |||
-rw-r--r-- | data/icons/plat/dvd.png | bin | 0 -> 293 bytes | |||
-rw-r--r-- | data/icons/plat/gba.png | bin | 0 -> 724 bytes | |||
-rw-r--r-- | data/icons/plat/gbc.png | bin | 0 -> 623 bytes | |||
-rw-r--r-- | data/icons/plat/ios.png | bin | 0 -> 584 bytes | |||
-rw-r--r-- | data/icons/plat/lin.png | bin | 0 -> 503 bytes | |||
-rw-r--r-- | data/icons/plat/mac.png | bin | 0 -> 546 bytes | |||
-rw-r--r-- | data/icons/plat/msx.png | bin | 0 -> 389 bytes | |||
-rw-r--r-- | data/icons/plat/n3d.png | bin | 0 -> 593 bytes | |||
-rw-r--r-- | data/icons/plat/nds.png | bin | 0 -> 294 bytes | |||
-rw-r--r-- | data/icons/plat/nes.png | bin | 0 -> 369 bytes | |||
-rw-r--r-- | data/icons/plat/p88.png | bin | 0 -> 409 bytes | |||
-rw-r--r-- | data/icons/plat/p98.png | bin | 0 -> 651 bytes | |||
-rw-r--r-- | data/icons/plat/pcf.png | bin | 0 -> 320 bytes | |||
-rw-r--r-- | data/icons/plat/ps1.png | bin | 0 -> 449 bytes | |||
-rw-r--r-- | data/icons/plat/ps2.png | bin | 0 -> 125 bytes | |||
-rw-r--r-- | data/icons/plat/ps3.png | bin | 0 -> 226 bytes | |||
-rw-r--r-- | data/icons/plat/ps4.png | bin | 0 -> 162 bytes | |||
-rw-r--r-- | data/icons/plat/psp.png | bin | 0 -> 118 bytes | |||
-rw-r--r-- | data/icons/plat/psv.png | bin | 0 -> 248 bytes | |||
-rw-r--r-- | data/icons/plat/sat.png | bin | 0 -> 653 bytes | |||
-rw-r--r-- | data/icons/plat/sfc.png | bin | 0 -> 387 bytes | |||
-rw-r--r-- | data/icons/plat/web.png | bin | 0 -> 801 bytes | |||
-rw-r--r-- | data/icons/plat/wii.png | bin | 0 -> 625 bytes | |||
-rw-r--r-- | data/icons/plat/win.png | bin | 0 -> 707 bytes | |||
-rw-r--r-- | data/icons/plat/xb1.png | bin | 0 -> 647 bytes | |||
-rw-r--r-- | data/icons/plat/xb3.png | bin | 0 -> 586 bytes | |||
-rw-r--r-- | data/icons/plat/xbo.png | bin | 0 -> 777 bytes | |||
-rw-r--r-- | data/icons/rtcomplete.png | bin | 0 -> 89 bytes | |||
-rw-r--r-- | data/icons/rtpartial.png | bin | 0 -> 102 bytes | |||
-rw-r--r-- | data/icons/rttrial.png | bin | 0 -> 114 bytes | |||
-rw-r--r-- | data/style.css | 74 | ||||
-rw-r--r-- | static/f/icons.png | bin | 14092 -> 0 bytes | |||
-rwxr-xr-x | util/skingen.pl | 8 | ||||
-rwxr-xr-x | util/spritegen.pl | 143 |
71 files changed, 200 insertions, 101 deletions
@@ -2,14 +2,16 @@ /data/multi.pid /data/docs/8 /data/log/ +/data/icons/icons.css /static/f/js/ +/static/f/icons.png /static/feeds/ /static/s/*/style.css /static/s/*/boxbg.png -/static/ch/ -/static/cv/ -/static/sf/ -/static/st/ +/static/ch +/static/cv +/static/sf +/static/st /static/robots.txt /static/api /www/ @@ -1,45 +1,52 @@ # all (default) -# Same as `make dirs js skins robots` +# Same as `make dirs js icons skins robots` # # dirs -# Creates the required directories not present in git +# Creates the required directories not present in git # # js -# Generates the Javascript code +# Generates the Javascript code +# +# icons +# Generates the CSS icon sprites # # skins -# Generates the CSS code +# Generates the CSS code # # robots -# Ensures that www/robots.txt and static/robots.txt exist. Can be modified to -# suit your needs. +# Ensures that www/robots.txt and static/robots.txt exist. Can be modified to +# suit your needs. # # chmod -# For when the http process is run from a different user than the files are -# chown'ed to. chmods all files and directories written to from vndb.pl. -# (including the stylesheets and javascript code, so these can be auto-updated) +# For when the http process is run from a different user than the files are +# chown'ed to. chmods all files and directories written to from vndb.pl. +# +# chmod-autoupdate +# As chmod, but also chmods all files that may need to be updated from a +# normal 'make' run. Should be used when the regen_static option is enabled +# and the http process is run from a different user. # # chmod-tladmin -# The TransAdmin plugin also needs write access to some files +# The TransAdmin plugin also needs write access to some files # # multi-start, multi-stop, multi-restart: -# Start/stop/restart the Multi daemon. Provided for convenience, a proper initscript -# probably makes more sense. +# Start/stop/restart the Multi daemon. Provided for convenience, a proper initscript +# probably makes more sense. # -# sql-import -# Imports util/sql/all.sql into your (presumably empty) database +# sql-import +# Imports util/sql/all.sql into your (presumably empty) database # -# update-<version> -# Updates all non-versioned items from the version before to <version>. +# update-<version> +# Updates all non-versioned items from the version before to <version>. # # NOTE: This Makefile has only been tested using a recent version of GNU make -# in a relatively up-to-date Arch Linux environment, and may not work in other -# environments. Patches to improve the portability are always welcome. +# in a relatively up-to-date Arch/Gentoo Linux environment, and may not work in +# other environments. Patches to improve the portability are always welcome. -.PHONY: all dirs js skins robots chmod chmod-tladmin multi-stop multi-start multi-restart sql-import\ +.PHONY: all dirs js icons skins robots chmod chmod-tladmin multi-stop multi-start multi-restart sql-import\ update-2.10 update-2.11 update-2.12 update-2.13 update-2.14 update-2.15 update-2.16 update-2.17\ - update-2.18 update-2.19 update-2.20 update-2.21 update-2.22 + update-2.18 update-2.19 update-2.20 update-2.21 update-2.22 update-2.23 all: dirs js skins robots data/config.pl @@ -47,6 +54,8 @@ dirs: static/f/js static/ch static/cv static/sf static/st data/log www www/feeds js: static/f/js/en.js +icons: data/icons/icons.css + skins: $(shell ls static/s | sed -e 's/\(.\+\)/static\/s\/\1\/style.css/g') robots: dirs www/robots.txt static/robots.txt @@ -61,7 +70,10 @@ static/f/js data/log www www/feeds www/api: static/f/js/en.js: data/script.js data/lang.txt util/jsgen.pl data/config.pl data/global.pl util/jsgen.pl -static/s/%/style.css: static/s/%/conf util/skingen.pl data/style.css +data/icons/icons.css: data/icons/*.png data/icons/*/*.png util/spritegen.pl + util/spritegen.pl + +static/s/%/style.css: static/s/%/conf util/skingen.pl data/style.css data/icons/icons.css util/skingen.pl $* %/robots.txt: @@ -69,11 +81,13 @@ static/s/%/style.css: static/s/%/conf util/skingen.pl data/style.css echo 'Disallow: /' >> $@ chmod: all - chmod a+xrw static/f/js chmod -R a-x+rwX static/{ch,cv,sf,st} - chmod a-x+rw static/s/*/{style.css,boxbg.png} -chmod-tladmin: +chmod-autoupdate: chmod + chmod a+xrw static/f static/f/js data/icons + chmod -f a-x+rw static/s/*/{style.css,boxbg.png} static/f/icons.png + +chmod-tladmin: chmod chmod a-x+rwX data/lang.txt data/docs data/docs/*\.* @@ -60,6 +60,10 @@ Requirements util/jsgen.pl JavaScript::Minifier::XS (optional, minimizes JS output) + util/spritegen.pl + Image::Magick + pngcrush (optional) + Contact diff --git a/data/icons/external.png b/data/icons/external.png Binary files differnew file mode 100644 index 00000000..43b45cfa --- /dev/null +++ b/data/icons/external.png diff --git a/data/icons/feed.png b/data/icons/feed.png Binary files differnew file mode 100644 index 00000000..22b1e844 --- /dev/null +++ b/data/icons/feed.png diff --git a/data/icons/gender.png b/data/icons/gender.png Binary files differnew file mode 100644 index 00000000..3870edc6 --- /dev/null +++ b/data/icons/gender.png diff --git a/data/icons/lang/ar.png b/data/icons/lang/ar.png Binary files differnew file mode 100644 index 00000000..da06bd16 --- /dev/null +++ b/data/icons/lang/ar.png diff --git a/data/icons/lang/cs.png b/data/icons/lang/cs.png Binary files differnew file mode 100644 index 00000000..a4a2f6cd --- /dev/null +++ b/data/icons/lang/cs.png diff --git a/data/icons/lang/da.png b/data/icons/lang/da.png Binary files differnew file mode 100644 index 00000000..7b7070ea --- /dev/null +++ b/data/icons/lang/da.png diff --git a/data/icons/lang/de.png b/data/icons/lang/de.png Binary files differnew file mode 100644 index 00000000..a9155cfc --- /dev/null +++ b/data/icons/lang/de.png diff --git a/data/icons/lang/en.png b/data/icons/lang/en.png Binary files differnew file mode 100644 index 00000000..b1cf3674 --- /dev/null +++ b/data/icons/lang/en.png diff --git a/data/icons/lang/es.png b/data/icons/lang/es.png Binary files differnew file mode 100644 index 00000000..f461c138 --- /dev/null +++ b/data/icons/lang/es.png diff --git a/data/icons/lang/fi.png b/data/icons/lang/fi.png Binary files differnew file mode 100644 index 00000000..5f5d8fed --- /dev/null +++ b/data/icons/lang/fi.png diff --git a/data/icons/lang/fr.png b/data/icons/lang/fr.png Binary files differnew file mode 100644 index 00000000..5f0589c8 --- /dev/null +++ b/data/icons/lang/fr.png diff --git a/data/icons/lang/he.png b/data/icons/lang/he.png Binary files differnew file mode 100644 index 00000000..01a62f56 --- /dev/null +++ b/data/icons/lang/he.png diff --git a/data/icons/lang/hu.png b/data/icons/lang/hu.png Binary files differnew file mode 100644 index 00000000..68df6f90 --- /dev/null +++ b/data/icons/lang/hu.png diff --git a/data/icons/lang/id.png b/data/icons/lang/id.png Binary files differnew file mode 100644 index 00000000..3ab93ee7 --- /dev/null +++ b/data/icons/lang/id.png diff --git a/data/icons/lang/it.png b/data/icons/lang/it.png Binary files differnew file mode 100644 index 00000000..91f98e2b --- /dev/null +++ b/data/icons/lang/it.png diff --git a/data/icons/lang/ja.png b/data/icons/lang/ja.png Binary files differnew file mode 100644 index 00000000..ef982e2c --- /dev/null +++ b/data/icons/lang/ja.png diff --git a/data/icons/lang/ko.png b/data/icons/lang/ko.png Binary files differnew file mode 100644 index 00000000..de15c590 --- /dev/null +++ b/data/icons/lang/ko.png diff --git a/data/icons/lang/nl.png b/data/icons/lang/nl.png Binary files differnew file mode 100644 index 00000000..046cf74d --- /dev/null +++ b/data/icons/lang/nl.png diff --git a/data/icons/lang/no.png b/data/icons/lang/no.png Binary files differnew file mode 100644 index 00000000..ccad6bfe --- /dev/null +++ b/data/icons/lang/no.png diff --git a/data/icons/lang/pl.png b/data/icons/lang/pl.png Binary files differnew file mode 100644 index 00000000..bba98646 --- /dev/null +++ b/data/icons/lang/pl.png diff --git a/data/icons/lang/pt-br.png b/data/icons/lang/pt-br.png Binary files differnew file mode 100644 index 00000000..f4094097 --- /dev/null +++ b/data/icons/lang/pt-br.png diff --git a/data/icons/lang/pt-pt.png b/data/icons/lang/pt-pt.png Binary files differnew file mode 100644 index 00000000..ae293629 --- /dev/null +++ b/data/icons/lang/pt-pt.png diff --git a/data/icons/lang/ro.png b/data/icons/lang/ro.png Binary files differnew file mode 100644 index 00000000..bf52726f --- /dev/null +++ b/data/icons/lang/ro.png diff --git a/data/icons/lang/ru.png b/data/icons/lang/ru.png Binary files differnew file mode 100644 index 00000000..8926f08d --- /dev/null +++ b/data/icons/lang/ru.png diff --git a/data/icons/lang/sk.png b/data/icons/lang/sk.png Binary files differnew file mode 100644 index 00000000..1511820d --- /dev/null +++ b/data/icons/lang/sk.png diff --git a/data/icons/lang/sv.png b/data/icons/lang/sv.png Binary files differnew file mode 100644 index 00000000..512e100f --- /dev/null +++ b/data/icons/lang/sv.png diff --git a/data/icons/lang/tr.png b/data/icons/lang/tr.png Binary files differnew file mode 100644 index 00000000..004b9c83 --- /dev/null +++ b/data/icons/lang/tr.png diff --git a/data/icons/lang/uk.png b/data/icons/lang/uk.png Binary files differnew file mode 100644 index 00000000..5645f271 --- /dev/null +++ b/data/icons/lang/uk.png diff --git a/data/icons/lang/vi.png b/data/icons/lang/vi.png Binary files differnew file mode 100644 index 00000000..65c59ea5 --- /dev/null +++ b/data/icons/lang/vi.png diff --git a/data/icons/lang/zh.png b/data/icons/lang/zh.png Binary files differnew file mode 100644 index 00000000..8dafa06d --- /dev/null +++ b/data/icons/lang/zh.png diff --git a/data/icons/plat/and.png b/data/icons/plat/and.png Binary files differnew file mode 100644 index 00000000..648af428 --- /dev/null +++ b/data/icons/plat/and.png diff --git a/data/icons/plat/bdp.png b/data/icons/plat/bdp.png Binary files differnew file mode 100644 index 00000000..4999f524 --- /dev/null +++ b/data/icons/plat/bdp.png diff --git a/data/icons/plat/dos.png b/data/icons/plat/dos.png Binary files differnew file mode 100644 index 00000000..3adf5bff --- /dev/null +++ b/data/icons/plat/dos.png diff --git a/data/icons/plat/drc.png b/data/icons/plat/drc.png Binary files differnew file mode 100644 index 00000000..9fe59cbc --- /dev/null +++ b/data/icons/plat/drc.png diff --git a/data/icons/plat/dvd.png b/data/icons/plat/dvd.png Binary files differnew file mode 100644 index 00000000..9b71645f --- /dev/null +++ b/data/icons/plat/dvd.png diff --git a/data/icons/plat/gba.png b/data/icons/plat/gba.png Binary files differnew file mode 100644 index 00000000..f9601915 --- /dev/null +++ b/data/icons/plat/gba.png diff --git a/data/icons/plat/gbc.png b/data/icons/plat/gbc.png Binary files differnew file mode 100644 index 00000000..b93df0a9 --- /dev/null +++ b/data/icons/plat/gbc.png diff --git a/data/icons/plat/ios.png b/data/icons/plat/ios.png Binary files differnew file mode 100644 index 00000000..8521a741 --- /dev/null +++ b/data/icons/plat/ios.png diff --git a/data/icons/plat/lin.png b/data/icons/plat/lin.png Binary files differnew file mode 100644 index 00000000..7a294fe6 --- /dev/null +++ b/data/icons/plat/lin.png diff --git a/data/icons/plat/mac.png b/data/icons/plat/mac.png Binary files differnew file mode 100644 index 00000000..1e01c433 --- /dev/null +++ b/data/icons/plat/mac.png diff --git a/data/icons/plat/msx.png b/data/icons/plat/msx.png Binary files differnew file mode 100644 index 00000000..9cd32ced --- /dev/null +++ b/data/icons/plat/msx.png diff --git a/data/icons/plat/n3d.png b/data/icons/plat/n3d.png Binary files differnew file mode 100644 index 00000000..9782f832 --- /dev/null +++ b/data/icons/plat/n3d.png diff --git a/data/icons/plat/nds.png b/data/icons/plat/nds.png Binary files differnew file mode 100644 index 00000000..77fc8bea --- /dev/null +++ b/data/icons/plat/nds.png diff --git a/data/icons/plat/nes.png b/data/icons/plat/nes.png Binary files differnew file mode 100644 index 00000000..30e06943 --- /dev/null +++ b/data/icons/plat/nes.png diff --git a/data/icons/plat/p88.png b/data/icons/plat/p88.png Binary files differnew file mode 100644 index 00000000..1da9c6e5 --- /dev/null +++ b/data/icons/plat/p88.png diff --git a/data/icons/plat/p98.png b/data/icons/plat/p98.png Binary files differnew file mode 100644 index 00000000..bebad893 --- /dev/null +++ b/data/icons/plat/p98.png diff --git a/data/icons/plat/pcf.png b/data/icons/plat/pcf.png Binary files differnew file mode 100644 index 00000000..87bd6eee --- /dev/null +++ b/data/icons/plat/pcf.png diff --git a/data/icons/plat/ps1.png b/data/icons/plat/ps1.png Binary files differnew file mode 100644 index 00000000..80b4b950 --- /dev/null +++ b/data/icons/plat/ps1.png diff --git a/data/icons/plat/ps2.png b/data/icons/plat/ps2.png Binary files differnew file mode 100644 index 00000000..79008351 --- /dev/null +++ b/data/icons/plat/ps2.png diff --git a/data/icons/plat/ps3.png b/data/icons/plat/ps3.png Binary files differnew file mode 100644 index 00000000..60c2d731 --- /dev/null +++ b/data/icons/plat/ps3.png diff --git a/data/icons/plat/ps4.png b/data/icons/plat/ps4.png Binary files differnew file mode 100644 index 00000000..e04e5cb1 --- /dev/null +++ b/data/icons/plat/ps4.png diff --git a/data/icons/plat/psp.png b/data/icons/plat/psp.png Binary files differnew file mode 100644 index 00000000..574f5ba6 --- /dev/null +++ b/data/icons/plat/psp.png diff --git a/data/icons/plat/psv.png b/data/icons/plat/psv.png Binary files differnew file mode 100644 index 00000000..57b09185 --- /dev/null +++ b/data/icons/plat/psv.png diff --git a/data/icons/plat/sat.png b/data/icons/plat/sat.png Binary files differnew file mode 100644 index 00000000..def13b13 --- /dev/null +++ b/data/icons/plat/sat.png diff --git a/data/icons/plat/sfc.png b/data/icons/plat/sfc.png Binary files differnew file mode 100644 index 00000000..909e006a --- /dev/null +++ b/data/icons/plat/sfc.png diff --git a/data/icons/plat/web.png b/data/icons/plat/web.png Binary files differnew file mode 100644 index 00000000..a5a2ff05 --- /dev/null +++ b/data/icons/plat/web.png diff --git a/data/icons/plat/wii.png b/data/icons/plat/wii.png Binary files differnew file mode 100644 index 00000000..3f7a4d2b --- /dev/null +++ b/data/icons/plat/wii.png diff --git a/data/icons/plat/win.png b/data/icons/plat/win.png Binary files differnew file mode 100644 index 00000000..ccede0aa --- /dev/null +++ b/data/icons/plat/win.png diff --git a/data/icons/plat/xb1.png b/data/icons/plat/xb1.png Binary files differnew file mode 100644 index 00000000..23d722a8 --- /dev/null +++ b/data/icons/plat/xb1.png diff --git a/data/icons/plat/xb3.png b/data/icons/plat/xb3.png Binary files differnew file mode 100644 index 00000000..600315ab --- /dev/null +++ b/data/icons/plat/xb3.png diff --git a/data/icons/plat/xbo.png b/data/icons/plat/xbo.png Binary files differnew file mode 100644 index 00000000..8beb3781 --- /dev/null +++ b/data/icons/plat/xbo.png diff --git a/data/icons/rtcomplete.png b/data/icons/rtcomplete.png Binary files differnew file mode 100644 index 00000000..cd9c640b --- /dev/null +++ b/data/icons/rtcomplete.png diff --git a/data/icons/rtpartial.png b/data/icons/rtpartial.png Binary files differnew file mode 100644 index 00000000..89a9b21e --- /dev/null +++ b/data/icons/rtpartial.png diff --git a/data/icons/rttrial.png b/data/icons/rttrial.png Binary files differnew file mode 100644 index 00000000..5838692d --- /dev/null +++ b/data/icons/rttrial.png diff --git a/data/style.css b/data/style.css index c01358f1..863f84ba 100644 --- a/data/style.css +++ b/data/style.css @@ -862,79 +862,7 @@ div#fil_div { acronym.icons, acronym.uicons { cursor: default; } a .icons { cursor: pointer } .icons.oth { background: none; } -.icons.drc { background-position: 0px 0px; } -.icons.lin { background-position: 0px -14px; } -.icons.nds { background-position: 0px -28px; } -.icons.ps2 { background-position: 0px -42px; } -.icons.sfc { background-position: 0px -56px; } -.icons.gba { background-position: 0px -70px; } -.icons.ps3 { background-position: 0px -84px; } -.icons.p98 { background-position: 0px -98px; } -.icons.web { background-position: 0px -112px; } -.icons.n3d { background-position: 0px -126px; } -.icons.gbc { background-position: 0px -140px; } - -.icons.feed { background-position: 0px -154px; } - -.icons.gen.f, -.icons.gen.b { background-position: -12px -154px; } -.icons.gen.m { background-position: -26px -154px; } - -.icons.dvd { background-position: -16px 0px; } -.icons.mac { background-position: -16px -14px; } -.icons.ps1 { background-position: -16px -28px; } -.icons.psp { background-position: -16px -42px; } -.icons.win { background-position: -16px -56px; } -.icons.wii { background-position: -16px -70px; } -.icons.xb3 { background-position: -16px -84px; } -.icons.sat { background-position: -16px -98px; } -.icons.and { background-position: -16px -112px; } -.icons.psv { background-position: -16px -126px; } -.icons.pcf { background-position: -16px -140px; } - -.icons.rtcomplete { background-position: -32px 0px; } -.icons.rtpartial { background-position: -32px -14px; } -.icons.rttrial { background-position: -32px -28px; } -.icons.ext { background-position: -32px -42px; } -.icons.msx { background-position: -32px -56px; } -.icons.nes { background-position: -32px -70px; } -.icons.dos { background-position: -32px -84px; } -.icons.ios { background-position: -32px -98px; } -.icons.bdp { background-position: -32px -112px; } -.icons.xb1 { background-position: -32px -126px; } -.icons.p88 { background-position: -32px -140px; } - -.icons.ps4 { background-position: -40px -154px; } -.icons.xbo { background-position: -56px -154px; } - -.icons.cs { background-position: -48px 0px; } -.icons.da { background-position: -48px -11px; } -.icons.de { background-position: -48px -22px; } -.icons.en { background-position: -48px -33px; } -.icons.es { background-position: -48px -44px; } -.icons.fi { background-position: -48px -55px; } -.icons.fr { background-position: -48px -66px; } -.icons.it { background-position: -48px -77px; } -.icons.ja { background-position: -48px -88px; } -.icons.hu { background-position: -48px -99px; } -.icons.pt-br { background-position: -48px -110px; } -.icons.uk { background-position: -48px -121px; } -.icons.ar { background-position: -48px -132px; } - -.icons.nl { background-position: -61px 0px; } -.icons.no { background-position: -61px -11px; } -.icons.pl { background-position: -61px -22px; } -.icons.pt-pt { background-position: -61px -33px; } -.icons.ru { background-position: -61px -44px; } -.icons.sv { background-position: -61px -55px; } -.icons.tr { background-position: -61px -66px; } -.icons.zh { background-position: -61px -77px; } -.icons.ko { background-position: -61px -88px; } -.icons.vi { background-position: -61px -99px; } -.icons.sk { background-position: -61px -110px; } -.icons.id { background-position: -61px -121px; } -.icons.he { background-position: -61px -132px; } -.icons.ro { background-position: -61px -143px; } +$iconcss$ /* Relation graph colors */ diff --git a/static/f/icons.png b/static/f/icons.png Binary files differdeleted file mode 100644 index bf7057b4..00000000 --- a/static/f/icons.png +++ /dev/null diff --git a/util/skingen.pl b/util/skingen.pl index 343c5922..834578cb 100755 --- a/util/skingen.pl +++ b/util/skingen.pl @@ -18,10 +18,18 @@ use SkinFile; require $ROOT.'/data/global.pl'; +my $iconcss = do { + open my $F, '<', "$ROOT/data/icons/icons.css" or die $!; + local $/=undef; + <$F>; +}; + + sub writeskin { # $name my $name = shift; my $skin = SkinFile->new("$ROOT/static/s", $name); my %o = map +($_ => $skin->get($_)), $skin->get; + $o{iconcss} = $iconcss; # get the right top image if($o{imgrighttop}) { diff --git a/util/spritegen.pl b/util/spritegen.pl new file mode 100755 index 00000000..c6f830f7 --- /dev/null +++ b/util/spritegen.pl @@ -0,0 +1,143 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Image::Magick; +use Cwd 'abs_path'; + +our $ROOT; +BEGIN { ($ROOT = abs_path $0) =~ s{/util/spritegen\.pl$}{}; } + +my $path = "$ROOT/data/icons"; +my $icons = "$ROOT/static/f/icons.png"; +my $css = "$ROOT/data/icons/icons.css"; + +my @img = map { + my $i = Image::Magick->new(); + $i->Read($_) and die $_; + { + f => /^\Q$path\E\/(.+)\.png/ && $1, + i => $i, + h => scalar $i->Get('height'), + w => scalar $i->Get('width') + } +} glob("$path/*.png"), glob("$path/*/*.png"); + + +@img = sort { $b->{h} <=> $a->{h} || $b->{w} <=> $a->{w} } @img; + +my $minpixels = 0; +$minpixels += $_->{w}*$_->{h} for @img; + + +# Simple strip packing algortihm, First-Fit Decreasing Height. +sub genstrip { + my $w = shift; + my @l; + my $h = 0; + for my $i (@img) { + my $found = 0; + # @img is assumed to be sorted by height, so image always fits + # (height-wise) in any of the previously created levels. + for my $l (@l) { + next if $l->{left} + $i->{w} > $w; + # Image fits, add to level + $i->{x} = $l->{left}; + $i->{y} = $l->{top}; + $l->{left} += $i->{w}; + $found = 1; + last; + } + next if $found; + + # No level found, create a new one + push @l, { top => $h, left => $i->{w} }; + $i->{x} = 0; + $i->{y} = $h; + $h += $i->{h}; + } + return $h; +} + + +# Tries to find the width of the strip for which the number of unused pixels is +# the minimum. Simple and dumb linear search; it's fast enough. +# +# Note that minimum number of unused pixels does not imply minimum file size, +# although there is some correlation. To further minimize the file size, it's +# possible to attempt to group similar-looking images close together so that +# the final png image might compress better. Finding a good (and fast) +# algorithm for this is not a trivial task, however. +sub minstrip { + my($minwidth, $maxwidth) = (0,0); + for(@img) { + $minwidth = $_->{w} if $_->{w} > $minwidth; + $maxwidth += $_->{w}; + } + my $optw; + my $optsize = 1e10; + for my $w ($minwidth..$maxwidth) { + my $size = genstrip($w)*$w; + # To optimize for file size, uncommment below line. It's slow, but saves about 150 bytes (while using pngcrush). + #$size = img(); + if($size < $optsize) { + $optw = $w; + $optsize = $size; + } + } + genstrip($optw); +} + + +sub calcdim { + my($w, $h) = (0,0); + for (@img) { + $w = $_->{x}+$_->{w} if $w < $_->{x}+$_->{w}; + $h = $_->{y}+$_->{h} if $h < $_->{y}+$_->{h}; + } + ($w, $h) +} + + +sub img { + my($w, $h) = calcdim; + my $img = Image::Magick->new; + print $img->Set(size => "${w}x$h"); + print $img->ReadImage('canvas:rgba(0,0,0,0)'); + my $pixels = $w*$h; + for my $i (@img) { + print $img->Composite(image => $i->{i}, x => $i->{x}, y => $i->{y}); + } + print $img->Write($icons); + undef $img; + + `pngcrush -q "$icons" "$icons~" 2>/dev/null && mv "$icons~" "$icons"`; + + my $size = -s $icons; + #printf "Dim: %dx%d, size: %d, pixels wasted: %d\n", $w, $h, $size, $w*$h-$minpixels; + $size; +} + + +sub css { + # The gender icons need special treatment, they're 3 icons in one image. + my $gender; + + open my $F, '>', $css or die $!; + for my $i (@img) { + if($i->{f} eq 'gender') { + $gender = $i; + next; + } + $i->{f} =~ /([^\/]+)$/; + printf $F ".icons.%s { background-position: %dpx %dpx }\n", $1, -$i->{x}, -$i->{y}; + } + printf $F ".icons.gen.f, .icons.gen.b { background-position: %dpx %dpx }\n", -$gender->{x}, -$gender->{y}; + printf $F ".icons.gen.m { background-position: %dpx %dpx }\n", -($gender->{x}+14), -$gender->{y}; +} + + +#genstrip 80; +minstrip; +img; +css; |