gosu 0.7.43-universal-darwin → 0.7.44-universal-darwin

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,14 +53,14 @@ namespace Gosu
53
53
  //! \param fontHeight Height of the font in pixels.
54
54
  //! \param lineSpacing Spacing between two lines of text in pixels. Can be negative to make
55
55
  //! text stick together more closely.
56
- //! \param maxWidth Width of the bitmap that will be returned. Text
56
+ //! \param width Width of the bitmap that will be returned. Text
57
57
  //! will be split into multiple lines to avoid drawing over the right
58
58
  //! border. When a single word is too long, it will be truncated.
59
59
  //! \param fontFlags Binary combination of members of the FontFlags
60
60
  //! enum.
61
61
  Bitmap createText(const std::wstring& text,
62
62
  const std::wstring& fontName, unsigned fontHeight,
63
- int lineSpacing, unsigned maxWidth, TextAlign align,
63
+ int lineSpacing, unsigned width, TextAlign align,
64
64
  unsigned fontFlags = 0);
65
65
 
66
66
  //! Registers a new HTML-style entity that can subsequently be used
@@ -3,8 +3,8 @@
3
3
 
4
4
  #define GOSU_MAJOR_VERSION 0
5
5
  #define GOSU_MINOR_VERSION 7
6
- #define GOSU_POINT_VERSION 43
7
- #define GOSU_VERSION "0.7.43"
6
+ #define GOSU_POINT_VERSION 44
7
+ #define GOSU_VERSION "0.7.44"
8
8
 
9
9
  #define GOSU_COPYRIGHT_NOTICE \
10
10
  " " \
Binary file
@@ -72,4 +72,7 @@ class Gosu::Window
72
72
  def char_to_button_id(ch)
73
73
  self.class.char_to_button_id(ch)
74
74
  end
75
- end
75
+ end
76
+
77
+ # Release OpenAL resources during Ruby's shutdown, not Gosu's.
78
+ at_exit { Gosu::_release_all_openal_resources }
@@ -0,0 +1,5 @@
1
+ = Drawing with Colors
2
+
3
+ Almost all image drawing functions accept modulation colors. The colors of all pixels on the source image will be multiplied with these colors, where a channel value of 255 corresponds to the maximum value of 1.0. This means modulation colors can be used only to reduce particular channels of an image.
4
+
5
+ The most obvious use of this is to supply a color with an alpha value less than 255 so the image will drawn transparently, but you can also use this to darken images or to draw them in a different hue (which works best if the original image is mostly grayscale).
@@ -0,0 +1,5 @@
1
+ = Order of Corners
2
+
3
+ In all functions that expect arguments for all four corners of a rectangle or quadrilateral, you can either pass clockwise coordinates, or coordinates in the following order (a Z shape):
4
+
5
+ http://www.libgosu.org/wiki_images/corner_indices.png
@@ -0,0 +1,11 @@
1
+ = Tileability
2
+
3
+ Functions related to image creation accept a boolean "tileable" argument. This is a consequence of using 3D hardware acceleration. Try to notice the subtle difference between these two, overstretched images:
4
+
5
+ http://www.libgosu.org/wiki_images/hard_borders.png
6
+
7
+ When you draw an image with stretching factors other than 1.0 (10.0 in this case) or at odd coordinates, it will become interpolated—which, in general, is much better than getting all pixel-y.
8
+
9
+ But take a look at the image's borders. The image of the left girl was created with tileable set to 'false' (the default) and the borders fade out. The image of the right girl, which was created with tileable set to 'true, does not fade out at all, but just ends on its borders.
10
+
11
+ While most images should not be tileable, you should always pass true for map tiles.
@@ -0,0 +1,5 @@
1
+ = Z-Ordering
2
+
3
+ All drawing operations in Gosu accept a floating-point value called "z" (technically, a double). Things drawn with a higher z position will be drawn over those with a lower one. If two things have the same z position, they will be drawn in the order the drawing functions were called.
4
+
5
+ If you do not wish to use z ordering, just pass the same constant all the time.
@@ -0,0 +1,596 @@
1
+ # Version string of the form "0.1.2" or "0.1.2.3".
2
+ GOSU_VERSION = :a_string
3
+ # First component of the version.
4
+ GOSU_MAJOR_VERSION = :a_fixnum
5
+ # Second component of the version.
6
+ GOSU_MINOR_VERSION = :a_fixnum
7
+ # Third component of the version.
8
+ GOSU_POINT_VERSION = :a_fixnum
9
+ # A long block of legal copy that your game is obliged to display somewhere.
10
+ GOSU_COPYRIGHT_NOTICE = :a_string
11
+
12
+ module Gosu
13
+ Kb0 = :implementation_defined
14
+ Kb1 = :implementation_defined
15
+ Kb2 = :implementation_defined
16
+ Kb3 = :implementation_defined
17
+ Kb4 = :implementation_defined
18
+ Kb5 = :implementation_defined
19
+ Kb6 = :implementation_defined
20
+ Kb7 = :implementation_defined
21
+ Kb8 = :implementation_defined
22
+ Kb9 = :implementation_defined
23
+ KbA = :implementation_defined
24
+ KbB = :implementation_defined
25
+ KbC = :implementation_defined
26
+ KbD = :implementation_defined
27
+ KbE = :implementation_defined
28
+ KbF = :implementation_defined
29
+ KbG = :implementation_defined
30
+ KbH = :implementation_defined
31
+ KbI = :implementation_defined
32
+ KbJ = :implementation_defined
33
+ KbK = :implementation_defined
34
+ KbL = :implementation_defined
35
+ KbM = :implementation_defined
36
+ KbN = :implementation_defined
37
+ KbO = :implementation_defined
38
+ KbP = :implementation_defined
39
+ KbQ = :implementation_defined
40
+ KbR = :implementation_defined
41
+ KbS = :implementation_defined
42
+ KbT = :implementation_defined
43
+ KbU = :implementation_defined
44
+ KbV = :implementation_defined
45
+ KbW = :implementation_defined
46
+ KbX = :implementation_defined
47
+ KbY = :implementation_defined
48
+ KbZ = :implementation_defined
49
+ KbBackspace = :implementation_defined
50
+ KbDelete = :implementation_defined
51
+ KbDown = :implementation_defined
52
+ KbEnd = :implementation_defined
53
+ # On Numpad
54
+ KbEnter = :implementation_defined
55
+ KbEscape = :implementation_defined
56
+ KbF1 = :implementation_defined
57
+ KbF10 = :implementation_defined
58
+ KbF11 = :implementation_defined
59
+ KbF12 = :implementation_defined
60
+ KbF2 = :implementation_defined
61
+ KbF3 = :implementation_defined
62
+ KbF4 = :implementation_defined
63
+ KbF5 = :implementation_defined
64
+ KbF6 = :implementation_defined
65
+ KbF7 = :implementation_defined
66
+ KbF8 = :implementation_defined
67
+ KbF9 = :implementation_defined
68
+ KbHome = :implementation_defined
69
+ KbInsert = :implementation_defined
70
+ KbLeft = :implementation_defined
71
+ KbLeftAlt = :implementation_defined
72
+ KbLeftControl = :implementation_defined
73
+ KbLeftShift = :implementation_defined
74
+ KbNumpad0 = :implementation_defined
75
+ KbNumpad1 = :implementation_defined
76
+ KbNumpad2 = :implementation_defined
77
+ KbNumpad3 = :implementation_defined
78
+ KbNumpad4 = :implementation_defined
79
+ KbNumpad5 = :implementation_defined
80
+ KbNumpad6 = :implementation_defined
81
+ KbNumpad7 = :implementation_defined
82
+ KbNumpad8 = :implementation_defined
83
+ KbNumpad9 = :implementation_defined
84
+ KbNumpadAdd = :implementation_defined
85
+ KbNumpadDivide = :implementation_defined
86
+ KbNumpadMultiply = :implementation_defined
87
+ KbNumpadSubtract = :implementation_defined
88
+ KbPageDown = :implementation_defined
89
+ KbPageUp = :implementation_defined
90
+ # Above the right shift key
91
+ KbReturn = :implementation_defined
92
+ KbRight = :implementation_defined
93
+ KbRightAlt = :implementation_defined
94
+ KbRightControl = :implementation_defined
95
+ KbRightShift = :implementation_defined
96
+ KbSpace = :implementation_defined
97
+ KbTab = :implementation_defined
98
+ KbUp = :implementation_defined
99
+ MsLeft = :implementation_defined
100
+ MsMiddle = :implementation_defined
101
+ MsRight = :implementation_defined
102
+ MsWheelDown = :implementation_defined
103
+ MsWheelUp = :implementation_defined
104
+ GpButton0 = :implementation_defined
105
+ GpButton1 = :implementation_defined
106
+ GpButton10 = :implementation_defined
107
+ GpButton11 = :implementation_defined
108
+ GpButton12 = :implementation_defined
109
+ GpButton13 = :implementation_defined
110
+ GpButton14 = :implementation_defined
111
+ GpButton15 = :implementation_defined
112
+ GpButton2 = :implementation_defined
113
+ GpButton3 = :implementation_defined
114
+ GpButton4 = :implementation_defined
115
+ GpButton5 = :implementation_defined
116
+ GpButton6 = :implementation_defined
117
+ GpButton7 = :implementation_defined
118
+ GpButton8 = :implementation_defined
119
+ GpButton9 = :implementation_defined
120
+ GpDown = :implementation_defined
121
+ GpLeft = :implementation_defined
122
+ GpRight = :implementation_defined
123
+ GpUp = :implementation_defined
124
+
125
+ # Represents an ARGB color value with 8 bits for each channel. Can be
126
+ # replaced by literals of the form 0xaarrggbb in all of Gosu.
127
+ class Color
128
+ attr_accessor :alpha, :red, :green, :blue, :hue, :saturation, :value
129
+
130
+ # a:: Integer from 0..255
131
+ # r:: Integer from 0..255
132
+ # g:: Integer from 0..255
133
+ # b:: Integer from 0..255
134
+ def initialize(a, r, g, b); end
135
+ # Initializes a color from an 0xrrggbbaa integer.
136
+ def initialize(argb); end
137
+
138
+ def dup; end
139
+
140
+ # Same as the constructor, but with an explicit order.
141
+ def self.rgba(r, g, b, a); end
142
+
143
+ # Initializes a color from an 0xrrggbbaa integer.
144
+ def self.rgba(rgba); end
145
+
146
+ # Same as the constructor, but with an explicit order.
147
+ def self.argb(a, r, g, b); end
148
+
149
+ # Initializes a color from an 0xrrggbbaa integer.
150
+ def self.argb(argb); end
151
+
152
+ # Converts a HSV triple into a color. Same as from_ahsv with alpha set to 255.
153
+ # h:: Integer from 0..360
154
+ # s:: Float from 0..1
155
+ # v:: Float from 0..1.
156
+ def self.from_hsv(h, s, v); end
157
+
158
+ # Converts a HSV triple into a color, with a given alpha.
159
+ # a:: Integer from 0..255
160
+ # h:: Integer from 0..360
161
+ # s:: Float from 0..1
162
+ # v:: Float from 0..1.
163
+ def self.from_ahsv(a, h, s, v); end
164
+
165
+ # 32-bit unsigned value for use with OpenGL ('RGBA' octet in memory).
166
+ def gl; end
167
+
168
+ # constant
169
+ NONE = Gosu::Color.argb(0x00000000)
170
+ # constant
171
+ BLACK = Gosu::Color.argb(0xff000000)
172
+ # constant
173
+ GRAY = Gosu::Color.argb(0xff808080)
174
+ # constant
175
+ WHITE = Gosu::Color.argb(0xffffffff)
176
+ # constant
177
+ AQUA = Gosu::Color.argb(0xff00ffff)
178
+ # constant
179
+ RED = Gosu::Color.argb(0xffff0000)
180
+ # constant
181
+ GREEN = Gosu::Color.argb(0xff00ff00)
182
+ # constant
183
+ BLUE = Gosu::Color.argb(0xff0000ff)
184
+ # constant
185
+ YELLOW = Gosu::Color.argb(0xffffff00)
186
+ # constant
187
+ FUCHSIA = Gosu::Color.argb(0xffff00ff)
188
+ # constant
189
+ CYAN = Gosu::Color.argb(0xff00ffff)
190
+ end
191
+
192
+ # A font can be used to draw text on a Window object very flexibly.
193
+ # Fonts are ideal for small texts that change regularly. For large,
194
+ # static texts you should use Image#from_text.
195
+ class Font
196
+ attr_reader :name, :height
197
+
198
+ # font_name:: Name of a system font, or a filename to a TTF file (must contain '/').
199
+ # height:: Height of the font, in pixels.
200
+ def initialize(window, font_name, height); end
201
+
202
+ # Sets the image to be used for a certain character. Must not be called twice for the same character, or after the character has been drawn already.
203
+ def []=(character, image); end
204
+
205
+ # Draws text so the top left corner of the text is at (x; y).
206
+ #
207
+ # Characters are created internally as needed.
208
+ def draw(text, x, y, z, factor_x=1, factor_y=1, color=0xffffffff, mode=:default); end
209
+
210
+ # Draws text at a position relative to (x; y).
211
+ # rel_x:: Determines where the text is drawn horizontally. If relX is 0.0, the text will be to the right of x, if it is 1.0, the text will be to the left of x, if it is 0.5, it will be centered on x. Of course, all real numbers are possible values.
212
+ # rel_y:: See rel_x.
213
+ def draw_rel(text, x, y, z, rel_x, rel_y, factor_x=1, factor_y=1, color=0xffffffff, mode=:default); end
214
+
215
+ # Returns the width, in pixels, the given text would occupy if drawn.
216
+ def text_width(text, factor_x=1); end
217
+
218
+ # Analogous to draw, but rotates the text by a given angle.
219
+ # @deprecated Use a combination of Window#rotate and Font#draw instead.
220
+ def draw_rot(text, x, y, z, angle, factor_x=1, factor_y=1, color=0xffffffff, mode=:default); end
221
+ end
222
+
223
+ # Provides functionality for drawing rectangular images.
224
+ class Image
225
+ attr_reader :width, :height
226
+
227
+ # Loads an image from a given filename that can be drawn onto the
228
+ # given window. See the Gosu wiki for a list of supported formats.
229
+ #
230
+ # A color key of #ff00ff is automatically applied to BMP type images.
231
+ def initialize(window, filename_or_rmagick_image, tileable); end
232
+
233
+ # Loads an image from a given filename that can be drawn onto the
234
+ # given window. See the Gosu wiki for a list of supported formats.
235
+ #
236
+ # A color key of #ff00ff is automatically applied to BMP type images.
237
+ #
238
+ # This constructor only loads a sub-rectangle of the given file. Because
239
+ # every call of this constructor will open the image again, it is preferable
240
+ # to use Image#load_tiles when possible.
241
+ def initialize(window, filename_or_rmagick_image, tileable, src_x, src_y, src_width, src_height); end
242
+
243
+ # Draws the image so its upper left corner is at (x; y).
244
+ def draw(x, y, z, factor_x=1, factor_y=1, color=0xffffffff, mode=:default); end
245
+
246
+ # center_x:: Relative horizontal position of the rotation center on the image. 0 is the left border, 1 is the right border, 0.5 is the center (and default)
247
+ # center_y:: See center_x.
248
+ def draw_rot(x, y, z, angle, center_x=0.5, center_y=0.5, factor_x=1, factor_y=1, color=0xffffffff, mode=:default); end
249
+
250
+ # Like Window#draw_quad, but with this texture instead of colors. Can be used to implement advanced, non-rectangular drawing techniques and takes four points and the modulation color at each of them.
251
+ # The points can be in clockwise order, or in a Z shape, starting at the top left.
252
+ def draw_as_quad(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z, mode=:default); end
253
+
254
+ # Creates an Image containing a line of text.
255
+ #
256
+ # The text is always rendered in white. If you want to draw it in a
257
+ # different color, just modulate it by the target color.
258
+ # font_name:: Name of a system font, or a filename to a TTF file (must contain '/').
259
+ # font_height:: Height of the font in pixels.
260
+ def self.from_text(window, text, font_name, font_height); end
261
+
262
+ # Creates an Image that is filled with the text given to the function.
263
+ #
264
+ # The text may contain line breaks.
265
+ #
266
+ # The text is always rendered in white. If you want to draw it in a
267
+ # different color, just modulate it by the target color.
268
+ # font_name:: Name of a system font, or a filename to a TTF file (must contain '/').
269
+ # font_height:: Height of the font in pixels.
270
+ # line_spacing:: Spacing between two lines of text in pixels.
271
+ # max_width:: Width of the bitmap that will be returned. Text will be split into multiple lines to avoid drawing over the right border. When a single word is too long, it will be truncated.
272
+ # align:: One of :left, :right, :center or :justify.
273
+ def self.from_text(window, text, font_name, font_height, line_spacing, max_width, align); end
274
+
275
+ # Convenience function that splits an image file into an array of small rectangles and
276
+ # creates images from these. Returns the Array containing Image instances.
277
+ #
278
+ # A color key of #ff00ff is automatically applied to BMP type images.
279
+ #
280
+ # tile_width:: If positive, specifies the width of one tile in pixels. If negative, the bitmap is divided into -tile_width rows.
281
+ # tile_height:: See tile_width.
282
+ def self.load_tiles(window, filename_or_rmagick_image, tile_width, tile_height, tileable); end
283
+
284
+ # See examples/OpenGLIntegration.rb.
285
+ def gl_tex_info; end
286
+
287
+ # Returns the associated texture contents as binary string of RGBA values.
288
+ # Useful for use with RMagick (Magick::Image.from_blob).
289
+ def to_blob; end
290
+
291
+ # Overwrites all or parts of the Image. x and y can be negative or otherwise out of
292
+ # bounds, the incoming image data is clipped to the current image size.
293
+ # This can be used to e.g. overwrite parts of a landscape.
294
+ def insert(filename_or_rmagick_image, x, y); end
295
+
296
+ # Saves the texture contents as an image file. Useful, for example, to
297
+ # pre-render text on a development machine with proper fonts installed.
298
+ # The file format is determined from the file extension. See the Gosu
299
+ # wiki for a list of portably supported formats.
300
+ def save(filename); end
301
+ end
302
+
303
+ # A sample is a short sound that is completely loaded in memory, can be
304
+ # played multiple times at once and offers very flexible playback
305
+ # parameters. Use samples for everything that's not music.
306
+ class Sample
307
+ def initialize(window, filename); end
308
+
309
+ # Plays the sample without panning.
310
+ #
311
+ # Returns a SampleInstance.
312
+ # volume:: Can be anything from 0.0 (silence) to 1.0 (full volume).
313
+ # speed:: Playback speed is only limited by the underlying audio library, and can accept very high or low values. Use 1.0 for normal playback speed.
314
+ def play(vol=1, speed=1, looping=false); end
315
+
316
+ # Plays the sample with panning. Even if pan is 0.0, the sample will
317
+ # not be as loud as if it were played by calling play() due to the
318
+ # way the panning works.
319
+ #
320
+ # Returns a SampleInstance.
321
+ # volume:: Can be anything from 0.0 (silence) to 1.0 (full volume).
322
+ # speed:: Playback speed is only limited by the underlying audio library, and can accept very high or low values. Use 1.0 for normal playback speed.
323
+ def play_pan(pan=0, vol=1, speed=1, looping=false); end
324
+ end
325
+
326
+ # An instance of a Sample playing. Can be used to stop sounds dynamically,
327
+ # or to check if they are finished.
328
+ # It is recommended that you throw away sample instances if possible,
329
+ # as they could accidentally refer to other sounds being played after
330
+ # a very long time has passed.
331
+ class SampleInstance
332
+ attr_writer :volume
333
+ attr_writer :speed
334
+ attr_writer :pan
335
+
336
+ # Stops this instance of a sound being played. Calling this twice, or too late, does not do any harm. You can nil out the reference to the instance afterwards as it will be useless.
337
+ def stop; end
338
+ # Pauses this instance to be resumed afterwards. It will still keep a channel filled while paused.
339
+ def pause; end
340
+ def paused?; end
341
+ def resume; end
342
+ def playing?; end
343
+ end
344
+
345
+ # Songs are less flexible than samples in that they can only be played
346
+ # one at a time and without panning or speed parameters.
347
+ class Song
348
+ # Returns the song currently being played or paused, or nil if
349
+ # no song has been played yet or the last song has finished
350
+ # playing.
351
+ def self.current_song; end
352
+
353
+ attr_accessor :volume
354
+
355
+ def initialize(window, filename); end
356
+
357
+ # Starts or resumes playback of the song. This will stop all other
358
+ # songs and set the current song to this object.
359
+ def play(looping=false); end
360
+
361
+ # Pauses playback of the song. It is not considered being played.
362
+ # current_song will stay the same.
363
+ def pause; end
364
+
365
+ # Returns true if the song is the current song, but in paused
366
+ # mode.
367
+ def paused?; end
368
+
369
+ # Stops playback of this song if it is currently played or paused.
370
+ # Afterwards, current_song will return 0.
371
+ def stop; end
372
+
373
+ # Returns true if the song is currently playing.
374
+ def playing?; end
375
+ end
376
+
377
+ # TextInput instances are invisible objects that build a text string from input,
378
+ # using the current operating system's keyboard layout.
379
+ #
380
+ # At its most basic form, you only need to create a new TextInput instance and
381
+ # pass it to your window via text_input=. Until you call this function again,
382
+ # passing nil, the TextInput object will build a text that can be accessed via
383
+ # TextInput#text.
384
+ #
385
+ # A TextInput object is purely abstract, though; drawing the input field is left
386
+ # to the user. As with most of Gosu, how this is handled is completely left open.
387
+ #
388
+ # TextInput only aims to provide enough code for your own GUIs to build upon.
389
+ class TextInput
390
+ attr_accessor :text
391
+ attr_accessor :caret_pos
392
+ attr_accessor :selection_start
393
+
394
+ # Overridable filter that is applied to all new text that is entered.
395
+ # Allows for context-sensitive filtering/extending/... of the text.
396
+ # The text will be inserted at caretPos afterwards.
397
+ def filter text_in
398
+ text_in
399
+ end
400
+ end
401
+
402
+ # Main class that serves as the foundation of a standard
403
+ # Gosu application. Manages initialization of all of Gosu's core components
404
+ # and provides timing functionality.
405
+ #
406
+ # Note that all coordinates, even the mouse position, are in client
407
+ # coordinates relative to the window. This means that the mouse position
408
+ # can be negative or larger than the window size.
409
+ #
410
+ # Note that you should really only use one instance of this class at the same time. This may or may not change later.
411
+ #
412
+ # Right now, having two or more windows and loading samples or songs on both of them will result in an exception.
413
+ class Window
414
+ attr_accessor :caption
415
+ attr_accessor :mouse_x
416
+ attr_accessor :mouse_y
417
+ attr_accessor :text_input
418
+ attr_reader :width, :height
419
+ attr_reader :fullscreen?
420
+ attr_reader :update_interval
421
+
422
+ # update_interval:: Interval in milliseconds between two calls
423
+ # to the update member function. The default means the game will run
424
+ # at 60 FPS, which is ideal on standard 60 Hz TFT screens.
425
+ def initialize(width, height, fullscreen, update_interval=16.666666); end
426
+
427
+ # Enters a modal loop where the Window is visible on screen and receives calls to draw, update etc.
428
+ def show; end
429
+
430
+ # Tells the window to end the current show loop as soon as possible.
431
+ def close; end
432
+
433
+ # Called every update_interval milliseconds while the window is being
434
+ # shown. Your application's main game logic goes here.
435
+ def update; end
436
+
437
+ # Called after every update and when the OS wants the window to
438
+ # repaint itself. Your application's rendering code goes here.
439
+ def draw; end
440
+
441
+ # Can be overriden to give the game a chance to say no to being redrawn.
442
+ # This is not a definitive answer. The operating system can still cause
443
+ # redraws for one reason or another.
444
+ #
445
+ # By default, the window is redrawn all the time (i.e. Window#needs_redraw?
446
+ # always returns true.)
447
+ def needs_redraw?; end
448
+
449
+ # Can be overriden to show the system cursor when necessary, e.g. in level
450
+ # editors or other situations where introducing a custom cursor is not
451
+ # desired.
452
+ def needs_cursor?; end
453
+
454
+ # Called before update when the user pressed a button while the
455
+ # window had the focus.
456
+ def button_down(id); end
457
+ # Same as buttonDown. Called then the user released a button.
458
+ def button_up(id); end
459
+
460
+ # Returns true if a button is currently pressed. Updated every tick.
461
+ def button_down?(id); end
462
+
463
+ # Draws a line from one point to another (last pixel exclusive).
464
+ # Note: OpenGL lines are not reliable at all and may have a missing pixel at the start
465
+ # or end point. Please only use this for debugging purposes. Otherwise, use a quad or
466
+ # image to simulate lines, or contribute a better draw_line to Gosu.
467
+ def draw_line(x1, y1, c1, x2, y2, c2, z=0, mode=:default); end
468
+
469
+ def draw_triangle(x1, y1, c1, x2, y2, c2, x3, y3, c3, z=0, mode=:default); end
470
+
471
+ # Draws a rectangle (two triangles) with given corners and corresponding
472
+ # colors.
473
+ # The points can be in clockwise order, or in a Z shape.
474
+ def draw_quad(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z=0, mode=:default); end
475
+
476
+ # Flushes all drawing operations to OpenGL so that Z-ordering can start anew. This
477
+ # is useful when drawing several parts of code on top of each other that use conflicting
478
+ # z positions.
479
+ def flush; end
480
+
481
+ # For custom OpenGL calls. Executes the given block in a clean OpenGL environment.
482
+ # Use the ruby-opengl gem to access OpenGL function (if you manage to get it to work).
483
+ # IF no z position is given, it will execute the given block immediately, otherwise,
484
+ # the code will be scheduled to be called between Gosu drawing operations.
485
+ #
486
+ # Note: You cannot call Gosu rendering functions within this block, and you can only
487
+ # call the gl function in the call tree of Window#draw.
488
+ #
489
+ # See examples/OpenGLIntegration.rb for an example.
490
+ def gl(z=nil, &custom_gl_code); end
491
+
492
+ # Limits the drawing area to a given rectangle while evaluating the code inside of the block.
493
+ def clip_to(x, y, w, h, &rendering_code); end
494
+
495
+ # Returns a Gosu::Image that containes everything rendered within the given block. It can be
496
+ # used to optimize rendering of many static images, e.g. the map. There are still several
497
+ # restrictions that you will be informed about via exceptions.
498
+ #
499
+ # The returned Gosu::Image will have the width and height you pass as arguments, regardless
500
+ # of how the area you draw on. It is important to pass accurate values if you plan on using
501
+ # Gosu::Image#draw_as_quad or Gosu::Image#draw_rot with the result later.
502
+ #
503
+ # @return [Gosu::Image]
504
+ def record(width, height, &rendering_code); end
505
+
506
+ # Rotates everything drawn in the block around (around_x, around_y).
507
+ def rotate(angle, around_x=0, around_y=0, &rendering_code); end
508
+
509
+ # Scales everything drawn in the block by a factor.
510
+ def scale(factor_x, factor_y=factor_x, &rendering_code); end
511
+
512
+ # Scales everything drawn in the block by a factor for each dimension.
513
+ def scale(factor_x, factor_y, around_x, around_y, &rendering_code); end
514
+
515
+ # Moves everything drawn in the block by an offset in each dimension.
516
+ def translate(x, y, &rendering_code); end
517
+
518
+ # Applies a free-form matrix rotation to everything drawn in the block.
519
+ def transform(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, &rendering_code); end
520
+
521
+ # Returns the character a button usually produces, or nil. To implement real text-input
522
+ # facilities, look at the TextInput class instead.
523
+ def self.button_id_to_char(id); end
524
+
525
+ # Returns the button that has to be pressed to produce the given character, or nil.
526
+ def self.char_to_button_id(char); end
527
+
528
+ # @deprecated Use Window#mouse_x= and Window#mouse_y= instead.
529
+ def set_mouse_position(x, y); end
530
+ end
531
+
532
+ # Contains information about the underlying OpenGL texture and the u/v space used for image data.
533
+ #
534
+ # Can be retrieved from some images to use them in OpenGL operations. nil will be returned instead by images that are too large for a single texture.)
535
+ #
536
+ # See examples/OpenGLIntegration.rb.
537
+ class GLTexInfo
538
+ attr_reader :tex_name, :left, :right, :top, :bottom
539
+ end
540
+
541
+ # Returns a random double between min (inclusive) and max (exclusive).
542
+ def random(min, max); end
543
+
544
+ # Returns the horizontal distance between the origin and the point to which you would get if you moved radius pixels in the direction specified by angle.
545
+ def offset_x(angle, dist); end
546
+
547
+ # Returns the vertical distance between the origin and the point to which you would get if you moved radius pixels in the direction specified by angle.
548
+ def offset_y(angle, dist); end
549
+
550
+ # Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards. Returns 0 if both points are equal.
551
+ def angle(x1, y1, x2, y2); end
552
+
553
+ # Returns the smallest angle that can be added to angle1 to get to angle2 (can be negative if counter-clockwise movement is shorter).
554
+ def angle_diff(angle1, angle2); end
555
+
556
+ # Returns the distance between two points.
557
+ def distance(x1, y1, x2, y2); end
558
+
559
+ # Incrementing, possibly wrapping millisecond timer.
560
+ def milliseconds(); end
561
+
562
+ # Returns the name of a neutral font that is available on the current
563
+ # platform.
564
+ def default_font_name(); end
565
+
566
+ # Returns the width, in pixels, of the user's primary screen.
567
+ def screen_width(); end
568
+
569
+ # Returns the height, in pixels, of the user's primary screen.
570
+ def screen_height(); end
571
+
572
+ # Returns the user's preferred language, at the moment of calling the function. Expect return
573
+ # values such as 'en_US', 'de_DE.UTF-8', 'ja', 'zh-Hans'. You can rely only on the first two letters
574
+ # being a common language abbreviation.
575
+ def language(); end
576
+ end
577
+
578
+ # Small additions to Numeric to make it easier to integrate Gosu with
579
+ # libraries that use radians, like Chipmunk.
580
+ class ::Numeric
581
+ # Returns <tt>self * 180.0 / Math::PI + 90</tt>.
582
+ # Translates between Gosu's angle system (where 0° is at the top) and
583
+ # radians (where 0 is at the right).
584
+ def radians_to_gosu(); end
585
+
586
+ # Returns <tt>(self - 90) * Math::PI / 180.0</tt>
587
+ # Translates between Gosu's angle system (where 0° is at the top) and
588
+ # radians (where 0 is at the right).
589
+ def gosu_to_radians(); end
590
+
591
+ # Scales a degree value to radians.
592
+ def degrees_to_radians(); end
593
+
594
+ # Scales a radian value to degrees.
595
+ def radians_to_degrees(); end
596
+ end
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gosu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 85
5
- prerelease:
6
- segments:
7
- - 0
8
- - 7
9
- - 43
10
- version: 0.7.43
4
+ version: 0.7.44
11
5
  platform: universal-darwin
12
6
  authors:
13
7
  - Julian Raschke
@@ -15,7 +9,8 @@ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
11
 
18
- date: 2012-03-20 00:00:00 Z
12
+ date: 2012-07-16 00:00:00 +08:00
13
+ default_executable:
19
14
  dependencies: []
20
15
 
21
16
  description: " 2D game development library.\n\n Gosu features easy to use and game-friendly interfaces to 2D graphics\n and text (accelerated by 3D hardware), sound samples and music as well as\n keyboard, mouse and gamepad/joystick input.\n\n Also includes demos for integration with RMagick, Chipmunk and OpenGL.\n"
@@ -89,8 +84,13 @@ files:
89
84
  - examples/media/Space.png
90
85
  - examples/media/Star.png
91
86
  - examples/media/Starfighter.bmp
87
+ - reference/gosu.rb
88
+ - reference/Drawing_with_Colors.rdoc
89
+ - reference/Order_of_Corners.rdoc
90
+ - reference/Tileability.rdoc
91
+ - reference/Z_Ordering.rdoc
92
92
  - lib/gosu.for_1_8.bundle
93
- - lib/gosu.for_1_9.bundle
93
+ has_rdoc: true
94
94
  homepage: http://www.libgosu.org/
95
95
  licenses: []
96
96
 
@@ -107,29 +107,21 @@ rdoc_options:
107
107
  require_paths:
108
108
  - lib
109
109
  required_ruby_version: !ruby/object:Gem::Requirement
110
- none: false
111
110
  requirements:
112
111
  - - ">="
113
112
  - !ruby/object:Gem::Version
114
- hash: 51
115
- segments:
116
- - 1
117
- - 8
118
- - 2
119
113
  version: 1.8.2
114
+ version:
120
115
  required_rubygems_version: !ruby/object:Gem::Requirement
121
- none: false
122
116
  requirements:
123
117
  - - ">="
124
118
  - !ruby/object:Gem::Version
125
- hash: 3
126
- segments:
127
- - 0
128
119
  version: "0"
120
+ version:
129
121
  requirements: []
130
122
 
131
123
  rubyforge_project:
132
- rubygems_version: 1.8.15
124
+ rubygems_version: 1.3.5
133
125
  signing_key:
134
126
  specification_version: 3
135
127
  summary: 2D game development library.
Binary file