From 374e416ab1928697018fd06291694569b713af64 Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 23 Jun 2015 17:14:34 +0800 Subject: [PATCH] [doc] Update links to point to gosu/gosu --- README.txt | 6 +- rdoc/gosu.rb | 560 +++++++++++++++++++++++++-------------------------- 2 files changed, 283 insertions(+), 283 deletions(-) diff --git a/README.txt b/README.txt index e7883a791..bf565bed6 100644 --- a/README.txt +++ b/README.txt @@ -5,11 +5,11 @@ links to all relevant information.  The actual source code, wiki, issue tracker etc. are all hosted on GitHub: - http://github.com/jlnr/gosu/ + http://github.com/gosu/gosu/  The best entry point into Gosu's documentation is the wiki home page: - http://github.com/jlnr/gosu/wiki + http://github.com/gosu/gosu/wiki  Try doing the tutorial there if you don't know how to start out. Or look at one of the games in the Gosu Users board. @@ -18,7 +18,7 @@ one of the games in the Gosu Users board. port and transmogrify all parts of it. The only license that may affect you by indirection is libogg's (BSD-style). If you release a Gosu game in any common binary form, you will need to mention use of libogg and libvorbis somewhere. - +  Complaints, questions, feedback? * Visit the boards, http://www.libgosu.org/ * try your luck in the chat, irc://irc.freenode.org/gosu diff --git a/rdoc/gosu.rb b/rdoc/gosu.rb index 310af3d03..7643ba8f9 100644 --- a/rdoc/gosu.rb +++ b/rdoc/gosu.rb @@ -25,11 +25,11 @@ module Gosu KbDelete = :implementation_defined KbDown = :implementation_defined KbEnd = :implementation_defined - + ## # This is the key on the numpad. KbEnter = :implementation_defined - + KbEscape = :implementation_defined KbF1 KbF2 KbF3 KbF4 KbF5 KbF6 KbF7 KbF8 KbF9 KbF10 KbF11 KbF12 = :implementation_defined KbHome = :implementation_defined @@ -45,11 +45,11 @@ module Gosu KbNumpadSubtract = :implementation_defined KbPageDown = :implementation_defined KbPageUp = :implementation_defined - + ## # This is the key above the right shift key. KbReturn = :implementation_defined - + KbRight = :implementation_defined KbRightAlt = :implementation_defined KbRightControl = :implementation_defined @@ -68,149 +68,149 @@ module Gosu KbComma = :implementation_defined KbPeriod = :implementation_defined KbSlash = :implementation_defined - + MsLeft = :implementation_defined MsMiddle = :implementation_defined MsRight = :implementation_defined MsWheelDown = :implementation_defined MsWheelUp = :implementation_defined MsOther0 MsOther1 MsOther2 MsOther3 MsOther4 MsOther5 MsOther6 MsOther7 = :implementation_defined - + GpButton0 GpButton1 GpButton2 GpButton3 GpButton4 GpButton5 GpButton6 GpButton7 GpButton8 GpButton9 GpButton10 GpButton11 GpButton12 GpButton13 GpButton14 GpButton15 = :implementation_defined GpDown = :implementation_defined GpLeft = :implementation_defined GpRight = :implementation_defined GpUp = :implementation_defined - + Gp0Button0 Gp0Button1 Gp0Button2 Gp0Button3 Gp0Button4 Gp0Button5 Gp0Button6 Gp0Button7 Gp0Button8 Gp0Button9 Gp0Button10 Gp0Button11 Gp0Button12 Gp0Button13 Gp0Button14 Gp0Button15 = :implementation_defined Gp0Down = :implementation_defined Gp0Left = :implementation_defined Gp0Right = :implementation_defined Gp0Up = :implementation_defined - + Gp1Button0 Gp1Button1 Gp1Button2 Gp1Button3 Gp1Button4 Gp1Button5 Gp1Button6 Gp1Button7 Gp1Button8 Gp1Button9 Gp1Button10 Gp1Button11 Gp1Button12 Gp1Button13 Gp1Button14 Gp1Button15 = :implementation_defined Gp1Down = :implementation_defined Gp1Left = :implementation_defined Gp1Right = :implementation_defined Gp1Up = :implementation_defined - + Gp2Button0 Gp2Button1 Gp2Button2 Gp2Button3 Gp2Button4 Gp2Button5 Gp2Button6 Gp2Button7 Gp2Button8 Gp2Button9 Gp2Button10 Gp2Button11 Gp2Button12 Gp2Button13 Gp2Button14 Gp2Button15 = :implementation_defined Gp2Down = :implementation_defined Gp2Left = :implementation_defined Gp2Right = :implementation_defined Gp2Up = :implementation_defined - + Gp3Button0 Gp3Button1 Gp3Button2 Gp3Button3 Gp3Button4 Gp3Button5 Gp3Button6 Gp3Button7 Gp3Button8 Gp3Button9 Gp3Button10 Gp3Button11 Gp3Button12 Gp3Button13 Gp3Button14 Gp3Button15 = :implementation_defined Gp3Down = :implementation_defined Gp3Left = :implementation_defined Gp3Right = :implementation_defined Gp3Up = :implementation_defined - + ## # Represents an ARGB color value with 8 bits for each channel. Colors can be used interchangeably with integer literals of the form 0xAARRGGBB in all Gosu APIs. class Color ## # @return [Fixnum] the color's alpha channel. attr_accessor :alpha - + ## # @return [Fixnum] the color's red channel. attr_accessor :red - + ## # @return [Fixnum] the color's green channel. attr_accessor :green - + ## # @return [Fixnum] the color's blue channel. attr_accessor :blue - + ## # @return [Fixnum] the color's hue in the range (0...360). attr_accessor :hue - + ## # @return [Float] the color's saturation in the range (0..1). attr_accessor :saturation - + ## # @return [Float] the color's value in the range (0..1). attr_accessor :value - + # @!group Creating colors. - + ## # @overload initialize(argb) # @param argb [Fixnum] an integer of the form 0xAARRGGBB. - # + # # @overload initialize(a, r, g, b) # @param a [Fixnum] the color's alpha channel in the range (0..255). # @param r [Fixnum] the color's red channel in the range (0..255). # @param g [Fixnum] the color's green channel in the range (0..255). # @param b [Fixnum] the color's blue channel in the range (0..255). - # + # # @see from_hsv # @see from_ahsv # @see rgba # @see argb def initialize(*args); end - + ## # @return (see #initialize) - # + # # @overload rgba(rgba) # @param argb [Fixnum] an integer of the form 0xRRGGBBAA. - # + # # @overload rgba(r, g, b, a) # @param r [Fixnum] the color's red channel in the range (0..255). # @param g [Fixnum] the color's green channel in the range (0..255). # @param b [Fixnum] the color's blue channel in the range (0..255). # @param a [Fixnum] the color's alpha channel in the range (0..255). - # + # # @see #initialize # @see argb def self.rgba(*args); end - + # This method is equivalent to calling `Color.new`, but the name makes the parameter order explicit. - # + # # @return (see #initialize) # @overload argb(argb) # @overload argb(a, r, g, b) - # + # # @see #initialize # @see rgba def self.argb(*args); end - + # Converts an HSV triplet to an opaque color. - # + # # @return [Color] a color corresponding to the HSV triplet. # @param h [Fixnum] the color's hue in the range (0..360). # @param s [Float] the color's saturation in the range (0..1). # @param v [Float] the color's value in the range (0..1). - # + # # @see from_ahsv def self.from_hsv(h, s, v); end - + # Converts an HSV triplet to a color with the alpha channel set to a given value. - # + # # @return (see from_hsv) # @param a [Fixnum] the color's opacity in the range (0..255). # @param (see from_hsv) - # + # # @see from_hsv def self.from_ahsv(a, h, s, v); end - + # @!endgroup - + # Returns a 32-bit representation of the color suitable for use with OpenGL calls. This color is stored in a fixed order in memory and its integer value may vary depending on your system's byte order. - # + # # @return [Fixnum] a 32-bit OpenGL color. def gl; end - + ## # @return [Color] a copy of the color. def dup; end - + NONE = Gosu::Color.argb(0x00_000000) BLACK = Gosu::Color.argb(0xff_000000) GRAY = Gosu::Color.argb(0xff_808080) @@ -223,7 +223,7 @@ def dup; end FUCHSIA = Gosu::Color.argb(0xff_ff00ff) CYAN = Gosu::Color.argb(0xff_00ffff) end - + ## # A Font can be used to draw text on a Window object very flexibly. # Fonts are ideal for small texts that change regularly. @@ -231,42 +231,42 @@ def dup; end class Font ## # The font's name. This may be the name of a system font or a filename. - # + # # @return [String] the font's name. attr_reader :name - + ## # @return [Fixnum] the font's height in pixels. attr_reader :height - + ## # Load a font from the system fonts or a file. - # + # # (Passing a Window reference is not necessary anymore, please use the first overload from now on.) - # + # # @param height [Fixnum] the height of the font, in pixels. # @param [Hash] options # @option options [String] :name the name of a system font, or a path to a TrueType Font (TTF) file. A path must contain at least one '/' character to distinguish it from a system font. - # + # # @overload initialize(height, options = {}) # @overload initialize(window, font_name, height) def initialize(height, options = {}); end - + ## # Overrides the image for a character. - # + # # @note For any given character, this method MUST NOT be called more than once, and MUST NOT be called if a string containing the character has already been drawn. - # + # # @return [void] # @param character [String] the character to replace. # @param image [Image] the image to use for the character. def []=(character, image); end - + # @!group Drawing text - + ## # Draws a single line of text with its top left corner at (x, y). - # + # # @return [void] # @param text [String] # @param x [Number] the X coordinate @@ -276,92 +276,92 @@ def []=(character, image); end # @param scale_y [Float] the vertical scaling factor. # @param color [Color, Fixnum] # @param mode [:default, :additive] the blending mode to use. - # + # # @see #draw_rel # @see Gosu::Image.from_text - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki def draw(text, x, y, z, scale_x=1, scale_y=1, color=0xff_ffffff, mode=:default); end - + ## # Draws a single line of text relative to (x, y). - # + # # The text is aligned to the drawing location according to the `rel_x` and `rel_y` parameters: a value of 0.0 corresponds to top and left, while 1.0 corresponds to bottom and right. A value of 0.5 naturally corresponds to the center of the text. - # + # # All real numbers are valid alignment values and will be interpolated (or extrapolated) accordingly. - # + # # @return [void] # @param rel_x [Float] the horizontal alignment. # @param rel_y [Float] the vertical alignment. # @param (see #draw) - # + # # @see #draw - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki def draw_rel(text, x, y, z, rel_x, rel_y, scale_x=1, scale_y=1, color=0xff_ffffff, mode=:default); end - + ## # @deprecated Use {#draw} in conjunction with {Gosu.rotate} instead. - # + # # @see #draw # @see Gosu::Window#rotate def draw_rot(text, x, y, z, angle, scale_x=1, scale_y=1, color=0xff_ffffff, mode=:default); end - + # @!endgroup - + ## # Returns the width of a single line of text, in pixels, if it were drawn. - # + # # @return [Fixnum] the width of the text, in pixels. # @param text [String] def text_width(text, scale_x=1); end end - + ## # Provides functionality for drawing rectangular images. class Image ## # @return [Fixnum] the image's width, in pixels. attr_reader :width - + ## # @return [Fixnum] the image's height, in pixels. attr_reader :height - + # @!group Creating and loading images - + ## # Loads an image from a file or an RMagick image. - # + # # (Passing a Window reference is not necessary anymore, please use the first overload from now on.) - # + # # @note For Windows Bitmap (BMP) images, magenta (FF00FF, often called "magic pink" in this context) is treated as a chroma key and all pixels of that color are automatically rendered fully transparent. - # + # # @param [String, Magick::Image] source the filename or RMagick image to load from. # @param [Hash] options # @option options [true, false] :tileable (false) if true, the Image will not have soft edges when scaled # @option options [Array] :rect ([0, 0, image_width, image_height]) the source rectangle in the image - # + # # @overload initialize(source, options = {}) # @overload initialize(window, source, tileable = false) # @overload initialize(window, source, tileable, left, top, width, height) - # + # # @see load_tiles # @see from_text - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#tileability Tileability explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#tileability Tileability explained in the Gosu Wiki def initialize(source, options = {}); end - + ## # Creates a reusable image from one or more lines of text. # # (Passing a Window reference is not necessary anymore, please use the first overload from now on.) - # + # # @note The text is always rendered in white. To draw it in a different color, use the color parameter of {#draw}, et al. - # + # # @overload from_text(text, line_height, options = {}) # @overload from_text(window, text, font_name, line_height) # @overload from_text(window, text, font_name, line_height, line_spacing, width, align) - # + # # @return [Gosu::Image] # @param [String] text # @param [Fixnum] line_height the line height, in pixels. @@ -370,14 +370,14 @@ def initialize(source, options = {}); end # @option options [Fixnum] :width the width of the image, in pixels. Long lines will be automatically wrapped around to avoid overflow, but overlong words will be truncated. If this option is omitted, lines will not be wrapped, and :align and :spacing will be ignored as well. # @option options [Fixnum] :spacing (0) the spacing between lines, in pixels. # @option options [:left, :right, :center, :justify] :align (:left) the text alignment. - # + # # @see Gosu::Font - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki def self.from_text(text, line_height, options = {}); end - + ## # Loads an image from a file or an RMagick image, then divides the image into an array of equal-sized tiles. - # + # # @note For Windows Bitmap (BMP) images, magenta (FF00FF, often called "magic pink" in this context) is treated as a chroma key and all pixels of that color are automatically rendered fully transparent. # # @return [Array] @@ -386,22 +386,22 @@ def self.from_text(text, line_height, options = {}); end # @param tile_height [Fixnum] If positive, this is the height of the individual tiles; if negative, the image is divided into -tile_height rows. # @param [Hash] options # @option options [true, false] :tileable (false) if true, the Image will not have soft edges when scaled - # + # # @overload initialize(source, tile_width, tile_height, options = {}) # @overload initialize(window, source, tile_width, tile_height, tileable = false) - # + # # (Passing a Window reference is not necessary anymore, please use the first overload from now on.) - # - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#tileability Tileability explained in the Gosu Wiki + # + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#tileability Tileability explained in the Gosu Wiki def self.load_tiles(source, tile_width, tile_height, options = {}); end - + # @!endgroup - + # @!group Drawing an image - + ## # Draws the image with its top left corner at (x, y). - # + # # @return [void] # @param x [Float] the X coordinate. # @param y [Float] the X coordinate. @@ -410,257 +410,257 @@ def self.load_tiles(source, tile_width, tile_height, options = {}); end # @param scale_y [Float] the vertical scaling factor. # @param color [Gosu::Color, Integer] # @param mode [:default, :additive] the blending mode to use. - # + # # @see #draw_rot # @see #draw_as_quad - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki def draw(x, y, z, scale_x=1, scale_y=1, color=0xff_ffffff, mode=:default); end - + ## # Draws the image rotated, with its rotational center at (x, y). - # + # # @return [void] # @param angle [Float] # @param center_x [Float] the relative horizontal rotation origin. # @param center_y [Float] the relative vertical rotation origin. # @param (see #draw) - # + # # @see #draw - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki def draw_rot(x, y, z, angle, center_x=0.5, center_y=0.5, scale_x=1, scale_y=1, color=0xff_ffffff, mode=:default); end - + ## # Draws the image as an arbitrary quad. This method can be used for advanced non-rectangular drawing techniques, e.g., faking perspective or isometric projection. - # + # # @return [void] # @param (see Gosu.draw_quad) - # + # # @see #draw # @see Gosu.draw_quad - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#order-of-corners The order of corners explained in the Gosu Wiki - # @see https://github.com/jlnr/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#drawing-with-colours Drawing with colors, explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#order-of-corners The order of corners explained in the Gosu Wiki + # @see https://github.com/gosu/gosu/wiki/Basic-Concepts#z-ordering Z-ordering explained in the Gosu Wiki def draw_as_quad(x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z, mode=:default); end - + # @!endgroup - + ## # Returns an object that holds information about the underlying OpenGL texture and UV coordinates of the image. - # + # # @note Some images may be too large to fit on a single texture; this method returns nil in those cases. - # + # # @return [Gosu::GLTexInfo?] information about the underlying OpenGL texture. - # + # # @see Gosu::GLTexInfo # @see file:examples/OpenGLIntegration.rb def gl_tex_info; end - + ## # Returns the associated texture contents as binary string of packed RGBA values, useful for use with RMagick (Magick::Image.from_blob). - # + # # @return [String] a binary string of packed RGBA values. def to_blob; end - + ## # Overwrites part of the image with the contents of another. If the source image is partially out of bounds, it will be clipped to fit. - # + # # This can be used to e.g. overwrite parts of a landscape. - # + # # @return [void] # @param source [String, Magick::Image] the filename or RMagick image to load from. # @param x [Fixnum] the X coordinate of the top left corner. # @param y [Fixnum] the Y coordinate of the top left corner. def insert(source, x, y); end - + ## # Saves the image to a file. The file format is determined from the file extension. - # + # # Useful for, e.g., pre-rendering text on a development machine where the necessary fonts are known to be available. - # + # # @return [void] # @param filename [String] the path to save the file under. def save(filename); end end - + ## # A sample is a short sound that is completely loaded in memory, can be # played multiple times at once and offers very flexible playback # parameters. Use samples for everything that's not music. - # + # # @see Gosu::Song class Sample ## # Loads a sample from a file. - # + # # (Passing a Window reference is not necessary anymore, please use the first overload from now on.) - # + # # @overload initialize(filename) # @overload initialize(window, filename) # # @param filename [String] the path to load the sample from. def initialize(filename); end - + ## # Plays the sample without panning. - # + # # Playback speed is limited only by the underlying audio library, and both very large and very small values should work just fine. # # @return [SampleInstance] # @param volume [Float] the playback volume, in the range (0..1), where 0 is completely silent and 1 is full volume. # @param speed [Float] the playback speed. # @param looping [true, false] whether the sample should play in a loop. - # + # # @see #play_pan def play(volume=1, speed=1, looping=false); end - + ## # Plays the sample with panning. - # + # # @note Samples played with this method will not be as loud as those played with {#play}, even if `pan` is 0. This is due to a limitation in the way panning works. # # @return [SampleInstance] # @param pan [Float] the amount of panning. 0 is centered. # @param (see #play) - # + # # @see #play def play_pan(pan=0, volume=1, speed=1, looping=false); end end - + ## # An instance of a {Gosu::Sample} playing. Can be used to stop sounds dynamically, or to check if they are finished. - # + # # It is recommended to throw away sample instances as soon as possible, as holding onto them for a long time can prevent unneeded samples being properly disposed. class SampleInstance attr_writer :volume attr_writer :speed attr_writer :pan - + ## # Stops playback of this sample instance. After calling this method, the sample instance is useless and can be discarded. - # + # # Calling `stop` after the sample has finished is harmless and has no effect. - # + # # @return [void] def stop; end - + ## # Pauses the sample, to be resumed afterwards. - # + # # @note The sample will still occupy a playback channel while paused. - # + # # @return [void] def pause; end - + ## # Resumes playback of the sample. - # + # # @return [void] def resume; end - + ## # @return [true, false] whether the sample is paused. def paused?; end - + ## # @return [true, false] whether the sample is playing. def playing?; end end - + ## # Songs are less flexible than samples in that only one can be played at a time, with no panning or speed control. - # + # # @see Gosu::Sample class Song class <self * 180.0 / Math::PI + 90. - # + # # @return [Float] degrees. def radians_to_gosu(); end ## # Converts a Gosu-compatible angle to radians using the formula (self - 90) * Math::PI / 180.0. - # + # # @return [Float] radians. def gosu_to_radians(); end - + ## # Converts degrees to radians. - # + # # @return [Float] radians. def degrees_to_radians(); end - + ## # Converts radians to degrees. - # + # # @return [Float] degrees. def radians_to_degrees(); end end