rubysdl 1.3.1 → 2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/MANIFEST +22 -2
  2. data/NEWS.en +80 -0
  3. data/NEWS.ja +83 -0
  4. data/README.en +2 -1
  5. data/README.ja +2 -2
  6. data/doc-en/Makefile +18 -0
  7. data/doc-en/cdrom.rsd +417 -0
  8. data/doc-en/collision.rsd +174 -0
  9. data/doc-en/event.rsd +1476 -0
  10. data/doc-en/font.rsd +811 -0
  11. data/doc-en/general.rsd +43 -0
  12. data/doc-en/init.rsd +168 -0
  13. data/doc-en/joystick.rsd +401 -0
  14. data/doc-en/mixer.rsd +869 -0
  15. data/doc-en/mpeg.rsd +585 -0
  16. data/doc-en/opengl.rsd +155 -0
  17. data/doc-en/sdlskk.rsd +472 -0
  18. data/doc-en/time.rsd +46 -0
  19. data/doc-en/video.rsd +2806 -0
  20. data/doc-en/wm.rsd +112 -0
  21. data/doc/Makefile +1 -1
  22. data/doc/cdrom.rsd +3 -3
  23. data/doc/event.rsd +178 -179
  24. data/doc/general.rsd +10 -0
  25. data/doc/init.rsd +2 -2
  26. data/doc/joystick.rsd +29 -5
  27. data/doc/mixer.rsd +20 -0
  28. data/doc/rsd.rb +42 -9
  29. data/doc/sdlskk.rsd +7 -7
  30. data/doc/video.rsd +461 -168
  31. data/doc/wm.rsd +2 -2
  32. data/extconf.rb +1 -8
  33. data/lib/rubysdl_aliases.rb +52 -190
  34. data/lib/rubysdl_compatible_ver1.rb +243 -0
  35. data/lib/sdl.rb +58 -92
  36. data/rubysdl.h +59 -68
  37. data/rubysdl_cdrom.c +125 -102
  38. data/{rubysdl_doc.en.rd → rubysdl_doc_old.en.rd} +3 -2
  39. data/rubysdl_event.c +318 -255
  40. data/rubysdl_event_key.c +299 -287
  41. data/rubysdl_image.c +37 -13
  42. data/rubysdl_joystick.c +180 -67
  43. data/rubysdl_kanji.c +61 -75
  44. data/rubysdl_main.c +65 -138
  45. data/rubysdl_mixer.c +339 -214
  46. data/rubysdl_mouse.c +50 -43
  47. data/rubysdl_opengl.c +31 -28
  48. data/rubysdl_pixel.c +17 -28
  49. data/rubysdl_ref.en.html +5658 -0
  50. data/rubysdl_ref.en.rd +6337 -0
  51. data/rubysdl_ref.html +2253 -1964
  52. data/rubysdl_ref.rd +823 -469
  53. data/rubysdl_rwops.c +9 -6
  54. data/rubysdl_sdlskk.c +137 -165
  55. data/rubysdl_sge_video.c +355 -469
  56. data/rubysdl_smpeg.c +189 -190
  57. data/rubysdl_time.c +1 -1
  58. data/rubysdl_ttf.c +147 -215
  59. data/rubysdl_video.c +486 -405
  60. data/rubysdl_wm.c +30 -30
  61. data/sample/aadraw.rb +9 -9
  62. data/sample/alpha.rb +12 -13
  63. data/sample/alphadraw.rb +10 -10
  64. data/sample/bfont.rb +4 -4
  65. data/sample/cdrom.rb +11 -4
  66. data/sample/collision.rb +20 -20
  67. data/sample/cursor.rb +5 -5
  68. data/sample/ellipses.rb +20 -16
  69. data/sample/event2.rb +11 -9
  70. data/sample/font.rb +4 -4
  71. data/sample/fpstimer.rb +3 -3
  72. data/sample/icon.bmp.gz +0 -0
  73. data/sample/icon.png +0 -0
  74. data/sample/joy2.rb +14 -14
  75. data/sample/kanji.rb +7 -7
  76. data/sample/load_from_io.rb +44 -0
  77. data/sample/movesp.rb +13 -12
  78. data/sample/playmod.rb +2 -3
  79. data/sample/plaympeg.rb +8 -8
  80. data/sample/playwave.rb +5 -6
  81. data/sample/sdlskk.rb +11 -11
  82. data/sample/sgetest.rb +14 -12
  83. data/sample/stetris.rb +12 -13
  84. data/sample/testgl.rb +13 -14
  85. data/sample/testsprite.rb +12 -11
  86. data/sample/transformblit.rb +23 -22
  87. metadata +62 -35
  88. data/rubysdl_event2.c +0 -417
data/doc-en/font.rsd ADDED
@@ -0,0 +1,811 @@
1
+ = Font
2
+ * ((< Font drawing outline>))
3
+ * ((<SDL::TTF>))
4
+ * ((<SDL::BMFont>))
5
+ * ((<SDL::Kanji>))
6
+ * Font methods
7
+ TOC
8
+
9
+ == Font drawing outline
10
+ Ruby/SDL has three different font drawing system.
11
+ First is True Type Font drawing by
12
+ ((<SDL_ttf|URL:http://www.libsdl.org/projects/SDL_ttf/index.html>)),
13
+ second is original bitmap font/SFont drawing by
14
+ ((<SGE|URL:http://www.etek.chalmers.se/~e8cal1/sge/index.html>)),
15
+ and the last is bdf font drawing by
16
+ ((<SDL_kanji|URL:http://shinh.skr.jp/sdlkanji/>)).
17
+
18
+ Each system has following features.
19
+ * SDL::TTF
20
+
21
+ Extension name of Font file name is ttf and ttc.
22
+ True type font has vector data, therefore you can use arbitrary font size.
23
+
24
+ * SDL::BMFont
25
+
26
+ Font files are mere Windows BMP files or PNG image files.
27
+ In original font file format, image data is regarded as 256 character
28
+ images ordered by ASCII.
29
+ Creating your own fonts is more easy than true type fonts.
30
+
31
+ You can use ((<SFont|URL:http://www.linux-games.com/sfont/>))
32
+ with this class. This format is also bitmap font, but character width
33
+ is variable.
34
+
35
+ You can't use kanji and other Unicode characters.
36
+
37
+ * SDL::Kanji
38
+
39
+ Font files are BDF format. BDF is a kind of bitmap font.
40
+ You can mix multiple font files (for example, alphabet and kanji).
41
+
42
+ == SDL::TTF
43
+ METHODS(TTF)
44
+
45
+ This class represents true type font.
46
+ ((<SDL_ttf|URL:http://www.libsdl.org/projects/SDL_ttf/index.html>))
47
+ is needed to use this class. Backend of SDL_ttf is
48
+ ((<Freetype|URL:http://www.freetype.org/>)).
49
+
50
+ Note that you should pay attention to font license.
51
+
52
+ == SDL::BMFont
53
+ METHODS(BMFont)
54
+
55
+ This class represets bitmap font.
56
+ ((<SGE|URL:http://www.etek.chalmers.se/~e8cal1/sge/index.html>))
57
+ is needed.
58
+
59
+ == SDL::Kanji
60
+ METHODS(Kanji)
61
+
62
+ This class represets bdf font.
63
+
64
+ == Font methods
65
+ %%%
66
+ NAME init
67
+ MOD TTF
68
+ TYPE .
69
+ DEP SDL_ttf
70
+ PURPOSE Initialize TTF APIs
71
+
72
+ PROTO
73
+ init
74
+
75
+ DESC
76
+ Initialize the truetype font API. This must be called before using other methods
77
+ of this class, excepting @[TTF.init?].
78
+ @[init] does not have to be called before this call.
79
+
80
+ SEEALSO
81
+ TTF.init?
82
+
83
+ %%
84
+ NAME init?
85
+ MOD TTF
86
+ TYPE .
87
+ DEP SDL_ttf
88
+ PURPOSE Query TTF API initialization status
89
+ RVAL true/false
90
+
91
+ PROTO
92
+ init?
93
+
94
+ DESC
95
+ Returns true if TTF API is already initialize, otherwise returns false.
96
+
97
+ SEEALSO
98
+ TTF.init
99
+
100
+ %%
101
+ NAME open
102
+ MOD TTF
103
+ TYPE .
104
+ DEP SDL_ttf
105
+ PURPOSE Load font From a file
106
+ RVAL SDL::TTF
107
+
108
+ PROTO
109
+ open(filename, ptsize, index=0)
110
+
111
+ DESC
112
+ Load $[filename], face $[index], for use as a font, at $[ptsize] size.
113
+
114
+ RET
115
+ Returns new @[TTF] object.
116
+
117
+ EXCEPTION *
118
+
119
+ EXAMPLE
120
+ SDL::TTF.init
121
+ font = SDL::TTF.open("font.ttf", 32, 0)
122
+
123
+ %%
124
+ NAME style
125
+ MOD TTF
126
+ TYPE #
127
+ DEP SDL_ttf
128
+ PURPOSE Get font render style
129
+ RVAL UINT
130
+
131
+ PROTO
132
+ style
133
+
134
+ DESC
135
+ Returns the rendering style as a bitmask composed of the follwing masks:
136
+ * SDL::TTF::STYLE_BOLD
137
+ * SDL::TTF::STYLE_ITALIC
138
+ * SDL::TTF::STYLE_UNDERLINE
139
+ If no style is set then SDL::TTF::STYLE_NORMAL is returned.
140
+
141
+ EXAMPLE
142
+ print "The font style is:"
143
+
144
+ print " normal" if font.style == SDL::TTF::STYLE_NORMAL
145
+ print " bold" if (font.style & SDL::TTF::STYLE_BOLD) != 0
146
+ print " italic" if (font.style & SDL::TTF::STYLE_ITALIC) != 0
147
+ print " italic" if (font.style & SDL::TTF::STYLE_UNDERLINE) != 0
148
+
149
+ print "\n"
150
+
151
+ SEEALSO
152
+ TTF#style=
153
+
154
+ %%
155
+ NAME style=
156
+ MOD TTF
157
+ TYPE #
158
+ DEP SDL_ttf
159
+ PURPOSE Set the rendering style.
160
+
161
+ PROTO
162
+ style=(new_style)
163
+
164
+ DESC
165
+ Set the rendering style as $[new_style].
166
+ $[new_style] should be a bitmask composed of the follwing masks:
167
+ * SDL::TTF::STYLE_BOLD
168
+ * SDL::TTF::STYLE_ITALIC
169
+ * SDL::TTF::STYLE_UNDERLINE
170
+ or SDL::TTF::STYLE_NORMAL to reset style.
171
+
172
+ NOTES
173
+ This will flush the internal cache of previously rendered glyphs, even if
174
+ there is no change in style, so it may be best to check the current style using
175
+ @[TTF.style] first.
176
+
177
+ EXAMPLE
178
+ # set the loaded font's style to fake bold italics
179
+ font.style = SDL::TTF::STYLE_ITALIC | SDL::TTF::STYLE_BOLD
180
+
181
+ # render some text in fake bold italics...
182
+
183
+ # set the loaded font's style back to normal
184
+ font.style = SDL::TTF::STYLE_NORMAL
185
+
186
+ SEEALSO
187
+ TTF#style
188
+
189
+ %%
190
+ NAME height
191
+ MOD TTF
192
+ TYPE #
193
+ DEP SDL_ttf
194
+ PURPOSE Get font max height
195
+ RVAL Integer
196
+
197
+ PROTO
198
+ height
199
+
200
+ DESC
201
+ Returns the maximum pixel height of all glyphs of the font. You may use this
202
+ height for rendering text as close together vertically as possible, though adding
203
+ at least one pixel height to it will space it so they can't touch. Remember that
204
+ Ruby/SDL and SDL_ttf doesn't handle multiline
205
+ printing, so you are responsible for line
206
+ spacing, see the @[TTF#line_skip] as well.
207
+
208
+ %%
209
+ NAME ascent
210
+ MOD TTF
211
+ TYPE #
212
+ DEP SDL_ttf
213
+ PURPOSE Get font max ascent (y above origin)
214
+ RVAL Integer
215
+
216
+ PROTO
217
+ ascent
218
+
219
+ DESC
220
+ Get the maximum pixel ascent (height above baseline)
221
+ of all glyphs of the loaded font. This can also be
222
+ interpreted as the distance from the top of the font to the baseline. It could be
223
+ used when drawing an individual glyph relative to a top point, by combining it
224
+ with the glyph's maxy metric to resolve the top of the rectangle used when
225
+ blitting the glyph on the screen.
226
+
227
+ SEEALSO
228
+ TTF#height
229
+ TTF#descent
230
+ TTF#line_skip
231
+
232
+ %%
233
+ NAME descent
234
+ MOD TTF
235
+ TYPE #
236
+ DEP SDL_ttf
237
+ PURPOSE Get font min descent (y below origin)
238
+ RVAL Integer
239
+
240
+ PROTO
241
+ descent
242
+
243
+ DESC
244
+ Get the maximum pixel descent (height below baseline)
245
+ of all glyphs of the loaded font. This can also be
246
+ interpreted as the distance from the baseline to the bottom of the font. It could
247
+ be used when drawing an individual glyph relative to a bottom point, by combining
248
+ it with the glyph's maxy metric to resolve the top of the rectangle used when
249
+ blitting the glyph on the screen.
250
+
251
+ SEEALSO
252
+ TTF#height
253
+ TTF#ascent
254
+ TTF#line_skip
255
+
256
+ %%
257
+ NAME line_skip
258
+ MOD TTF
259
+ TYPE #
260
+ DEP SDL_ttf
261
+ PURPOSE Get font recommended line spacing
262
+ RVAL Integer
263
+
264
+ PROTO
265
+ line_skip
266
+
267
+ DESC
268
+ Get the reccomended pixel height of a rendered line of text of the loaded font.
269
+ This is usually larger than the @[TTF#height] of the font.
270
+
271
+ SEEALSO
272
+ TTF#height
273
+ TTF#ascent
274
+ TTF#descent
275
+
276
+ %%
277
+ NAME faces
278
+ MOD TTF
279
+ TYPE #
280
+ DEP SDL_ttf
281
+ PURPOSE Get the number of faces in a font
282
+ RVAL Integer
283
+
284
+ PROTO
285
+ faces
286
+
287
+ DESC
288
+ Returns the number of faces(subfonts) in a font.
289
+
290
+ %%
291
+ NAME fixed_width?
292
+ MOD TTF
293
+ TYPE #
294
+ DEP SDL_ttf
295
+ PURPOSE Get whether font is monospaced or not.
296
+ RVAL true/false
297
+
298
+ PROTO
299
+ fixed_width?
300
+
301
+ DESC
302
+ Returns true if $[self] font is monospaced, otherwise returns false.
303
+ If font is monospaced, width of the rendered surface is
304
+ (width)*(length of string).
305
+
306
+ SEEALSO
307
+ TTF#faces
308
+ TTF#family_name
309
+
310
+ %%
311
+ NAME family_name
312
+ MOD TTF
313
+ TYPE #
314
+ DEP SDL_ttf
315
+ PURPOSE Get current font face family name string
316
+ RVAL String/nil
317
+
318
+ PROTO
319
+ family_name
320
+ familyName
321
+
322
+ DESC
323
+ Returns current font face family name string.
324
+ Returns nil if that font has no name information.
325
+
326
+ SEEALSO
327
+ TTF#faces
328
+ TTF#fixed_width?
329
+ TTF#style_name
330
+
331
+ %%
332
+ NAME style_name
333
+ MOD TTF
334
+ TYPE #
335
+ DEP SDL_ttf
336
+ PURPOSE Get current font face style name string
337
+ RVAL String/nil
338
+
339
+ PROTO
340
+ style_name
341
+ styleName
342
+
343
+ DESC
344
+ Returns current font face style name string.
345
+ Returns nil if the font has no name information.
346
+
347
+ SEEALSO
348
+ TTF#faces
349
+ TTF#fixed_width?
350
+ TTF#family_name
351
+
352
+ %%
353
+ NAME text_size
354
+ MOD TTF
355
+ TYPE #
356
+ DEP SDL_ttf
357
+ PURPOSE Get size of UTF8 text string as would be rendered
358
+ RVAL [Integer, Integer]
359
+
360
+ PROTO
361
+ text_size(text)
362
+ textSize(text)
363
+
364
+ DESC
365
+ Calculate the resulting surface size of the UTF8 encoded text rendered using font.
366
+ No actual rendering is done, however correct kerning is done to get the actual
367
+ width. The height returned in h is the same as you can get using @[TTF#height].
368
+
369
+ RET
370
+ Returns a 2 element array as [w, h].
371
+
372
+ EXCEPTION *
373
+
374
+ EXAMPLE
375
+ w, h = font.size_text("Hello World!")
376
+ puts "width=#{w} height=#{h}"
377
+
378
+ SEEALSO
379
+ TTF#render_solid_utf8
380
+ TTF#render_shaded_utf8
381
+ TTF#render_blended_utf8
382
+ TTF#draw_solid_utf8
383
+ TTF#draw_shaded_utf8
384
+ TTF#draw_blended_utf8
385
+
386
+ %%
387
+ NAME render_solid_utf8
388
+ MOD TTF
389
+ TYPE #
390
+ DEP SDL_ttf
391
+ PURPOSE Render UTF8 text in solid mode
392
+ RVAL SDL::Surface/nil
393
+
394
+ PROTO
395
+ render_solid_utf8(text, r, g, b)
396
+ renderSolidUTF8(text, r, g, b)
397
+
398
+ DESC
399
+ This method will render the given $[text] with the given font with
400
+ ($[r], [g], $[b])
401
+ color onto a new surface. The Solid mode is used and this is the fastest.
402
+ This method returns new @[surface|Surface] object.
403
+
404
+ This method create an 8-bit palettized
405
+ surface and render the given text at fast quality
406
+ with the given font and color. The 0 pixel value is the colorkey, giving a
407
+ transparent background, and the 1 pixel value is set to the text color. The
408
+ colormap is set to have the desired foreground color at index 1, this allows
409
+ you to change the color without having to render the text again. Colormap
410
+ index 0 is of course not drawn, since it is the colorkey, and thus
411
+ transparent, though it's actual color is 255 minus each RGB component of the
412
+ foreground. This is the fastest rendering speed of all the rendering modes.
413
+ This results in no box around the text, but the text is not as smooth. The
414
+ resulting surface should blit faster than
415
+ the $[Blended|TTF#render_blended_utf8] one. Use this mode for
416
+ FPS and other fast changing updating text displays.
417
+
418
+ SEEALSO
419
+ TTF#render_shaded_utf8
420
+ TTF#render_blended_utf8
421
+ TTF#draw_solid_utf8
422
+
423
+ %%
424
+ NAME render_shaded_utf8
425
+ MOD TTF
426
+ TYPE #
427
+ DEP SDL_ttf
428
+ PURPOSE Render UTF8 text in shaded mode
429
+ RVAL SDL::Surface/nil
430
+
431
+ PROTO
432
+ render_shaded_utf8(text,fg_r,fg_g,fg_b,bg_r,bg_g,bg_b)
433
+ renderShadedUTF8(text,fg_r,fg_g,fg_b,bg_r,bg_g,bg_b)
434
+
435
+ DESC
436
+ This method will render the given $[text] with the given font with
437
+ ($[fg_r], [fg_g], $[fg_b]) color onto a new surface
438
+ with background color ($[bg_r], [bg_g], $[bg_b]).
439
+ Returns new @[surface|Surface] object.
440
+
441
+ This method create an 8-bit palettized
442
+ surface and render the given text at high quality
443
+ with the given font and colors. The 0 pixel value is background, while other
444
+ pixels have varying degrees of the foreground color from the background color.
445
+ This results in a box of the background color around the text in the
446
+ foreground color. The text is antialiased.
447
+ This will render slower than @[Solid|TTF#render_solid_utf8],
448
+ but in about the same time as @[TTF#render_blended_utf8].
449
+ The resulting surface should blit
450
+ as fast as @[Solid|TTF#render_solid_utf8], once it is made.
451
+ Use this when you need nice text, and can
452
+ live with a box...
453
+
454
+ SEEALSO
455
+ TTF#render_solid_utf8
456
+ TTF#render_blended_utf8
457
+ TTF#draw_shaded_utf8
458
+
459
+ %%
460
+ NAME render_blended_utf8
461
+ MOD TTF
462
+ TYPE #
463
+ DEP SDL_ttf
464
+ PURPOSE Render UTF8 text in blended mode
465
+ RVAL SDL::Surface/nil
466
+
467
+ PROTO
468
+ render_blended_utf8(text, r, g, b)
469
+ render_blended_utf8(text, r, g, b)
470
+
471
+ DESC
472
+ This method will render the given $[text] with the given font with ($[r], [g], $[b])
473
+ color onto a new surface with transparent background. This is
474
+ the slowest but most beautiful.
475
+
476
+ This method creates a 32-bit ARGB surface and
477
+ render the given text at high quality, using
478
+ alpha blending to dither the font with the given color. This results in a
479
+ surface with alpha transparency, so you don't have a solid colored box around
480
+ the text. The text is antialiased.
481
+ This will render slower than @[TTF#render_solid_utf8], but in
482
+ about the same time as @[TTF#render_shaded_utf8].
483
+ The resulting surface will blit slower
484
+ than if you had used @[TTF#render_solid_utf8] and @[TTF#render_shaded_utf8].
485
+ Use this when you want high quality, and the text isn't changing too fast.
486
+
487
+ SEEALSO
488
+ TTF#render_solid_utf8
489
+ TTF#render_shaded_utf8
490
+ TTF#draw_blended_utf8
491
+
492
+ %%
493
+ NAME draw_solid_utf8
494
+ MOD TTF
495
+ TYPE #
496
+ DEP SDL_ttf
497
+ PURPOSE Draw UTF8 text in solid mode
498
+
499
+ PROTO
500
+ draw_solid_utf8(dest, text, x, y, r, g, b)
501
+ drawSolidUTF8(dest, text, x, y, r, g, b)
502
+
503
+ DESC
504
+ This method will draw the given $[text]
505
+ with the given font with ($[r], [g], $[b])
506
+ onto $[dest] @[surface|Surface] at ($[x], $[y])
507
+ in @[solid|TTF#render_solid_utf8] mode.
508
+
509
+ SEEALSO
510
+ TTF#draw_shaded_utf8
511
+ TTF#draw_blended_utf8
512
+ TTF#render_solid_utf8
513
+
514
+ %%
515
+ NAME draw_shaded_utf8
516
+ MOD TTF
517
+ TYPE #
518
+ DEP SDL_ttf
519
+ PURPOSE Draw UTF8 text in shaded mode
520
+
521
+ PROTO
522
+ draw_shaded_utf8(dest, text, x, y, fg_r, fg_g, fg_b, bg_r, bg_g, bg_b)
523
+ drawShadedUTF8(dest, text, x, y, fg_r, fg_g, fg_b, bg_r, bg_g, bg_b)
524
+
525
+ DESC
526
+ This method will draw the given $[text]
527
+ with the given font with ($[fg_r], [fg_g], $[fg_b])
528
+ color onto onto $[dest] @[surface|Surface] at ($[x], $[y])
529
+ with background color ($[bg_r], [bg_g], $[bg_b])
530
+ in @[shaded|TTF#render_shaded_utf8] mode.
531
+
532
+ SEEALSO
533
+ TTF#draw_solid_utf8
534
+ TTF#draw_blended_utf8
535
+ TTF#render_shaded_utf8
536
+
537
+ %%
538
+ NAME draw_blended_utf8
539
+ MOD TTF
540
+ TYPE #
541
+ DEP SDL_ttf
542
+ PURPOSE Draw UTF8 text in blended mode
543
+
544
+ PROTO
545
+ draw_blended_utf8(dest, text, x, y, r, g, b)
546
+ drawBlendedUTF8(dest, text, x, y, r, g, b)
547
+
548
+ DESC
549
+ This method will draw the given $[text]
550
+ with the given font with ($[r], [g], $[b])
551
+ onto $[dest] @[surface|Surface] at ($[x], $[y])
552
+ in @[blended|TTF#render_blended_utf8] mode.
553
+
554
+ SEEALSO
555
+ TTF#draw_solid_utf8
556
+ TTF#draw_shaded_utf8
557
+ TTF#render_blended_utf8
558
+
559
+ %%
560
+ NAME open
561
+ MOD BMFont
562
+ TYPE .
563
+ DEP SGE
564
+ PURPOSE Load a bitmap font from file
565
+ RVAL SDL::BMFont
566
+
567
+ PROTO
568
+ open(filename, flags)
569
+
570
+ DESC
571
+ Load a bitmap font from $[filename] file and
572
+ returns new @[BMFont] object.
573
+
574
+ $[flags] is OR'd combination of following values:
575
+ :SDL::BMFont::TRANSPARENT
576
+ Transparent (use @[Surface#set_color_key] internally, should usually be set)
577
+ :SDL::BMFont::NOCONVERT
578
+ Don't @[convert font surface to display format|Surface#display_format]
579
+ for faster blits.
580
+ :SDL::BMFont::SFONT
581
+ If you enabled support for SDL_img when compiling
582
+ SGE you can also set this flag, this enables you to
583
+ load Karl Bartel's SFont files.
584
+ :SDL::BMFont::PALETTE
585
+ Converts the font surface to a palette surface
586
+ (8bit). Don't do this on color fonts or SFonts! Blits from the
587
+ font surface will be a bit slower but @[BMFont#set_color]
588
+ will be faster (O(1) instead of O(n^2)).
589
+
590
+ %%
591
+ NAME set_color
592
+ MOD BMFont
593
+ TYPE #
594
+ DEP SGE
595
+ PURPOSE Change font color
596
+
597
+ PROTO
598
+ set_color(r, g, b)
599
+ setColor(r, g, b)
600
+
601
+ DESC
602
+ Changes the color of the font to ($[r], $[g], $[b]).
603
+ Doesn't work on 'color
604
+ fonts' or SFonts. Use ((<SDL::BMFont::PALETTE>))
605
+ when @[opening|BMFont.open] the font if
606
+ you're going to use this function often.
607
+
608
+ %%
609
+ NAME height
610
+ MOD BMFont
611
+ TYPE #
612
+ DEP SGE
613
+ PURPOSE Get height of the font
614
+ RVAL Integer
615
+
616
+ PROTO
617
+ height
618
+
619
+ DESC
620
+ Returns height.
621
+
622
+ SEEALSO
623
+ BMFont#width
624
+
625
+ %%
626
+ NAME width
627
+ MOD BMFont
628
+ TYPE #
629
+ DEP SGE
630
+ PURPOSE Get width of one character in the font
631
+ RVAL Integer
632
+
633
+ PROTO
634
+ width
635
+
636
+ DESC
637
+ Returns the width of one character in $[self] font.
638
+ Doesn't work on SFonts.
639
+
640
+ SEEALSO
641
+ BMFont#height
642
+
643
+ %%
644
+ NAME text_size
645
+ MOD BMFont
646
+ TYPE #
647
+ DEP SGE
648
+ PURPOSE Get the size of surface needed
649
+ RVAL [Integer, Integer]
650
+
651
+ PROTO
652
+ text_size(string)
653
+ textSize(string)
654
+
655
+ DESC
656
+ Returns the width and height of the $[string] with $[self].
657
+
658
+ SEEALSO
659
+ BMFont#textout
660
+
661
+ %%
662
+ NAME textout
663
+ MOD BMFont
664
+ TYPE #
665
+ DEP SGE
666
+ PURPOSE Render the given string
667
+
668
+ PROTO
669
+ textout(surface, string, x, y)
670
+
671
+ DESC
672
+ Renders the given $[string] on surface with the given font.
673
+ ($[x], $[y]) is the position of the left top corner.
674
+
675
+ COMMENT
676
+ lock ?
677
+
678
+ SEEALSO
679
+ BMFont#text_size
680
+
681
+ %%
682
+ NAME open
683
+ MOD Kanji
684
+ TYPE .
685
+ PURPOSE Load bdf font file
686
+ RVAL SDL::Kanji
687
+
688
+ PROTO
689
+ open(filename, size)
690
+
691
+ DESC
692
+ Load bdf font data from $[filename] and
693
+ returns new @[Kanji] obejct.
694
+ $[size] is the height of one character.
695
+
696
+ SEEALSO
697
+ Kanji#add
698
+
699
+ %%
700
+ NAME add
701
+ MOD Kanji
702
+ TYPE #
703
+ PURPOSE Add font data into already loaded font
704
+
705
+ PROTO
706
+ add(filename)
707
+
708
+ DESC
709
+ Add font data fromt $[filename] into already loaded font $[self].
710
+ This method combines two or more font files into one.
711
+
712
+ SEEALSO
713
+ Kanji#open
714
+
715
+ %%
716
+ NAME set_coding_system
717
+ MOD Kanji
718
+ TYPE #
719
+ PURPOSE Set character encoding
720
+
721
+ PROTO
722
+ set_coding_system(sys)
723
+ setCodingSystem(sys)
724
+
725
+ DESC
726
+ Set encoding. $[sys] is one of following:
727
+ * SDL::Kanji::SJIS
728
+ * SDL::Kanji::EUC
729
+ * SDL::Kanji::JIS
730
+ Default is SDL::Kanji::JIS.
731
+
732
+ %%
733
+ NAME height
734
+ MOD Kanji
735
+ TYPE #
736
+ PURPOSE Get height of one character
737
+ RVAL Integer
738
+
739
+ PROTO
740
+ height
741
+
742
+ DESC
743
+ Returns the height of one character as piexel.
744
+
745
+ %%
746
+ NAME textwidth
747
+ MOD Kanji
748
+ TYPE #
749
+ PURPOSE Get width of given string
750
+ RVAL Integer
751
+
752
+ PROTO
753
+ textwidth(text)
754
+
755
+ DESC
756
+ Get width of given $[text] with $[self] font.
757
+
758
+ SEEALSO
759
+ Kanji#width
760
+
761
+ %%
762
+ NAME width
763
+ MOD Kanji
764
+ TYPE #
765
+ PURPOSE Get the width of one character
766
+
767
+ PROTO
768
+ width
769
+
770
+ DESC
771
+ Returns the width of one character.
772
+
773
+ SEEALSO
774
+ textwidth
775
+
776
+ %%
777
+ NAME put
778
+ MOD Kanji
779
+ TYPE #
780
+ PURPOSE Render text
781
+
782
+ PROTO
783
+ put(surface, text, x, y, r, g, b)
784
+
785
+ DESC
786
+ Renders $[text] at ($[x], $[y]) in $[surface]
787
+ with ($[r], $[g], $[b]) color.
788
+
789
+ SEEALSO
790
+ Kanji#put_tate
791
+
792
+ %%
793
+ NAME put_tate
794
+ MOD Kanji
795
+ TYPE #
796
+ PURPOSE Render tategaki text
797
+
798
+ PROTO
799
+ put_tate(surface, x, y, r, g, b)
800
+ putTate(surface, x, y, r, g, b)
801
+
802
+ DESC
803
+ Renders $[text] as tagetaki at ($[x], $[y]) in $[surface]
804
+ with ($[r], $[g], $[b]) color.
805
+
806
+ `Half-width' character is not rendered.
807
+
808
+ SEEALSO
809
+ Kanji#put
810
+
811
+