|
| Spritefont Text Generator (WIP) | |
| | Pengirim | Message |
---|
bungatepijalan Moe Princess
Posts : 1487 Thanked : 30 Engine : Multi-Engine User Skill : Intermediate Type : Developer
Trophies
Awards: | Subyek: Spritefont Text Generator (WIP) 2011-04-05, 14:11 | |
| Spritefont Text Generator Versi: 1.0 (WIP) Tipe: Custom Text Drawing System PengenalanScript ini digunakan untuk menampilkan teks dengan menggunakan sprite yg disebut Spritefont, tidak dengan font2 yg terinstal di komputer. Sistem ini banyak digunakan di beberapa game konsol (Sega, PS, DOS games, dll) dan bahkan game2 kecilan yg sekarang juga menggunakan ini. Dengan sistem ini, anda dapat membuat dan menggunakan style tulisan sendiri tanpa harus membuat file font dan menginstalnya di komputer, hanya dengan mengedit spritefont di image editor anda (Paint, Photoshop, etc). Berikut ini contoh spritefont: Features To-Do List- Text alignment (left, center, right) [DONE]
- Multiline text [N/A]
- Word wrap text [N/A]
- Characters with non-uniform widths. [N/A]
- Meng-override bagian2 script default RGSS yang menampilkan teks2 di menu dan dialog dengan sistem spritefont [N/A]
FAQQ: Apa itu spritefont? A: Sprite yang berisi tile2 karakter teks, seperti yg ditunjukkan di contoh di atas. Q: Gimana cara masang scriptnya? A: Tinggal lgs copas di slot script yg baru. Q: Gimana cara menggunakannya? A: Lihat petunjuk di script-nya dan pelajari demo-nya. Q: Saat pindah scene, koq teksnya tetep ada? A: Berarti anda lupa panggil method dispose setelah Graphics.freeze ato bagian dispose scene-nya Q: Kenapa script ini masih WIP? A: Belum semua fitur di To-do List diimplementasikan disini. Q: Koq huruf2 yg ditampilkan ga sesuai? A: Berarti penyusunan karakter2 di spritefont anda ada yg salah. Susunannya harus sesuai urutan kode ASCII, mulai dari kode 33 ('!') sampai 176. Atau biar ga bingung, lihat di contoh spritefont. Q: Ukuran gambar spritefont bebas ga? A: Ya, tapi panjangnya hrs kelipatan 16 dan lebarnya hrs kelipatan 9. Q: Bisakah script ini digunakan di RMVX? A: Ya, karena scriptnya tidak memanipulasi script2 default. Tapi penggunaannya mungkin sedikit berbeda. Screenshot DemoSample untuk menampilkan teks2 di scene baru (pake RMXP). Disini navigasi New Game tidak ke Scene_Map, tapi justru ke scene baru tsb. http://ifile.it/98voxpq/spritefont.zip Script - Code:
-
#============================================================================== # Spritefont Text Generator (WIP) # Version 1.01 #============================================================================== # Copyrighted by Bunga Tepi Jalan. # * Don't forget to credit me if you want to use this work # * You are free to Share - to copy, distribute and transmit the work # * You are free to Remix - to adapt the work # * You may not use this work for commercial purposes # #============================================================================== # Information: # This script enables you to draw text using a sprite, called spritefont, # without having to use fonts installed on your computer. # # Usage Notes # - Place spritefont files at location as configured in this script. # - Each spritefont file contains 16x9 character tiles, so its width and # height must be divisible by 16 and 9, respectively (e.g. 144x108). # - Character tiles are ordered by ASCII code of the characters, # beginning from code 33 to 176. # - Don't forget to call update method after changing the text position. # - Don't forget also to call dispose method in the end of current scene. # # If you find any bugs or you have any suggestions, please report them via # e-mail (listra92@gmail.com), or either my blog or these forums: # - http://bungatepijalan.wordpress.com # - http://rmid.forumotion.net #==============================================================================
module Spritefonts #-------------------------------------------------------------------------- # * Spritefont Text Generator Configuration #-------------------------------------------------------------------------- # Location of spritefont files to be used SF_PATH = "Graphics/Pictures/spritefonts/" #============================================================================== # ** SFText #------------------------------------------------------------------------------ # An instance of this class represents a text drawn on the screen. Use # Spritefonts::SFText.new(...) to create a new one. #============================================================================== class SFText #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :x attr_accessor :y attr_reader :text attr_reader :align #-------------------------------------------------------------------------- # * Object Initialization # sfname : spritefont file name (without path) # _text : text string # _x, _y : position of text # _align : text alignment (0: left, 1: center, 2: right) #-------------------------------------------------------------------------- def initialize(sfname, _text, _x = 0, _y = 0, _align = 0) @x = _x @y = _y @text = _text @align = _align @sfb = Bitmap.new(SF_PATH+sfname) @chars = Array.new update end #-------------------------------------------------------------------------- # * Change Text # _text : new text string #-------------------------------------------------------------------------- def change_text(_text) @text = _text update end #-------------------------------------------------------------------------- # * Change Align # _align : text alignment (0: left, 1: center, 2: right) #-------------------------------------------------------------------------- def change_align(_align) @align = _align update end #-------------------------------------------------------------------------- # * Update Text Display #-------------------------------------------------------------------------- def update cw = @sfb.rect.width/16 ch = @sfb.rect.height/9 if @chars.length != 0 dispose @chars = Array.new end for i in 0..@text.length-1 @chars.push(Sprite.new(Viewport.new(x+cw*i, y, cw, ch))) @chars[i].bitmap = @sfb @chars[i].x = -((@text[i]-1)%16)*cw @chars[i].y = -((@text[i]-1)/16-2)*ch if @align == 1 @chars[i].viewport.rect.x -= cw*@text.length/2 elsif @align == 2 @chars[i].viewport.rect.x -= cw*@text.length end end end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose for i in 0..@chars.length-1 @chars[i].dispose end end end end Credits
Terakhir diubah oleh bungatepijalan tanggal 2011-04-05, 16:57, total 1 kali diubah (Reason for editing : Ralat script...) | |
| | | DrDhoom Doomed Zombie
Posts : 629 Thanked : 22 Engine : Multi-Engine User Skill : Intermediate Type : Scripter
| Subyek: Re: Spritefont Text Generator (WIP) 2011-04-05, 14:49 | |
| wah mntp nih script ny... btw, character ny bs dtmbh lg g tuh... | |
| | | Kuro Ethernite The Creator
Posts : 1631 Thanked : 24 Engine : RMVX Ace Skill : Masterful Type : Jack of All Trades
Trophies
Awards:
| Subyek: Re: Spritefont Text Generator (WIP) 2011-04-05, 15:00 | |
| errr..... jenis yg rada sama sperti yg prnah q request k seseorang bisa buatin yg VX ga ?? and using iconset instead ?? jdi ceritany brkesan sperti "show icon" d screen lngsung gtu | |
| | | bungatepijalan Moe Princess
Posts : 1487 Thanked : 30 Engine : Multi-Engine User Skill : Intermediate Type : Developer
Trophies
Awards: | | | | Kuro Ethernite The Creator
Posts : 1631 Thanked : 24 Engine : RMVX Ace Skill : Masterful Type : Jack of All Trades
Trophies
Awards:
| Subyek: Re: Spritefont Text Generator (WIP) 2011-04-05, 16:44 | |
| FAQ ny ga d baca tdi fine then ~ I'll test it ~ ~ | |
| | | bungatepijalan Moe Princess
Posts : 1487 Thanked : 30 Engine : Multi-Engine User Skill : Intermediate Type : Developer
Trophies
Awards: | Subyek: Re: Spritefont Text Generator (WIP) 2011-04-05, 17:03 | |
| Sori, ada sedikit ralat di scriptnya: di bagian method initialize-nya, dirobah jadi @sfb = Bitmap.new(SF_PATH+sfname), jadi ga akan selalu menggunakan nama "spritefont.png". Berikut ini script hasil ralatnya. - Code:
-
#============================================================================== # Spritefont Text Generator (WIP) # Version 1.01 #============================================================================== # Copyrighted by Bunga Tepi Jalan. # * Don't forget to credit me if you want to use this work # * You are free to Share - to copy, distribute and transmit the work # * You are free to Remix - to adapt the work # * You may not use this work for commercial purposes # #============================================================================== # Information: # This script enables you to draw text using a sprite, called spritefont, # without having to use fonts installed on your computer. # # Usage Notes # - Place spritefont files at location as configured in this script. # - Each spritefont file contains 16x9 character tiles, so its width and # height must be divisible by 16 and 9, respectively (e.g. 144x108). # - Character tiles are ordered by ASCII code of the characters, # beginning from code 33 to 176. # - Don't forget to call update method after changing the text position. # - Don't forget also to call dispose method in the end of current scene. # # If you find any bugs or you have any suggestions, please report them via # e-mail (listra92@gmail.com), or either my blog or these forums: # - http://bungatepijalan.wordpress.com # - http://rmid.forumotion.net #==============================================================================
module Spritefonts #-------------------------------------------------------------------------- # * Spritefont Text Generator Configuration #-------------------------------------------------------------------------- # Location of spritefont files to be used SF_PATH = "Graphics/Pictures/spritefonts/" #============================================================================== # ** SFText #------------------------------------------------------------------------------ # An instance of this class represents a text drawn on the screen. Use # Spritefonts::SFText.new(...) to create a new one. #============================================================================== class SFText #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :x attr_accessor :y attr_reader :text attr_reader :align #-------------------------------------------------------------------------- # * Object Initialization # sfname : spritefont file name (without path) # _text : text string # _x, _y : position of text # _align : text alignment (0: left, 1: center, 2: right) #-------------------------------------------------------------------------- def initialize(sfname, _text, _x = 0, _y = 0, _align = 0) @x = _x @y = _y @text = _text @align = _align @sfb = Bitmap.new(SF_PATH+sfname) @chars = Array.new update end #-------------------------------------------------------------------------- # * Change Text # _text : new text string #-------------------------------------------------------------------------- def change_text(_text) @text = _text update end #-------------------------------------------------------------------------- # * Change Align # _align : text alignment (0: left, 1: center, 2: right) #-------------------------------------------------------------------------- def change_align(_align) @align = _align update end #-------------------------------------------------------------------------- # * Update Text Display #-------------------------------------------------------------------------- def update cw = @sfb.rect.width/16 ch = @sfb.rect.height/9 if @chars.length != 0 dispose @chars = Array.new end for i in 0..@text.length-1 @chars.push(Sprite.new(Viewport.new(x+cw*i, y, cw, ch))) @chars[i].bitmap = @sfb @chars[i].x = -((@text[i]-1)%16)*cw @chars[i].y = -((@text[i]-1)/16-2)*ch if @align == 1 @chars[i].viewport.rect.x -= cw*@text.length/2 elsif @align == 2 @chars[i].viewport.rect.x -= cw*@text.length end end end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose for i in 0..@chars.length-1 @chars[i].dispose end end end end Tapi sori, demo tidak di-update utk ralat ini. Sebagai gantinya, tinggal copas script baru ini aja. Kalo nemu kesalahan lainnya, silakan reply, tp jangan request fitur dulu, soalnya msh WIP.
Thanks | |
| | | Kuro Ethernite The Creator
Posts : 1631 Thanked : 24 Engine : RMVX Ace Skill : Masterful Type : Jack of All Trades
Trophies
Awards:
| Subyek: Re: Spritefont Text Generator (WIP) 2011-04-05, 17:13 | |
| yg d ralat itu, cuma biar ga slalu pake nama "spritefont.png" doank kan ?? then, q cuma prlu sdikit mggunakan ilmu scripting q (yg rendahan ini ) mgkin bisa q manipulasi ssuai kbutuhan q ~ (chance to manipulate : < 10% ) | |
| | | KID_VX Senior
Posts : 959 Thanked : 24 Engine : Multi-Engine User Skill : Very Beginner Type : Developer
| Subyek: Re: Spritefont Text Generator (WIP) 2011-04-05, 21:34 | |
| wah mantap nih sangat berguna untuk kedepannya Enjoy | |
| | | Sponsored content
| Subyek: Re: Spritefont Text Generator (WIP) | |
| |
| | | | Spritefont Text Generator (WIP) | |
|
Similar topics | |
|
| Permissions in this forum: | Anda tidak dapat menjawab topik
| |
| |
| Latest topics | » [Web Novel] Gloria Infidelis by LightNightKnight 2016-11-17, 21:27
» [Announcement] Forum baru untuk RMID by TheoAllen 2016-08-25, 16:39
» Where I'm Wrong ? by ReydVires 2016-07-24, 16:10
» flakeheartnet's Resources part III by flakeheartnet 2016-07-08, 14:30
» Keira's Art Warehouse by KeiraBlaze 2016-06-28, 19:27
» Theo Core Time System + Bingung by Lockin 2016-06-27, 16:24
» Error Script, Maybe ? by Lockin 2016-06-27, 16:20
» Nusaimoe @ RMID Lounge by Jihad Bagas 2016-06-21, 05:02
» Call Random Battle by Lockin 2016-06-15, 17:04
» Flakeheartnet Resources Part II [come back gift] by flakeheartnet 2016-06-07, 15:51
|
Statistics
|
Members: [ 4947 ]
Topics: [ 8258 ]
Posts: [ 112606 ]
Newest member: [ https://rmid.forumotion.net/u4968 ]
|
|
|
|