Skip to content

Instantly share code, notes, and snippets.

@HimeWorks
Last active August 29, 2015 14:13
Show Gist options
  • Save HimeWorks/5b57a3e32d3de78cce1b to your computer and use it in GitHub Desktop.
Save HimeWorks/5b57a3e32d3de78cce1b to your computer and use it in GitHub Desktop.
Region ID Sheet Generator
# Just storing this somewhere
module TH
Colors = {
0 => [ [175, 105, 105], [183, 95, 95]],
1 => [ [175, 140, 106], [183,139,95]],
2 => [ [175, 174, 106], [183, 182, 95]],
3 => [ [141, 175, 106], [140, 183, 95]],
4 => [ [106, 175, 106], [95, 183, 95]],
5 => [ [106, 175, 140], [95, 183, 139]],
6 => [ [106, 175, 164], [95,183, 182]],
7 => [ [106, 141, 175], [95,140, 183]],
8 => [ [106, 107, 175], [95,97, 183]],
9 => [ [138, 106, 175], [137,95, 183]],
10 => [ [174, 106, 175], [182,95, 183]],
11 => [ [175, 106, 141], [183,95, 140]],
}
def self.generate
bmp = Bitmap.new(256, 512)
128.times do |i|
next if i == 0
x = i % 8 * 32
y = i / 8 * 32
index = i % 12
bmp2 = Bitmap.new(32, 32)
bmp2.fill_rect(0, 0, 32, 32, Color.new(*Colors[index][0]))
bmp.blt(x, y, bmp2, bmp2.rect)
bmp.font.outline = false
bmp.draw_text(x + 2, y+2, 28, 28, i.to_s, 1)
end
bmp.export("regionId.png")
@spr = Sprite.new
@spr.bitmap = bmp
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment