rubysdl 1.3.1 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MANIFEST +22 -2
- data/NEWS.en +80 -0
- data/NEWS.ja +83 -0
- data/README.en +2 -1
- data/README.ja +2 -2
- data/doc-en/Makefile +18 -0
- data/doc-en/cdrom.rsd +417 -0
- data/doc-en/collision.rsd +174 -0
- data/doc-en/event.rsd +1476 -0
- data/doc-en/font.rsd +811 -0
- data/doc-en/general.rsd +43 -0
- data/doc-en/init.rsd +168 -0
- data/doc-en/joystick.rsd +401 -0
- data/doc-en/mixer.rsd +869 -0
- data/doc-en/mpeg.rsd +585 -0
- data/doc-en/opengl.rsd +155 -0
- data/doc-en/sdlskk.rsd +472 -0
- data/doc-en/time.rsd +46 -0
- data/doc-en/video.rsd +2806 -0
- data/doc-en/wm.rsd +112 -0
- data/doc/Makefile +1 -1
- data/doc/cdrom.rsd +3 -3
- data/doc/event.rsd +178 -179
- data/doc/general.rsd +10 -0
- data/doc/init.rsd +2 -2
- data/doc/joystick.rsd +29 -5
- data/doc/mixer.rsd +20 -0
- data/doc/rsd.rb +42 -9
- data/doc/sdlskk.rsd +7 -7
- data/doc/video.rsd +461 -168
- data/doc/wm.rsd +2 -2
- data/extconf.rb +1 -8
- data/lib/rubysdl_aliases.rb +52 -190
- data/lib/rubysdl_compatible_ver1.rb +243 -0
- data/lib/sdl.rb +58 -92
- data/rubysdl.h +59 -68
- data/rubysdl_cdrom.c +125 -102
- data/{rubysdl_doc.en.rd → rubysdl_doc_old.en.rd} +3 -2
- data/rubysdl_event.c +318 -255
- data/rubysdl_event_key.c +299 -287
- data/rubysdl_image.c +37 -13
- data/rubysdl_joystick.c +180 -67
- data/rubysdl_kanji.c +61 -75
- data/rubysdl_main.c +65 -138
- data/rubysdl_mixer.c +339 -214
- data/rubysdl_mouse.c +50 -43
- data/rubysdl_opengl.c +31 -28
- data/rubysdl_pixel.c +17 -28
- data/rubysdl_ref.en.html +5658 -0
- data/rubysdl_ref.en.rd +6337 -0
- data/rubysdl_ref.html +2253 -1964
- data/rubysdl_ref.rd +823 -469
- data/rubysdl_rwops.c +9 -6
- data/rubysdl_sdlskk.c +137 -165
- data/rubysdl_sge_video.c +355 -469
- data/rubysdl_smpeg.c +189 -190
- data/rubysdl_time.c +1 -1
- data/rubysdl_ttf.c +147 -215
- data/rubysdl_video.c +486 -405
- data/rubysdl_wm.c +30 -30
- data/sample/aadraw.rb +9 -9
- data/sample/alpha.rb +12 -13
- data/sample/alphadraw.rb +10 -10
- data/sample/bfont.rb +4 -4
- data/sample/cdrom.rb +11 -4
- data/sample/collision.rb +20 -20
- data/sample/cursor.rb +5 -5
- data/sample/ellipses.rb +20 -16
- data/sample/event2.rb +11 -9
- data/sample/font.rb +4 -4
- data/sample/fpstimer.rb +3 -3
- data/sample/icon.bmp.gz +0 -0
- data/sample/icon.png +0 -0
- data/sample/joy2.rb +14 -14
- data/sample/kanji.rb +7 -7
- data/sample/load_from_io.rb +44 -0
- data/sample/movesp.rb +13 -12
- data/sample/playmod.rb +2 -3
- data/sample/plaympeg.rb +8 -8
- data/sample/playwave.rb +5 -6
- data/sample/sdlskk.rb +11 -11
- data/sample/sgetest.rb +14 -12
- data/sample/stetris.rb +12 -13
- data/sample/testgl.rb +13 -14
- data/sample/testsprite.rb +12 -11
- data/sample/transformblit.rb +23 -22
- metadata +62 -35
- data/rubysdl_event2.c +0 -417
data/rubysdl_time.c
CHANGED
data/rubysdl_ttf.c
CHANGED
@@ -23,302 +23,234 @@
|
|
23
23
|
|
24
24
|
typedef SDL_Surface* (*RenderFunc)(TTF_Font *,const char *,SDL_Color,SDL_Color);
|
25
25
|
|
26
|
-
static int
|
27
|
-
static
|
26
|
+
static int ttf_init = 0;
|
27
|
+
static VALUE cTTFFont = Qnil;
|
28
28
|
|
29
|
-
static void
|
29
|
+
static void Font_free(TTF_Font *font)
|
30
30
|
{
|
31
|
-
if(
|
31
|
+
if(!rubysdl_is_quit())
|
32
32
|
TTF_CloseFont(font);
|
33
33
|
}
|
34
|
-
|
34
|
+
|
35
|
+
GLOBAL_DEFINE_GET_STRUCT(TTF_Font, Get_TTF_Font, cTTFFont, "SDL::TT::Font");
|
36
|
+
|
37
|
+
static VALUE TTF_s_init(VALUE klass)
|
35
38
|
{
|
36
|
-
|
39
|
+
rb_secure(4);
|
40
|
+
if(TTF_Init() == -1)
|
37
41
|
rb_raise(eSDLError,"Couldn't initialize TTF engine: %s",TTF_GetError());
|
38
|
-
|
42
|
+
ttf_init = 1;
|
39
43
|
return Qnil;
|
40
44
|
}
|
41
|
-
|
45
|
+
|
46
|
+
static VALUE TTF_s_init_p(VALUE class)
|
42
47
|
{
|
43
|
-
return
|
48
|
+
return INT2BOOL(TTF_WasInit());
|
44
49
|
}
|
45
50
|
|
46
|
-
static VALUE
|
51
|
+
static VALUE Font_s_open(int argc, VALUE *argv, VALUE class)
|
47
52
|
{
|
48
53
|
TTF_Font *font;
|
49
54
|
VALUE filename, size, index;
|
55
|
+
|
56
|
+
rb_secure(4);
|
50
57
|
rb_scan_args( argc, argv, "21", &filename, &size, &index );
|
51
|
-
|
52
|
-
|
58
|
+
|
59
|
+
SafeStringValue(filename);
|
60
|
+
|
61
|
+
if(NIL_P(index))
|
62
|
+
font = TTF_OpenFont(RSTRING_PTR(filename), NUM2INT(size));
|
53
63
|
else
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
#endif
|
62
|
-
if( font==NULL )
|
63
|
-
rb_raise(eSDLError,"Couldn't open font %s: %s",GETCSTR(filename),
|
64
|
-
TTF_GetError());
|
65
|
-
return Data_Wrap_Struct(class,0,ttf_closeFont,font);
|
64
|
+
font = TTF_OpenFontIndex(RSTRING_PTR(filename),
|
65
|
+
NUM2INT(size), NUM2INT(index));
|
66
|
+
|
67
|
+
if(font == NULL)
|
68
|
+
rb_raise(eSDLError,"Couldn't open font %s: %s",
|
69
|
+
RSTRING_PTR(filename), TTF_GetError());
|
70
|
+
return Data_Wrap_Struct(class, 0, Font_free, font);
|
66
71
|
}
|
67
|
-
|
72
|
+
|
73
|
+
static VALUE Font_style(VALUE self)
|
68
74
|
{
|
69
|
-
|
70
|
-
Data_Get_Struct(obj,TTF_Font,font);
|
71
|
-
return INT2FIX( TTF_GetFontStyle(font) );
|
75
|
+
return INT2FIX(TTF_GetFontStyle(Get_TTF_Font(self)));
|
72
76
|
}
|
73
|
-
|
77
|
+
|
78
|
+
static VALUE Font_set_style(VALUE self, VALUE style)
|
74
79
|
{
|
75
|
-
|
76
|
-
Data_Get_Struct(obj,TTF_Font,font);
|
77
|
-
TTF_SetFontStyle(font,NUM2UINT(style));
|
80
|
+
TTF_SetFontStyle(Get_TTF_Font(self), NUM2UINT(style));
|
78
81
|
return Qnil;
|
79
82
|
}
|
80
|
-
|
81
|
-
|
82
|
-
#ifdef TTF_FONTFACES
|
83
|
-
TTF_Font *font;
|
84
|
-
Data_Get_Struct(obj,TTF_Font,font);
|
85
|
-
return UINT2NUM( TTF_FontFaces(font) );
|
86
|
-
#else
|
87
|
-
rb_raise(rb_eRuntimeError,"Not supported. The feature is in SDL_ttf 2.0.4 or later.");
|
88
|
-
#endif
|
89
|
-
}
|
90
|
-
static VALUE sdl_ttf_FontFaceIsFixedWidth(VALUE obj)
|
91
|
-
{
|
92
|
-
#ifdef TTF_FONTISFIXEDWIDTH
|
93
|
-
TTF_Font *font;
|
94
|
-
Data_Get_Struct(obj,TTF_Font,font);
|
95
|
-
if( TTF_FontFaceIsFixedWidth(font) )
|
96
|
-
return Qtrue;
|
97
|
-
else
|
98
|
-
return Qfalse;
|
99
|
-
#else
|
100
|
-
rb_raise(rb_eRuntimeError,"Not supported. The feature is in SDL_ttf 2.0.4 or later.");
|
101
|
-
#endif
|
102
|
-
}
|
103
|
-
static VALUE sdl_ttf_FontFaceFamilyName(VALUE obj)
|
104
|
-
{
|
105
|
-
#ifdef TTF_FONTFACEFAMILYNAME
|
106
|
-
TTF_Font *font;
|
107
|
-
char* name;
|
108
|
-
|
109
|
-
Data_Get_Struct(obj,TTF_Font,font);
|
110
|
-
name = TTF_FontFaceFamilyName(font);
|
111
|
-
if(name == NULL)
|
112
|
-
return Qnil;
|
113
|
-
else
|
114
|
-
return rb_str_new2(name);
|
115
|
-
#else
|
116
|
-
rb_raise(rb_eRuntimeError,"Not supported. The feature is in SDL_ttf 2.0.4 or later.");
|
117
|
-
#endif
|
118
|
-
}
|
119
|
-
static VALUE sdl_ttf_FontFaceStyleName(VALUE obj)
|
120
|
-
{
|
121
|
-
#ifdef TTF_FONTFACESTYLENAME
|
122
|
-
TTF_Font *font;
|
123
|
-
char* name;
|
124
|
-
|
125
|
-
Data_Get_Struct(obj,TTF_Font,font);
|
126
|
-
name = TTF_FontFaceStyleName(font);
|
127
|
-
if(name == NULL)
|
128
|
-
return Qnil;
|
129
|
-
else
|
130
|
-
return rb_str_new2( (const char *) );
|
131
|
-
#else
|
132
|
-
rb_raise(rb_eRuntimeError,"Not supported. The feature is in SDL_ttf 2.0.4 or later.");
|
133
|
-
#endif
|
134
|
-
}
|
135
|
-
static VALUE sdl_ttf_sizeText(VALUE obj,VALUE text)
|
83
|
+
|
84
|
+
static VALUE Font_faces(VALUE self)
|
136
85
|
{
|
137
|
-
|
138
|
-
int w,h;
|
139
|
-
Data_Get_Struct(obj,TTF_Font,font);
|
140
|
-
TTF_SizeUTF8(font,GETCSTR(text),&w,&h);
|
141
|
-
return rb_ary_new3(2,INT2FIX(w),INT2FIX(h));
|
86
|
+
return UINT2NUM(TTF_FontFaces(Get_TTF_Font(self)));
|
142
87
|
}
|
143
88
|
|
144
|
-
static VALUE
|
89
|
+
static VALUE Font_fixedWidth_p(VALUE self)
|
145
90
|
{
|
146
|
-
|
147
|
-
Data_Get_Struct(obj,TTF_Font,font);
|
148
|
-
return INT2FIX(TTF_FontHeight(font));
|
91
|
+
return INT2BOOL(TTF_FontFaceIsFixedWidth(Get_TTF_Font(self)));
|
149
92
|
}
|
150
93
|
|
151
|
-
static VALUE
|
94
|
+
static VALUE string_or_nil(char* str)
|
152
95
|
{
|
153
|
-
|
154
|
-
|
155
|
-
|
96
|
+
if (str)
|
97
|
+
return rb_str_new2(str);
|
98
|
+
else
|
99
|
+
return Qnil;
|
156
100
|
}
|
157
101
|
|
158
|
-
static VALUE
|
102
|
+
static VALUE Font_familyName(VALUE self)
|
159
103
|
{
|
160
|
-
|
161
|
-
Data_Get_Struct(obj,TTF_Font,font);
|
162
|
-
return INT2FIX(TTF_FontDescent(font));
|
104
|
+
return string_or_nil(TTF_FontFaceFamilyName(Get_TTF_Font(self)));
|
163
105
|
}
|
164
106
|
|
165
|
-
static VALUE
|
107
|
+
static VALUE Font_styleName(VALUE self)
|
166
108
|
{
|
167
|
-
|
168
|
-
Data_Get_Struct(obj,TTF_Font,font);
|
169
|
-
return INT2FIX(TTF_FontLineSkip(font));
|
109
|
+
return string_or_nil(TTF_FontFaceStyleName(Get_TTF_Font(self)));
|
170
110
|
}
|
171
111
|
|
172
|
-
static VALUE
|
173
|
-
VALUE y,VALUE fgr,VALUE fgg,VALUE fgb,
|
174
|
-
VALUE bgr,VALUE bgg,VALUE bgb,RenderFunc render)
|
112
|
+
static VALUE Font_textSize(VALUE self, VALUE text)
|
175
113
|
{
|
176
|
-
|
177
|
-
SDL_Surface *destSurface, *tmpSurface;
|
178
|
-
SDL_Color fg,bg;
|
179
|
-
SDL_Rect destRect;
|
180
|
-
int result;
|
181
|
-
char *ctext=GETCSTR(text);
|
182
|
-
/* If text=="" , TTF_RenderUTF8_Solid() and etc fail to render */
|
183
|
-
if( ctext[0]=='\0' )return INT2FIX(0);
|
184
|
-
|
185
|
-
if( !rb_obj_is_kind_of( dest,cSurface ) )
|
186
|
-
rb_raise( rb_eArgError,"type mismatch(expect Surface)");
|
187
|
-
Data_Get_Struct(obj,TTF_Font,font);
|
188
|
-
Data_Get_Struct(dest,SDL_Surface,destSurface);
|
189
|
-
fg.r=NUM2UINT(fgr); fg.g=NUM2UINT(fgg); fg.b=NUM2UINT(fgb);
|
190
|
-
bg.r=NUM2UINT(bgr); bg.g=NUM2UINT(bgg); bg.b=NUM2UINT(bgb);
|
191
|
-
SetRect(destRect,x,y,1,1);
|
192
|
-
|
193
|
-
tmpSurface=render(font,ctext,fg,bg);
|
194
|
-
if( tmpSurface==NULL )
|
195
|
-
rb_raise(eSDLError,"Text Render fail: %s",TTF_GetError());
|
114
|
+
int w,h;
|
196
115
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
rb_raise(eSDLError,"SDL_BlitSurface fail: %s",SDL_GetError());
|
201
|
-
}
|
202
|
-
return INT2NUM(result);
|
116
|
+
StringValue(text);
|
117
|
+
TTF_SizeUTF8(Get_TTF_Font(self), RSTRING_PTR(text), &w, &h);
|
118
|
+
return rb_ary_new3(2, INT2FIX(w), INT2FIX(h));
|
203
119
|
}
|
204
120
|
|
205
|
-
|
206
|
-
static SDL_Surface* ttf_wrap_RenderUTF8_Solid(TTF_Font *font,
|
207
|
-
const char *text,
|
208
|
-
SDL_Color fg,
|
209
|
-
SDL_Color bg)
|
121
|
+
static VALUE Font_height(VALUE self)
|
210
122
|
{
|
211
|
-
return
|
123
|
+
return INT2FIX(TTF_FontHeight(Get_TTF_Font(self)));
|
212
124
|
}
|
213
125
|
|
214
|
-
static VALUE
|
215
|
-
VALUE y,VALUE r,VALUE g,VALUE b)
|
126
|
+
static VALUE Font_ascent(VALUE self)
|
216
127
|
{
|
217
|
-
return
|
128
|
+
return INT2FIX(TTF_FontAscent(Get_TTF_Font(self)));
|
218
129
|
}
|
219
|
-
|
220
|
-
|
221
|
-
SDL_Color fg,
|
222
|
-
SDL_Color bg)
|
130
|
+
|
131
|
+
static VALUE Font_descent(VALUE self)
|
223
132
|
{
|
224
|
-
return
|
133
|
+
return INT2FIX(TTF_FontDescent(Get_TTF_Font(self)));
|
225
134
|
}
|
226
135
|
|
227
|
-
static VALUE
|
228
|
-
VALUE y,VALUE r,VALUE g,VALUE b)
|
136
|
+
static VALUE Font_lineSkip(VALUE self)
|
229
137
|
{
|
230
|
-
return
|
138
|
+
return INT2FIX(TTF_FontLineSkip(Get_TTF_Font(self)));
|
231
139
|
}
|
232
140
|
|
233
|
-
static
|
234
|
-
VALUE y,VALUE fgr,VALUE fgg,VALUE fgb,
|
235
|
-
VALUE bgr,VALUE bgg,VALUE bgb)
|
141
|
+
static SDL_Color rgb_to_SDL_Color(VALUE r, VALUE g, VALUE b)
|
236
142
|
{
|
237
|
-
|
238
|
-
|
143
|
+
SDL_Color color;
|
144
|
+
color.r = NUM2UINT(r);
|
145
|
+
color.g = NUM2UINT(g);
|
146
|
+
color.b = NUM2UINT(b);
|
147
|
+
color.unused = 0;
|
148
|
+
return color;
|
239
149
|
}
|
240
150
|
|
241
|
-
static VALUE
|
242
|
-
|
151
|
+
static VALUE render(VALUE self, VALUE text,
|
152
|
+
VALUE fgr,VALUE fgg,VALUE fgb,
|
153
|
+
VALUE bgr,VALUE bgg,VALUE bgb,
|
154
|
+
RenderFunc renderer)
|
243
155
|
{
|
244
|
-
TTF_Font *font;
|
245
156
|
SDL_Surface *surface;
|
246
|
-
SDL_Color fg,bg;
|
247
|
-
|
248
|
-
Data_Get_Struct(obj,TTF_Font,font);
|
249
|
-
fg.r=NUM2UINT(fgr); fg.g=NUM2UINT(fgg); fg.b=NUM2UINT(fgb);
|
250
|
-
bg.r=NUM2UINT(bgr); bg.g=NUM2UINT(bgg); bg.b=NUM2UINT(bgb);
|
251
157
|
|
252
|
-
|
158
|
+
rb_secure(4);
|
159
|
+
StringValue(text);
|
253
160
|
|
254
|
-
|
161
|
+
surface = renderer(Get_TTF_Font(self),
|
162
|
+
RSTRING_PTR(text),
|
163
|
+
rgb_to_SDL_Color(fgr, fgg, fgb),
|
164
|
+
rgb_to_SDL_Color(bgr, bgg, bgb));
|
165
|
+
|
166
|
+
if(surface == NULL)
|
255
167
|
return Qnil;
|
256
168
|
|
257
|
-
return
|
169
|
+
return Surface_create(surface);
|
170
|
+
}
|
171
|
+
|
172
|
+
static SDL_Surface* wrap_RenderUTF8_Solid(TTF_Font *font,
|
173
|
+
const char *text,
|
174
|
+
SDL_Color fg,
|
175
|
+
SDL_Color bg)
|
176
|
+
{
|
177
|
+
return TTF_RenderUTF8_Solid(font,text,fg);
|
258
178
|
}
|
259
179
|
|
260
|
-
static
|
261
|
-
|
180
|
+
static SDL_Surface* wrap_RenderUTF8_Blended(TTF_Font *font,
|
181
|
+
const char *text,
|
182
|
+
SDL_Color fg,
|
183
|
+
SDL_Color bg)
|
262
184
|
{
|
263
|
-
return
|
185
|
+
return TTF_RenderUTF8_Blended(font,text,fg);
|
264
186
|
}
|
265
187
|
|
266
|
-
|
267
|
-
|
188
|
+
|
189
|
+
/* 1 is ruby's zero */
|
190
|
+
static VALUE Font_renderSolidUTF8(VALUE self, VALUE text,
|
191
|
+
VALUE r, VALUE g, VALUE b)
|
192
|
+
|
268
193
|
{
|
269
|
-
return
|
194
|
+
return render(self, text, r, g, b, 1, 1, 1,wrap_RenderUTF8_Solid);
|
270
195
|
}
|
271
196
|
|
272
|
-
static VALUE
|
273
|
-
|
274
|
-
|
197
|
+
static VALUE Font_renderBlendedUTF8(VALUE self, VALUE text,
|
198
|
+
VALUE r, VALUE g, VALUE b)
|
199
|
+
|
275
200
|
{
|
276
|
-
return
|
201
|
+
return render(self, text, r, g, b, 1, 1, 1, wrap_RenderUTF8_Blended);
|
277
202
|
}
|
278
203
|
|
279
|
-
static
|
204
|
+
static VALUE Font_renderShadedUTF8(VALUE self, VALUE text,
|
205
|
+
VALUE fgr,VALUE fgg,VALUE fgb,
|
206
|
+
VALUE bgr,VALUE bgg,VALUE bgb)
|
280
207
|
{
|
281
|
-
|
282
|
-
rb_define_const(cTTF,"STYLE_BOLD",UINT2NUM(TTF_STYLE_BOLD));
|
283
|
-
rb_define_const(cTTF,"STYLE_ITALIC",UINT2NUM(TTF_STYLE_ITALIC));
|
284
|
-
rb_define_const(cTTF,"STYLE_UNDERLINE",UINT2NUM(TTF_STYLE_UNDERLINE));
|
208
|
+
return render(self, text, fgr, fgg, fgb, bgr, bgg, bgb, TTF_RenderUTF8_Shaded);
|
285
209
|
}
|
286
|
-
|
210
|
+
|
211
|
+
void rubysdl_init_TTF(VALUE mSDL)
|
287
212
|
{
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
rb_define_singleton_method(cTTF,"open",sdl_ttf_open,-1);
|
213
|
+
cTTFFont = rb_define_class_under(mSDL, "TTF", rb_cObject);
|
214
|
+
|
215
|
+
rb_undef_alloc_func(cTTFFont);
|
292
216
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
rb_define_method(cTTF,"faces",sdl_ttf_getFontFaces,0);
|
297
|
-
rb_define_method(cTTF,"fixedWidth?",sdl_ttf_FontFaceIsFixedWidth,0);
|
298
|
-
rb_define_method(cTTF,"familyName",sdl_ttf_FontFaceFamilyName,0);
|
299
|
-
rb_define_method(cTTF,"styleName",sdl_ttf_FontFaceStyleName,0);
|
300
|
-
|
301
|
-
rb_define_method(cTTF,"height",sdl_ttf_fontHeight,0);
|
302
|
-
rb_define_method(cTTF,"ascent",sdl_ttf_fontAscent,0);
|
303
|
-
rb_define_method(cTTF,"descent",sdl_ttf_fontDescent,0);
|
304
|
-
rb_define_method(cTTF,"lineSkip",sdl_ttf_fontLineSkip,0);
|
217
|
+
rb_define_singleton_method(cTTFFont,"init",TTF_s_init,0);
|
218
|
+
rb_define_singleton_method(cTTFFont,"init?", TTF_s_init_p,0);
|
219
|
+
rb_define_singleton_method(cTTFFont,"open",Font_s_open,-1);
|
305
220
|
|
306
|
-
rb_define_method(
|
307
|
-
rb_define_method(
|
308
|
-
rb_define_method(
|
221
|
+
rb_define_method(cTTFFont,"style",Font_style,0);
|
222
|
+
rb_define_method(cTTFFont,"style=",Font_set_style,1);
|
223
|
+
rb_define_method(cTTFFont,"textSize",Font_textSize,1);
|
224
|
+
rb_define_method(cTTFFont,"faces",Font_faces,0);
|
225
|
+
rb_define_method(cTTFFont,"fixedWidth?",Font_fixedWidth_p,0);
|
226
|
+
rb_define_method(cTTFFont,"familyName",Font_familyName,0);
|
227
|
+
rb_define_method(cTTFFont,"styleName",Font_styleName,0);
|
309
228
|
|
310
|
-
rb_define_method(
|
311
|
-
rb_define_method(
|
312
|
-
rb_define_method(
|
229
|
+
rb_define_method(cTTFFont,"height",Font_height,0);
|
230
|
+
rb_define_method(cTTFFont,"ascent",Font_ascent,0);
|
231
|
+
rb_define_method(cTTFFont,"descent",Font_descent,0);
|
232
|
+
rb_define_method(cTTFFont,"lineSkip",Font_lineSkip,0);
|
313
233
|
|
314
|
-
|
234
|
+
rb_define_method(cTTFFont,"renderSolidUTF8",Font_renderSolidUTF8,4);
|
235
|
+
rb_define_method(cTTFFont,"renderBlendedUTF8",Font_renderBlendedUTF8,4);
|
236
|
+
rb_define_method(cTTFFont,"renderShadedUTF8",Font_renderShadedUTF8,7);
|
237
|
+
|
238
|
+
rb_define_const(cTTFFont,"STYLE_NORMAL",UINT2NUM(TTF_STYLE_NORMAL));
|
239
|
+
rb_define_const(cTTFFont,"STYLE_BOLD",UINT2NUM(TTF_STYLE_BOLD));
|
240
|
+
rb_define_const(cTTFFont,"STYLE_ITALIC",UINT2NUM(TTF_STYLE_ITALIC));
|
241
|
+
rb_define_const(cTTFFont,"STYLE_UNDERLINE",UINT2NUM(TTF_STYLE_UNDERLINE));
|
315
242
|
}
|
316
|
-
|
243
|
+
|
244
|
+
void rubysdl_quit_TTF(void)
|
317
245
|
{
|
318
|
-
if(
|
246
|
+
if(ttf_init)
|
319
247
|
TTF_Quit();
|
320
|
-
ttf_finalized=1;
|
321
|
-
}
|
322
248
|
}
|
323
|
-
|
249
|
+
#else /* HAVE_SDL_TTF */
|
250
|
+
void rubysdl_init_TTF(void)
|
251
|
+
{
|
252
|
+
}
|
253
|
+
void rubysdl_quit_TTF(void)
|
254
|
+
{
|
255
|
+
}
|
324
256
|
#endif /* HAVE_SDL_TTF */
|