Skip to content

Instantly share code, notes, and snippets.

@carstene1ns
Created June 23, 2017 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carstene1ns/bb77b2adac36bd16573670d1be459bf1 to your computer and use it in GitHub Desktop.
Save carstene1ns/bb77b2adac36bd16573670d1be459bf1 to your computer and use it in GitHub Desktop.
Creates the room description bars in the EasyRPG Testgame
#!/usr/bin/ruby
rooms = Array[
"Message",
"Message options",
"Show face",
"Choices",
"Number input",
"Switch operation",
"Variable operation",
"Timer operation",
"Money operation",
"Item operation",
"Hero operation",
"Experience",
"Level",
"Parameters",
"Abilities",
"Equip",
"Change system BGM",
"Item Shop",
"Change vehicles chara",
"Branching",
"Change hero chara/face",
"Inn",
"Change hero name/title",
"Hero name input",
"Damage",
"Transitions",
"Cure all",
"Change default screen transitions",
"Status (command only)",
"Change system (graphic)",
"HP/MP recover/remove",
"Change system sounds",
"Memorize/Go to memorized place",
"Vehicle commands",
"Screen tone",
"Screen flash",
"Shake screen",
"Pan screen",
"Image operations",
"Weather effects",
"Map battle animations.",
"Change hero's transparency",
"Hero flash",
"Event movement",
"Wait command",
"Music playing",
"Menu testing",
"Teleport and Escape",
"Change event position",
"Swap events",
"Get terrain ID",
"Get event ID",
"Key input",
"Loop and Goto/Label",
"Event deletion and cancellation",
"Panorama",
"Tile substitution",
"Call event"
]
rooms.each{ |r|
# slugify
n = "room_" + r.downcase # lowercase
n = n.gsub(/\s+/, '_') # whitespace
n = n.gsub(/[^\w\-]+/, '_') # no non-word
n = n.gsub(/__+/, '_') # unified underlines
n = n.gsub(/_$/, '') # trim end
puts "writing file #{n}.png..."
# output with centered text
system("convert -size 320x20 -gravity Center -background black \
-font Roboto-Black -pointsize 12 -fill white \
caption:\"#{r}\" png8:Picture/#{n}.png")
puts "recompressing..."
system("advpng -z4 Picture/#{n}.png")
# left aligned
# convert -size 320x20 xc:black -font Roboto-Black -pointsize 12 -fill white -draw 'text 4,15 "$1"' png8:$2.png
}
puts "=> done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment