@font_Segoe_UI_20 = Gosu::Font.new(self, "fonts/segoeui.ttf", 20)
ocra MC.rb
ocra MC.rb --windows /images/**/*.* /fonts/**/*.*
File.expand_path("../../fonts/whatever.ttf", __FILE__)
when referring to assets.ocra mc.rb --windows --no-enc immagini/*.* fonts/*.*
def image_path(image); File.expand_path("../immagini/#{image}", __FILE__); end
def font_path(font); File.expand_path("../fonts/#{font}", __FILE__); end
@immagini_titoli = Gosu::Image.new(self, image_path("testa1.png"), true)
@immagini_cursore = Gosu::Image.new(self, image_path("cursore.png"), true)
@immagini_start = Gosu::Image.new(self, image_path("start1.png"), true)
@immagini_sbarra = Gosu::Image.new(self, image_path("sbarra.png"), true)
@font_Segoe_UI_20 = Gosu::Font.new(self, font_path("segoeui.ttf"), 20)
if (@game_begin == true) and (@current_n == 19)
@font_Segoe_UI_20.draw_rel("19", 400, 50, 0, 0.5, 0.5, 1, 1, 0xffff0000)
@font_Segoe_UI_20.draw_rel("L'ATTENZIONE DI UN FANTASMA", 400, 70, 0, 0.5, 0.5, 1, 1, 0xffff0000)
@font_Segoe_UI_20.draw("Di' cosa fa il fantasma, chiedi al giocatore come si comporta, e di' cosa succede.", 70, 90, 0, 1, 1, 0xffffffff)
@font_Segoe_UI_20.draw("Continua in questo modo fino a che non si verifica uno dei seguenti casi:", 70, 110, 0, 1, 1, 0xffffffff)
@font_Segoe_UI_20.draw("- Decidi che l'altro giocatore ha provocato la violenza del fantasma. Vai al .", 70, 130, 0, 1, 1, 0xffffffff)
@font_Segoe_UI_20.draw("29", (@font_Segoe_UI_20.text_width("- Decidi che l'altro giocatore ha provocato la violenza del fantasma. Vai al ", 1)) + 70, 130, 0, 1, 1, ((0xff - @glow) << 24) + 0xffff00)
@font_Segoe_UI_20.draw("- L'altro giocatore sta cercando di passare oltre il fantasma. Digli di andare al .", 70, 150, 0, 1, 1, 0xffffffff)
@font_Segoe_UI_20.draw("12", (@font_Segoe_UI_20.text_width("- L'altro giocatore sta cercando di passare oltre il fantasma. Digli di andare al ", 1)) + 70, 150, 0, 1, 1, ((0xff - @glow) << 24) + 0xffff00)
@font_Segoe_UI_20.draw("- Decidi che l'altro giocatore sta confrontando il fantasma. Digli di andare al .", 70, 170, 0, 1, 1, 0xffffffff)
@font_Segoe_UI_20.draw("34", (@font_Segoe_UI_20.text_width("- Decidi che l'altro giocatore sta confrontando il fantasma. Digli di andare al ", 1)) + 70, 170, 0, 1, 1, ((0xff - @glow) << 24) + 0xffff00)
@font_Segoe_UI_20.draw("- Decidi che l'altro giocatore ha suscitato la curiosita' del fantasma. Digli di andare al .", 70, 190, 0, 1, 1, 0xffffffff)
@font_Segoe_UI_20.draw("36", (@font_Segoe_UI_20.text_width("- Dicidi che l'altro giocatore ha suscitato la curiosita' del fantasma. Digli di andare al ", 1)) + 70, 190, 0, 1, 1, ((0xff - @glow) << 24) + 0xffff00)
@font_Segoe_UI_20.draw("- Decidi che l'altro giocatore ha suscitato la pieta' del fantasma. Digli di andare al .", 70, 210, 0, 1, 1, 0xffffffff)
@font_Segoe_UI_20.draw("38", (@font_Segoe_UI_20.text_width("- Decidi che l'altro giocatore ha suscitato la pieta' del fantasma. Digli di andare al ", 1)) + 70, 210, 0, 1, 1, ((0xff - @glow) << 24) + 0xffff00)
@font_Segoe_UI_20.draw("- L'altro giocatore sta cercando di nascondersi. Digli di andare al .", 70, 230, 0, 1, 1, 0xffffffff)
@font_Segoe_UI_20.draw("32", (@font_Segoe_UI_20.text_width("- L'altro giocatore sta cercando di nascondersi. Digli di andare al ", 1)) + 70, 230, 0, 1, 1, ((0xff - @glow) << 24) + 0xffff00)
@font_Segoe_UI_20.draw("- L'altro giocatore e' riuscito a lasciare la stanza. Vai al .", 70, 250, 0, 1, 1, 0xffffffff)
@font_Segoe_UI_20.draw("5", (@font_Segoe_UI_20.text_width("- L'altro giocatore e' riuscito a lasciare la stanza. Vai al ", 1)) + 70, 250, 0, 1, 1, ((0xff - @glow) << 24) + 0xffff00)
@font_Segoe_UI_20.draw("- L'altro giocatore fa qualcosa tale per cui vuoi testare la sua capacita' di mantenere la calma.", 70, 270, 0, 1, 1, 0xffffffff)
@font_Segoe_UI_20.draw("Digli di andare al , , , o (scegli liberamente, vanno bene tutti)", 70, 290, 0, 1, 1, 0xffffffff)
@font_Segoe_UI_20.draw("6 8 10 14 16", (@font_Segoe_UI_20.text_width("Digli di andare al ", 1)) + 70, 290, 0, 1, 1, ((0xff - @glow) << 24) + 0xffff00)
@font_Segoe_UI_20.draw("- Decidi che il fantasma se ne va. Vai al .", 70, 310, 0, 1, 1, 0xffffffff)
@font_Segoe_UI_20.draw("3", (@font_Segoe_UI_20.text_width("- Decidi che il fantasma se ne va. Vai al ", 1)) + 70, 310, 0, 1, 1, ((0xff - @glow) << 24) + 0xffff00)
end
Gosu::Font
is meant for short, non-wrapping, dynamic texts. Gosu::Image.from_text
provides line-wrapping, text alignment and some formatting.<c=00000000>...</c>
around the glowing parts (making them transparent) and once with the same tag around all other text. Then you'd have one normal Gosu::Image
for the base text and one for the glowing parts, so you could just pulse the second image over the first and be done in two single Image#draw
calls. :)from_text
, you could save the generated images to PNG with Gosu::Image#save
and reload them. Then you would not need to ship the font, unless you also use the Gosu::Font
in other places.Gosu::Font
and Image
are dumb, it is normal to build upon them.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill