Added the trunk/branches/tags directories at repository root, and moved previous root into trunk/
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1002 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
commit
2f524481c1
974 changed files with 295448 additions and 0 deletions
431
ruby/doc/Reference-en.html
Normal file
431
ruby/doc/Reference-en.html
Normal file
|
@ -0,0 +1,431 @@
|
|||
<html>
|
||||
<title>RubySFML Documentation</title>
|
||||
<style type="text/css">
|
||||
h4,h5,ul {margin: 5px}
|
||||
pre {background: #F0F0F0}
|
||||
.comment {color: #8080FF}
|
||||
.text {color: green}
|
||||
.keyword {color: purple}
|
||||
</style>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Introduction</h1>
|
||||
<p>I apologize for how limited this documentation is, but as this extension is primarily a simple wrapper around SFML's C++ classes, I will rely on SFML's documentation to explain more detail about the classes and methods. This documentation is simply meant to explain which classes and methods are available in Ruby, as well as what changes have been made during the translation from C++ to Ruby.</p>
|
||||
<p>As Ruby doesn't support native threading and has its own networking classes, I only exposed certain classes in the system, window, graphics, and audio libraries. For most exposed classes, the only changes I made were to make the methods start with a lower-case letter. For classes with simple Get/Set methods, I often drop the Get and Set to allow you to use sprite.left and sprite.left=. I also added a few to_i, to_f, and to_s methods where it seemed appropriate. Last but not least, I added an each iterator to VideoMode.</p>
|
||||
<p>In addition to the C++ classes I exposed, I also added two helper classes in RubySFML.rb, one for rendering tiled sprites, and the other for dealing with sprites that use 2D velocity/accelerate calculations (TSprite and VSprite respectively).</p>
|
||||
<h3>Tips for Windows Users</h3>
|
||||
<p>For the Windows users out there, I apologize for not being compatible with the one-click installer, but it's being built with Visual Studio 6.0, which is ridiculously old and not compatible with any of the SFML libraries. There's a free version of Visual Studio 2005 available, and the Ruby source compiles very smoothly with it, so I can't think of a good excuse for the one-click installer to still be using 6.0.</p>
|
||||
<p>On the bright side, you can distribute your game in a self-sufficient package by zipping it up with the bin and lib folders that come with the Windows binary version of this extension. Add a simple installer that creates a program group icon that runs "%install_path%\bin\ruby.exe %install_path%\my_game.rb", and you're all set. Oh yeah, OpenAL needs to be installed on any machine running this. Fortunately it is a very small/simple install, and it should be easy for you to either bundle it with your distribution or provide a link for your users to download it. All of this keeps your users from having to download/run the one-click installer, install all the necessary extensions, worry about compatibility issues, etc. It is likely that very few Windows users will ever play your game if you don't provide them everything they need to run it, so it's probably better this way.</p>
|
||||
<p><b>Note:</b> This custom build of Ruby does have gems and zlib (which is required by gems), but no other extensions are installed. Feel free to install any other gems/extensions you need (native mswin32 gems compiled with Visual Studio 6.0 may not work). Keep in mind that many gems often have large doc, examples, and test folders. Deleting these unnecessary folders, along with the gem cache folder, can significantly shrink the size of the file you're distributing.</p>
|
||||
|
||||
<h3>RubySFML Sample Code</h3>
|
||||
<pre>
|
||||
<span class="comment"># Include the RubySFML extension</span>
|
||||
<span class="keyword">require</span> "<span class="text">RubySFML</span>"
|
||||
<span class="keyword">include</span> SFML
|
||||
|
||||
<span class="comment"># Create the main window</span>
|
||||
mode = VideoMode.new 800, 600, 32
|
||||
window = RenderWindow.new mode, "<span class="text">RubySFML Test</span>", false
|
||||
|
||||
<span class="comment"># Load a sprite to display</span>
|
||||
image = Image.new "<span class="text">cute_image.jpg</span>"
|
||||
sprite = Sprite.new image
|
||||
|
||||
<span class="comment"># Create a graphical string to display</span>
|
||||
text = Text.new "<span class="text">Hello SFML</span>", "<span class="text">arial.ttf</span>", 50
|
||||
|
||||
<span class="comment"># Load a music and start playing it</span>
|
||||
music = Music.new "<span class="text">nice_music.ogg</span>"
|
||||
music.play
|
||||
|
||||
<span class="comment"># Start the game loop</span>
|
||||
running = true
|
||||
<span class="keyword">while</span> running
|
||||
<span class="keyword">while</span> event = window.getEvent
|
||||
running = false <span class="keyword">if</span> event.type == Event::Close
|
||||
<span class="keyword">end</span>
|
||||
|
||||
<span class="comment"># Draw the sprite, then the text, and update the window</span>
|
||||
window.draw sprite
|
||||
window.draw text
|
||||
window.display
|
||||
<span class="keyword">end</span>
|
||||
</pre>
|
||||
|
||||
<h3>RubySFML Modules</h3>
|
||||
<ul>
|
||||
<li><b><a href="#global">SFML</a</b> - Contains all SFML classes, modules, and global methods.</li>
|
||||
<li><b>SFML::Event</b> - Contains constants for all of the SFML enumerated event types.</li>
|
||||
<li><b>SFML::Key</b> - Contains constants for all of the SFML enumerated key codes.</li>
|
||||
<li><b>SFML::Mouse</b> - Contains constants for all of the SFML enumerated mouse button codes.</li>
|
||||
</ul>
|
||||
|
||||
<h3>RubySFML Classes</h3>
|
||||
<ul>
|
||||
<li><a href="#clock">SFML::Clock</a> - A system clock using high-performance timers where available</li>
|
||||
<li><a href="#color">SFML::Color</a> - A simple RGBA color class</li>
|
||||
<li><a href="#drawable">SFML::Drawable</a> - A pure virtual class representing 2D objects to use with RenderWindow</li>
|
||||
<li><a href="#event">SFML::Event</a> - A class representing various system events (like keyboard and mouse events)</li>
|
||||
<li><a href="#floatrect">SFML::FloatRect</a> - A simple rectangle made of 4 floats</li>
|
||||
<li><a href="#image">SFML::Image</a> - A class for managing image files and textures</li>
|
||||
<li><a href="#input">SFML::Input</a> - A class for checking the current state of various input devices</li>
|
||||
<li><a href="#intrect">SFML::IntRect</a> - A simple rectangle made of 4 ints</li>
|
||||
<li><a href="#music">SFML::Music</a> - A class for playing streaming music files</li>
|
||||
<li><a href="#postfx">SFML::PostFX</a> - A class for mananging post-rendering shaders</li>
|
||||
<li><a href="#renderwindow">SFML::RenderWindow</a> - A sub-class of Window which makes it easy to draw 2D sprites and text</li>
|
||||
<li><a href="#sound">SFML::Sound</a> - A class for playing sound clips</li>
|
||||
<li><a href="#soundbuffer">SFML::SoundBuffer</a> - A class for managing sound clips and sound files</li>
|
||||
<li><a href="#soundbufferrecorder">SFML::SoundBufferRecorder</a> - A class for recording sound from a capture device, like a microphone</li>
|
||||
<li><a href="#sprite">SFML::Sprite</a> - A class for managing/drawing 2D sprites</li>
|
||||
<li><a href="#text">SFML::Text</a> - A class for managing/drawing 2D text (using ttf fonts)</li>
|
||||
<li><a href="#videomode">SFML::VideoMode</a> - A class for managing video modes and window sizes</li>
|
||||
<li><a href="#view">SFML::View</a> - A class for managing the 2D camera in RenderWindow</li>
|
||||
<li><a href="#window">SFML::Window</a> - A class for creating/managing a suitable window for custom OpenGL rendering (also handles all input and events)</li>
|
||||
</ul>
|
||||
|
||||
<h3>RubySFML Methods (by module/class)</h3>
|
||||
<hr/>
|
||||
<h4><a name="global">SFML</a></h4>
|
||||
<ul>
|
||||
<li><b>checkExtension(str)</b> - Returns true if the specifed OpenGL extension is supported.</li>
|
||||
<li><b>getMaxTextureSize</b> - Returns the max texture size for the current display hardware.</li>
|
||||
<li><b>getMaxTextureUnits</b> - Returns the max number of texture units for the current display hardware.</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="clock">SFML::Clock</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Default constructor</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>reset</b> - Resets the clock</li>
|
||||
<li><b>elapsedTime,to_f</b> - Returns the elapsed time since the last reset</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="color">SFML::Color</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Default constructor</li>
|
||||
<li><b>initialize(n)</b> - Builds the color from a 32-bit unsigned RGBA value (0x12345678 is r=0x78, g=0x56, b=0x34, a=0x12)</li>
|
||||
<li><b>initialize(r, g, b, a=255)</b> - Builds the color from its separate components</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>r, g, b, a</b> - Returns the r, g, b, and a values (respectively)</li>
|
||||
<li><b>r=, g=, b=, a=</b> - Sets the r, g, b, and a values (respectively)</li>
|
||||
<li><b>toRGBA</b> - Returns the 4 components as a 32-bit unsigned value (0x12345678 is r=0x78, g=0x56, b=0x34, a=0x12)</li>
|
||||
<li><b>to_i</b> - Alias for toRGBA</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="drawable">SFML::Drawable</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize(left=0, top=0, scale=1, rotation=0, color=Color.White)</b> - Initializes various members (scale can be a number or an array of two numbers)</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>left, left=</b> - Gets/sets the left x position</li>
|
||||
<li><b>top, top=</b> - Gets/sets the top y position</li>
|
||||
<li><b>scale, scale=</b> - Gets/sets the scale of this object (get returns an array, set takes a num or an array</li>
|
||||
<li><b>color, color=</b> - Gets/sets the base color of this object</li>
|
||||
<li><b>rotation, rotation=</b> - Gets/sets the angle of rotation (in degrees)</li>
|
||||
<li><b>upVector</b> - Gets this object's up vector (based on its angle of rotation)</li>
|
||||
<li><b>rightVector</b> - Gets this object's right vector (based on its angle of rotation)</li>
|
||||
<li><b>setRotationCenter(x, y)</b> - Sets the center of rotation for this object</li>
|
||||
<li><b>move(x, y)</b> - Adds an offset to the left and top members</li>
|
||||
<li><b>rotate(a)</b> - Adds an offset to the rotation member</li>
|
||||
<li><b>render(window)</b> - (virtual) Override to add custom rendering code</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="event">SFML::Event</a></h4>
|
||||
<h5>For all event types</h5>
|
||||
<ul>
|
||||
<li><b>initialize</b> - Takes no parameters</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>type</b> - Returns the event type</li>
|
||||
</ul>
|
||||
<h5>For the Event::TextEntered event type</h5>
|
||||
<ul>
|
||||
<li><b>char</b> - Returns the character typed (only for Event::TextEntered events)</li>
|
||||
</ul>
|
||||
<h5>For Event::KeyPressed and Event::KeyReleased event types</h5>
|
||||
<ul>
|
||||
<li><b>code</b> - Returns the character code (only for Event::KeyPressed and Event::KeyReleased events)</li>
|
||||
<li><b>alt</b> - Returns true if an Alt key is down (only for Event::KeyPressed and Event::KeyReleased events)</li>
|
||||
<li><b>control</b> - Returns true if a Ctrl key is down (only for Event::KeyPressed and Event::KeyReleased events)</li>
|
||||
<li><b>shift</b> - Returns true if a Shift key is down (only for Event::KeyPressed and Event::KeyReleased events)</li>
|
||||
</ul>
|
||||
<h5>For mouse and joystick event types</h5>
|
||||
<ul>
|
||||
<li><b>delta</b> - Returns the scroll wheel offset (only for Event::MouseWheelMoved events)</li>
|
||||
<li><b>buttons</b> - Returns the state of the mouse buttons (only for mouse events)</li>
|
||||
<li><b>button</b> - Returns the state of the joystick buttons (only for joystick events)</li>
|
||||
<li><b>x</b> - Returns the x position (for mouse and joystick events)</li>
|
||||
<li><b>y</b> - Returns the y position (for mouse and joystick events)</li>
|
||||
<li><b>z</b> - Returns the z position (for joystick events)</li>
|
||||
</ul>
|
||||
<h5>For the Event::Resize event type</h5>
|
||||
<ul>
|
||||
<li><b>width</b> - Returns the new window width (only for Event::Resize events)</li>
|
||||
<li><b>height</b> - Returns the new window height (only for Event::Resize events)</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="floatrect">SFML::FloatRect</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Default constructor</li>
|
||||
<li><b>initialize(left, top, right, bottom)</b> - Initialize the rectangle's members</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>left, l</b> - Gets the left x position</li>
|
||||
<li><b>left=, l=</b> - Sets the left x position</li>
|
||||
<li><b>top, t</b> - Gets the top y position</li>
|
||||
<li><b>top=, t=</b> - Sets the top y position</li>
|
||||
<li><b>right, r</b> - Gets the right x position</li>
|
||||
<li><b>right=, r=</b> - Sets the right x position</li>
|
||||
<li><b>bottom, b</b> - Gets the bottom y position</li>
|
||||
<li><b>bottom=, b=</b> - Sets the bottom y position</li>
|
||||
<li><b>width, w</b> - Gets the rectangle width</li>
|
||||
<li><b>height, h</b> - Gets the rectangle height</li>
|
||||
<li><b>contains(x, y)</b> - Returns true if the x, y position is inside the rectangle</li>
|
||||
<li><b>intersects(rect)</b> - Returns the intersection of two rectangles (nil if there is no intersection)</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="image">SFML::Image</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize</b> - Creates an empty image</li>
|
||||
<li><b>initialize(image)</b> - Creates a copy of an image</li>
|
||||
<li><b>initialize(path)</b> - Loads an image file using the specified path (raises a RuntimeError on failure)</li>
|
||||
<li><b>initialize(w, h, c=Color.Black)</b> - Creates a blank image using the specified width, height, and color</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>getValidTextureSize(s)</b> - (static) Returns the valid nearest texture size >= s</li>
|
||||
<li><b>width, w</b> - Gets the image width</li>
|
||||
<li><b>height, h</b> - Gets the image height</li>
|
||||
<li><b>smooth=, setSmooth(bool)</b> - Sets the OpenGL texture parameter to linear interpolation for true or nearest for false</li>
|
||||
<li><b>repeat=, setRepeat(bool)</b> - Sets the OpenGL texture parameter to repeat for true or clip for false</li>
|
||||
<li><b>loadFromFile(path)</b> - Loads a file image using the specified path</li>
|
||||
<li><b>saveToFile(path)</b> - Saves the image to a file using the specified path</li>
|
||||
<li><b>create(w, h, c=Color.Black)</b> - Creates an empty image with the specified width, height, and color</li>
|
||||
<li><b>createMaskFromColor(color, a=0)</b> - Scans the image for pixels of the specified color, and sets the alpha value of those pixels to a.</li>
|
||||
<li><b>resize(w, h, c=Color.Black)</b> - Resizes the image. If the image grows, sets new pixels to the specified color.</li>
|
||||
<li><b>getPixel(x, y), [x,y]</b> - Returns the color of the specified pixel.</li>
|
||||
<li><b>setPixel(x, y, c), [x,y]=</b> - Sets the color of the specified pixel to c.</li>
|
||||
<li><b>update</b> - Updates the image in video memory (call after manually setting pixels).</li>
|
||||
<li><b>bind</b> - Bind the image for rendering (call if you're using this image with raw OpenGL calls).</li>
|
||||
<li><b>getTexCoords(rect)</b> - Converts an IntRect representing pixel positions to a FloatRect representing texture coordinates.</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="input">SFML::Input</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize</b> - Default constructor</li>
|
||||
<li><b>isKeyDown(key)</b> - Returns true if the specified key is down</li>
|
||||
<li><b>isMouseButtonDown(button)</b> - Returns true if the specified mouse button is down</li>
|
||||
<li><b>isJoystickButtonDown(n, button)</b> - Returns true if the specified button on joystick n is down</li>
|
||||
<li><b>getMouseX</b> - Returns the current x position of the mouse</li>
|
||||
<li><b>getMouseY</b> - Returns the current y position of the mouse</li>
|
||||
<li><b>getJoystickX(n)</b> - Returns the current x position of joystick n</li>
|
||||
<li><b>getJoystickY(n)</b> - Returns the current y position of joystick n</li>
|
||||
<li><b>getJoystickZ(n)</b> - Returns the current z position of joystick n</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="intrect">SFML::IntRect</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Default constructor</li>
|
||||
<li><b>initialize(left, top, right, bottom)</b> - Initialize the rectangle's members</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>left, l</b> - Gets the left x position</li>
|
||||
<li><b>left=, l=</b> - Sets the left x position</li>
|
||||
<li><b>top, t</b> - Gets the top y position</li>
|
||||
<li><b>top=, t=</b> - Sets the top y position</li>
|
||||
<li><b>right, r</b> - Gets the right x position</li>
|
||||
<li><b>right=, r=</b> - Sets the right x position</li>
|
||||
<li><b>bottom, b</b> - Gets the bottom y position</li>
|
||||
<li><b>bottom=, b=</b> - Sets the bottom y position</li>
|
||||
<li><b>width, w</b> - Gets the rectangle width</li>
|
||||
<li><b>height, h</b> - Gets the rectangle height</li>
|
||||
<li><b>contains(x, y)</b> - Returns true if the x, y position is inside the rectangle</li>
|
||||
<li><b>intersects(rect)</b> - Returns the intersection of two rectangles (nil if there is no intersection)</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="music">SFML::Music</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize(bufSize=44100)</b> - Allows you to specify the buffer size.</li>
|
||||
<li><b>initialize(path)</b> - Opens a music file using the specified path (raises a RuntimeError on failure).</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>loop, loop=</b> - Gets/sets a boolean indicating whether the music should loop back to the beginning when it's finished playing.</li>
|
||||
<li><b>duration</b> - Gets the duration of the sound stream.</li>
|
||||
<li><b>channels</b> - Gets the number of channels in the sound stream (1=mono, 2=stereo).</li>
|
||||
<li><b>sampleRate</b> - Gets the sample rate of the sound stream (44100 = CD quality).</li>
|
||||
<li><b>status</b> - Gets the status of the music object (Sound::Stopped, Sound::Paused, Sound::Playing).</li>
|
||||
<li><b>open(path)</b> - Opens a music file using the specified path (returns false on failure).</li>
|
||||
<li><b>play</b> - Start the music.</li>
|
||||
<li><b>stop</b> - Stop the music.</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="postfx">SFML::PostFX</a></h4>
|
||||
<ul>
|
||||
<li>(Inherits all methods from <a href="#drawable">SFML::Drawable</a>)</li>
|
||||
<li><b>initialize()</b> - Default constructor</li>
|
||||
<li><b>initialize(path)</b> - Loads an effect file using the specified path.</li>
|
||||
<li><b>initialize(postFX)</b> - Makes a copy of a PostFX object.</li>
|
||||
<li><b>loadFromFile(path)</b> - Loads an effect file using the specified path (returns false on failure).</li>
|
||||
<li><b>setParameter(name, x, y=nil, z=nil, w=nil)</b> - Sets the named parameter to an array of 1, 2, 3, or 4 floats.</li>
|
||||
<li><b>setTexture(name, image)</b> - Sets a named texture parameter.</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="renderwindow">SFML::RenderWindow</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize(mode, title, style=Window::Resizable, antialias=0)</b> - Creates a 2D render window using the specified VideoMode, title, and style</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>width, w</b> - Gets the width of the window</li>
|
||||
<li><b>height, h</b> - Gets the height of the window</li>
|
||||
<li><b>input</b> - Gets the <a href="#input">SFML::Input</a> object for this window</li>
|
||||
<li><b>frameTime</b> - Gets the amount of time it took to render the previous frame</li>
|
||||
<li><b>stencilBits</b> - Gets the number of bits used in the stencil buffer</li>
|
||||
<li><b>depthBits</b> - Gets the number of bits used in the back buffer</li>
|
||||
<li><b>view, view=</b> - Gets/sets the <a href="#view">SFML::View</a> into the 2D world (2D camera position)</li>
|
||||
<li><b>backgroundColor=</b> - Sets the background color for the whole window</li>
|
||||
<li><b>getEvent</b> - Returns the next event in the window's event queue (or nil if the queue is empty)</li>
|
||||
<li><b>useVerticalSync(bool)</b> - Use to enable/disable vsync</li>
|
||||
<li><b>showMouseCursor(bool)</b> - Use to show/hide the operating system's mouse cursor</li>
|
||||
<li><b>display</b> - Call to swap the front and back buffers to display the frame</li>
|
||||
<li><b>beginOpenGL</b> - Call to save the OpenGL state before you call raw OpenGL methods</li>
|
||||
<li><b>endOpenGL</b> - Call to restore the OpenGL state after you call raw OpenGL methods</li>
|
||||
<li><b>capture</b> - Take a screenshot and return it as an image</li>
|
||||
<li><b>draw(obj)</b> - Call to draw any object derived from <a href="#drawable">SFML::Drawable</a></li>
|
||||
<li><b>setFramerateLimit</b> - Set a fixed framerate (use 0 to disable it)</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="sound">SFML::Sound</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize(sound)</b> - Creates a copy of a Sound object</li>
|
||||
<li><b>initialize(buffer=nil, loop=false, pitch=1, volume=100, x=0, y=0, z=0)</b> - Creates a Sound object using the specified sound buffer and other parameters</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>buffer, buffer=</b> - Gets/sets this sound object's <a href="#soundbuffer">SFML::SoundBuffer</a>.</li>
|
||||
<li><b>loop, loop=</b> - Gets/sets the loop flag for this sound object.</li>
|
||||
<li><b>pitch, pitch=</b> - Gets/sets the pitch for this sound object.</li>
|
||||
<li><b>volume, volume=</b> - Gets/sets the volume for this sound object.</li>
|
||||
<li><b>position, position=</b> - Gets/sets the position for this sound object (using an array of 3 numbers).</li>
|
||||
<li><b>status</b> - Gets the status of this sound object (Sound::Stopped, Sound::Paused, Sound::Playing).</li>
|
||||
<li><b>playingOffset</b> - Gets the current playing position of the sound (in seconds).</li>
|
||||
<li><b>play</b> - Starts playing the sound.</li>
|
||||
<li><b>pause</b> - Pauses the sound.</li>
|
||||
<li><b>stop</b> - Stops playing the sound.</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="soundbuffer">SFML::SoundBuffer</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Default constructor</li>
|
||||
<li><b>initialize(soundBuffer)</b> - Creates a copy of a SoundBuffer object.</li>
|
||||
<li><b>initialize(path)</b> - Loads a sound file using the specified path (raises a RuntimeError on failure).</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>samples</b> - Gets the raw (binary) samples as a Ruby string.</li>
|
||||
<li><b>samplesCount</b> - Gets the total number of samples (shorts) returned by the samples call.</li>
|
||||
<li><b>samplesRate</b> - Gets the sample rate (or number of samples per second for each channel).</li>
|
||||
<li><b>channels</b> - Gets the number of channels (1=mono, 2=stereo).</li>
|
||||
<li><b>duration</b> - Gets the duration of the sound buffer (in seconds).</li>
|
||||
<li><b>loadFromFile(path)</b> - Loads a sound file using the specified path (returns false on failure).</li>
|
||||
<li><b>saveToFile(path)</b> - Saves a sound file to the specified path (returns false on failure).</li>
|
||||
<li><b>loadFromMemory(samples, samplesCount, channels, sampleRate)</b> - Builds a SoundBuffer from raw (binary) samples.</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="soundbufferrecorder">SFML::SoundBufferRecorder</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Default constructor</li>
|
||||
<li><b>canCapture</b> - (static) Returns true if the current system is capable of sound capture</li>
|
||||
<li><b>start(sampleRate=44100)</b> - Starts the sound capture</li>
|
||||
<li><b>stop</b> - Stops the sound capture</li>
|
||||
<li><b>buffer</b> - Gets the SoundBuffer object containing the captured audio</li>
|
||||
<li><b>sampleRate</b> - Gets the current sample rate</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="sprite">SFML::Sprite</a></h4>
|
||||
<ul>
|
||||
<li>(Inherits all methods from <a href="#drawable">SFML::Drawable</a>)</li>
|
||||
<li><b>initialize()</b> - Default constructor</li>
|
||||
<li><b>initialize(image, left=0, top=0, scale=1, rotation=0, c=Color.White)</b> - Builds a Sprite object with the specified image and other options (scale can take one number or an array of two numbers)</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>width, w</b> - Gets the sprite's width (affected by subRect and scale)</li>
|
||||
<li><b>height, h</b> - Gets the sprite's height (affected by subRect and scale)</li>
|
||||
<li><b>right, right=</b> - Gets/sets the right x position</li>
|
||||
<li><b>bottom, bottom=</b> - Gets/sets the bottom y position</li>
|
||||
<li><b>x, x=</b> - Gets/sets the center x position</li>
|
||||
<li><b>y, y=</b> - Gets/sets the center y position</li>
|
||||
<li><b>image, image=</b> - Gets/sets the image to use for this sprite</li>
|
||||
<li><b>subRect, subRect=</b> - Gets/sets a rectangle within the image to use (generally used for tiled images)</li>
|
||||
<li><b>getPixel(x,y), [x,y]</b> - Gets the color of a pixel within the sprite's subRect of the sprite's image ([0,0] would be the top-left pixel of the subRect)</li>
|
||||
<li><b>radius</b> - Gets the bounding radius of the sprite (based on height and width)</li>
|
||||
<li><b>distance(sprite)</b> - Gets the distance between the center positions of two sprites</li>
|
||||
<li><b>render(window)</b> - (virtual) Override to add custom rendering code</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="text">SFML::Text</a></h4>
|
||||
<ul>
|
||||
<li>(Inherits all methods from <a href="#drawable">SFML::Drawable</a>)</li>
|
||||
<li><b>initialize(str="", font="", size=32)</b> - Initialize the Text object to the specified string, font, and font size.</li>
|
||||
<li><b>preloadFont(font, size)</b> - (static) Call this to force the font to be loaded before the first time it gets rendered.</li>
|
||||
|
||||
<li><b>text, text=</b> - Gets/sets the current text string.</li>
|
||||
<li><b>font, font=</b> - Gets/sets the current font.</li>
|
||||
<li><b>size, size=</b> - Gets/sets the current font size.</li>
|
||||
<li><b>getRect</b> - Gets the current screen rectangle.</li>
|
||||
<li><b>render(window)</b> - (virtual) Override to add custom rendering code</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="videomode">SFML::VideoMode</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Default constructor</li>
|
||||
<li><b>initialize(w, h, bpp=32)</b> - Creates a VideoMode with the specified width, height, and bits-per-pixel.</li>
|
||||
<li><b>desktop</b> - (static) Returns the VideoMode for the current desktop.</li>
|
||||
<li><b>each</b> - (static) Iterates through all valid full-screen video modes.</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>width, w, width=, w=</b> - Gets/sets the current width of this VideoMode.</li>
|
||||
<li><b>height, h, height=, h=</b> - Gets/sets the current height of this VideoMode.</li>
|
||||
<li><b>bitsPerPixel, bpp, bitsPerPixel=, bpp=</b> - Gets/sets the current bits-per-pixel of this VideoMode.</li>
|
||||
<li><b>isValid</b> - Returns true if the current VideoMode is a valid full-screen mode.</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="view">SFML::View</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Default constructor</li>
|
||||
<li><b>initialize(left, top, width, height, zoom=1)</b> - Initializes all View members</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>left, l, left=, l=</b> - Gets/sets the left x position for the view</li>
|
||||
<li><b>top, t, top=, t=</b> - Gets/sets the top y position for the view</li>
|
||||
<li><b>width, w, width=, w=</b> - Gets/sets the width for the view</li>
|
||||
<li><b>height, h, height=, h=</b> - Gets/sets the height for the view</li>
|
||||
<li><b>zoom, zoom=</b> - Gets/sets the zoom factor for the view</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="window">SFML::Window</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize(mode, title, style=Window::Resizable, antialias=0)</b> - Creates a window using the specified VideoMode, title, and style</li>
|
||||
<li><b>to_s</b> - Returns a formatted string representing this object (for debugging purposes)</li>
|
||||
<li><b>width, w</b> - Gets the width of the window</li>
|
||||
<li><b>height, h</b> - Gets the height of the window</li>
|
||||
<li><b>input</b> - Gets the <a href="#input">SFML::Input</a> object for this window</li>
|
||||
<li><b>frameTime</b> - Gets the amount of time it took to render the previous frame</li>
|
||||
<li><b>stencilBits</b> - Gets the number of bits used in the stencil buffer</li>
|
||||
<li><b>depthBits</b> - Gets the number of bits used in the back buffer</li>
|
||||
<li><b>getEvent</b> - Returns the next event in the window's event queue (or nil if the queue is empty)</li>
|
||||
<li><b>useVerticalSync(bool)</b> - Use to enable/disable vsync</li>
|
||||
<li><b>showMouseCursor(bool)</b> - Use to show/hide the operating system's mouse cursor</li>
|
||||
<li><b>display</b> - Call to swap the front and back buffers to display the frame</li>
|
||||
<li><b>setCurrent</b> - Sets this window as the current target for rendering</li>
|
||||
<li><b>setFramerateLimit</b> - Set a fixed framerate (use 0 to disable it)</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
430
ruby/doc/Reference-fr.html
Normal file
430
ruby/doc/Reference-fr.html
Normal file
|
@ -0,0 +1,430 @@
|
|||
<html>
|
||||
<title>RubySFML Documentation</title>
|
||||
<style type="text/css">
|
||||
h4,h5,ul {margin: 5px}
|
||||
pre {background: #F0F0F0}
|
||||
.comment {color: #8080FF}
|
||||
.text {color: green}
|
||||
.keyword {color: purple}
|
||||
</style>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Introduction</h1>
|
||||
<p>Cette documentation est assez courte, mais étant donné que cette extension n'est qu'une simple encapsulation des classes C++ de SFML, il est conseillé de se baser sur la documentation SFML pour obtenir plus de détails sur les classes et les fonctions. Cette documentation a simplement pour but de détailler les classes et fonctions qui sont présentes dans l'extension RubySFML, ainsi que de décrire les changements qui ont été effectués durant la traduction C++ vers Ruby.</p>
|
||||
<p>Etant donné que Ruby ne supporte pas les threads et possède ses propres classes pour le réseau, seules certaines classes des modules système, fenêtrage, graphisme et audio sont exposées. Pour la plupart des classes, les seuls changements effectués ont été de faire débuter les noms des fonctions par une minuscule. Pour les classes possédant des accesseurs simples, ceux-ci ont souvent été abandonnés pour utiliser une syntaxe plus simple (par exemple sprite.left = ...). Quelques fonctions to_i, to_f et to_s ont étalement été ajoutées là où cela semblait pertinent. Enfin, un itérateur "each" a été ajouté à VideoMode.</p>
|
||||
<p>En plus des classes C++ exposées, deux classes utiles ont également été ajoutées à RubySFML.rb, l'une pour afficher des sprites à base de tuiles, et l'autre pour gérer les sprites utilisant des calculs de vitesse / acceleration (respectivement TSprite et VSprite).</p>
|
||||
|
||||
<h3>Astuces pour les utilisateurs Windows</h3>
|
||||
<p>Pour les utilisateurs Windows, nous regrettons de ne pas pouvoir être compatibles avec l'installeur "one-click", mais celui-ci est compilé avec Visual Studio 6.0, qui est ridiculeusement vieux et incompatible avec les bibliothèques SFML. Il existe une version gratuite de Visual Studio 2005, et les sources de Ruby compilent parfaitement avec celle-ci, on ne peut donc trouver aucune bonne excuse à l'installeur pour toujours utiliser Visual C++ 6.0.</p>
|
||||
<p>La bonne nouvelle est que vous pouvez distribuer vos applications dans une archive qui se suffit à elle-même, en incluant les répertoires "bin" et "lib" qui sont inclus dans la version Windows de cette extension. Ajoutez un installeur simple qui crée une icône du menu démarrer exécutant "%install_path%\bin\ruby.exe %install_path%\my_game.rb", et tout sera parfait. Oh, encore une chose, OpenAL doit être installé pour exécuter les programmes utilisant RubySFML. Heureusement, il s'agit d'un installeur extrêmement petit et simple, et vous pourrez sans problème le fournir dans vos installations ou donner un lien pour le télécharger. Tout ceci évite à vos utilisateurs d'avoir à télécharger / exécuter l'installeur "one-click", installer toutes les extensions nécessaires, s'occuper des problèmes de compatibilité, etc. Il est probable que très peu d'utilisateurs Windows utilisent vos applications si vous ne leur fournissez pas tout ce dont ils ont besoin, c'est donc probablement mieux de cette manière.</p>
|
||||
<p><b>Note :</b> cette compilation perso de Ruby ne contient pas gems et zlib (qui est recquis par gems), mais aucune autre extension n'est installée. N'hésitez pas à installer n'importe quelle autre gems / extension dont vous auriez besoin (les gems mswin32 compilés avec Visual Studio 6.0 ne fonctionneront probablement pas). Gardez en tête que beaucoup de gems ont une documentation conséquente, des exemples et des répertoires de test. Supprimer ces répertoires innutiles, ainsi que le répertoire cache des gems, peut réduire de manière significative la taille des fichiers que vous distribuez.</p>
|
||||
|
||||
<h3>Exemple de code RubySFML</h3>
|
||||
<pre>
|
||||
<span class="comment"># On inclut l'extension RubySFML</span>
|
||||
<span class="keyword">require</span> "<span class="text">RubySFML</span>"
|
||||
<span class="keyword">include</span> SFML
|
||||
|
||||
<span class="comment"># On crée la fenêtre principale</span>
|
||||
mode = VideoMode.new 800, 600, 32
|
||||
window = RenderWindow.new mode, "<span class="text">RubySFML Test</span>", false
|
||||
|
||||
<span class="comment"># On charge un sprite à afficher</span>
|
||||
image = Image.new "<span class="text">cute_image.jpg</span>"
|
||||
sprite = Sprite.new image
|
||||
|
||||
<span class="comment"># On crée une chaîne graphique à afficher</span>
|
||||
text = Text.new "<span class="text">Hello SFML</span>", "<span class="text">arial.ttf</span>", 50
|
||||
|
||||
<span class="comment"># On charge une musique et on commence à la jouer</span>
|
||||
music = Music.new "<span class="text">nice_music.ogg</span>"
|
||||
music.play
|
||||
|
||||
<span class="comment"># On démarre la boucle principale</span>
|
||||
running = true
|
||||
<span class="keyword">while</span> running
|
||||
<span class="keyword">while</span> event = window.getEvent
|
||||
running = false <span class="keyword">if</span> event.type == Event::Close
|
||||
<span class="keyword">end</span>
|
||||
|
||||
<span class="comment"># On dessine le sprite, le texte, puis on met à jour la fenêtre</span>
|
||||
window.draw sprite
|
||||
window.draw text
|
||||
window.display
|
||||
<span class="keyword">end</span>
|
||||
</pre>
|
||||
|
||||
<h3>Modules RubySFML</h3>
|
||||
<ul>
|
||||
<li><b><a href="#global">SFML</a</b> - Contient toutes les classes, modules et fonctions globales SFML</li>
|
||||
<li><b>SFML::Event</b> - Contient les constantes associées aux évènements SFML.</li>
|
||||
<li><b>SFML::Key</b> - Contient les constantes pour tous les codes de touches clavier SFML.</li>
|
||||
<li><b>SFML::Mouse</b> - Contient les constantes pour tous les codes de boutons souris SFML.</li>
|
||||
</ul>
|
||||
|
||||
<h3>Classes RubySFML</h3>
|
||||
<ul>
|
||||
<li><a href="#clock">SFML::Clock</a> - Une horloge système utilisant les timers haute performance lorsqu'ils sont accessibles</li>
|
||||
<li><a href="#color">SFML::Color</a> - Une classe de couleurs RGBA très simple</li>
|
||||
<li><a href="#drawable">SFML::Drawable</a> - Une classe abstraite représentant les objets 2D utilisés dans une Renderwindow </li>
|
||||
<li><a href="#event">SFML::Event</a> - Une classe représentant les différents évènements système (clavier, souris, etc.)</li>
|
||||
<li><a href="#floatrect">SFML::FloatRect</a> - Un simple rectangle composé de 4 coordonnées flottantes</li>
|
||||
<li><a href="#image">SFML::Image</a> - Une classe pour gérer les fichiers images et les textures</li>
|
||||
<li><a href="#input">SFML::Input</a> - Une classe pour récupérer l'état des périphériques d'entrée (clavier, souris, joystick)</li>
|
||||
<li><a href="#intrect">SFML::IntRect</a> - Un simple rectangle composé de 4 coordonnées entières</li>
|
||||
<li><a href="#music">SFML::Music</a> - Une classe pour jouer des musiques en streaming</li>
|
||||
<li><a href="#postfx">SFML::PostFX</a> - Une classe pour gérer les shaders post-rendu</li>
|
||||
<li><a href="#renderwindow">SFML::RenderWindow</a> - Une sous-classe de Window wui permet d'afficher les objets 2D tels que sprites et texte</li>
|
||||
<li><a href="#sound">SFML::Sound</a> - Une classe pour jouer des sons</li>
|
||||
<li><a href="#soundbuffer">SFML::SoundBuffer</a> - Une classe pour stocker des échantillons audio</li>
|
||||
<li><a href="#soundbufferrecorder">SFML::SoundBufferRecorder</a> - Une classe pour enregistrer du son à partir d'un périphérique de capture audio, comme un microphone</li>
|
||||
<li><a href="#sprite">SFML::Sprite</a> - Une classe pour gérer et afficher des sprites 2D</li>
|
||||
<li><a href="#text">SFML::Text</a> - Une classe pour gérer et afficher du texte 2D</li>
|
||||
<li><a href="#videomode">SFML::VideoMode</a> - Une classe pour gérer les différents modes vidéo</li>
|
||||
<li><a href="#view">SFML::View</a> - Une classe pour gérer la caméra 2D dans une RenderWindow</li>
|
||||
<li><a href="#window">SFML::Window</a> - Une classe pour créer et gérer une fenêtre capable d'afficher un rendu OpenGL (gère également les entrées et les évènements)</li>
|
||||
</ul>
|
||||
|
||||
<h3>Fonctions RubySFML (par module / classe)</h3>
|
||||
<hr/>
|
||||
<h4><a name="global">SFML</a></h4>
|
||||
<ul>
|
||||
<li><b>checkExtension(str)</b> - Renvoie vrai si l'extension OpenGL donnée est supportée.</li>
|
||||
<li><b>getMaxTextureSize</b> - Renvoie la taille maximum de texture.</li>
|
||||
<li><b>getMaxTextureUnits</b> - Renvoie le nombre maximum d'unités de textures utilisables.</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="clock">SFML::Clock</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Constructeur par défaut</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>reset</b> - Remet à zéro l'horloge</li>
|
||||
<li><b>elapsedTime,to_f</b> - Renvoie le nombre de secondes écoulées depuis le dernier appel à reset</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="color">SFML::Color</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Constructeur par défaut</li>
|
||||
<li><b>initialize(n)</b> - Construit l'objet à partir d'une couleur 32 bits entière non signée (0x12345678 donne r=0x78, g=0x56, b=0x34, a=0x12)</li>
|
||||
<li><b>initialize(r, g, b, a=255)</b> - Construit la couleur à partir de ses composantes</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>r, g, b, a</b> - Renvoie les composantes r, g, b et a (respectivement)</li>
|
||||
<li><b>r=, g=, b=, a=</b> - Affecte les composantes r, g, b et a (respectivement)</li>
|
||||
<li><b>toRGBA</b> -Renvoie les 4 composantes de la couleur sous forme d'entier RGBA 32 bits non signé (0x12345678 donne r=0x78, g=0x56, b=0x34, a=0x12)</li>
|
||||
<li><b>to_i</b> - Alias pour toRGBA</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="drawable">SFML::Drawable</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize(left=0, top=0, scale=1, rotation=0, color=Color.White)</b> - Initialise les différents membres (scale peut être un nombre ou un tableau de deux nombres)</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>left, left=</b> - Modifie / récupère la position x de l'objet</li>
|
||||
<li><b>top, top=</b> - Modifie / récupère la position y de l'objet</li>
|
||||
<li><b>scale, scale=</b> - Modifie / récupère le facteur d'échelle de l'objet (renvoie un tableau, mais peut être initialisé à partir d'un tableau ou d'un seul nombre)</li>
|
||||
<li><b>color, color=</b> - Modifie / récupère la couleur de l'objet</li>
|
||||
<li><b>rotation, rotation=</b> - Modifie / récupère l'angle de rotation (en degrés)</li>
|
||||
<li><b>upVector</b> - Récupère le vecteur "haut" de l'objet (basé sur son angle de rotation)</li>
|
||||
<li><b>rightVector</b> - Récupère le vecteur "droite" de l'objet (basé sur son angle de rotation)</li>
|
||||
<li><b>setRotationCenter(x, y)</b> - Change le centre de rotation de l'objet</li>
|
||||
<li><b>move(x, y)</b> - Déplace l'objet horizontalement et verticalement</li>
|
||||
<li><b>rotate(a)</b> - Fait tourner l'objet</li>
|
||||
<li><b>render(window)</b> - (virtuelle) à redéfinir pour personnaliser le rendu de l'objet</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="event">SFML::Event</a></h4>
|
||||
<h5>Pour tous les types d'évènements</h5>
|
||||
<ul>
|
||||
<li><b>initialize</b> - Ne prend aucun paramètre</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>type</b> - Renvoie le type de l'évènement</li>
|
||||
</ul>
|
||||
<h5>Pour les évènements de type Event::TextEntered</h5>
|
||||
<ul>
|
||||
<li><b>char</b> - Renvoie le caractère entré (uniquement pour les évènements Event::TextEntered)</li>
|
||||
</ul>
|
||||
<h5>Pour les évènements de type Event::KeyPressed et Event::KeyReleased</h5>
|
||||
<ul>
|
||||
<li><b>code</b> - Renvoie le code de la touche (uniquement pour les évènements Event::KeyPressed et Event::KeyReleased)</li>
|
||||
<li><b>alt</b> - Renvoie vrai si la touche Alt est enfoncée (uniquement pour les évènements Event::KeyPressed et Event::KeyReleased)</li>
|
||||
<li><b>control</b> - Renvoie vrai si la touche Control est enfoncée (uniquement pour les évènements Event::KeyPressed et Event::KeyReleased)</li>
|
||||
<li><b>shift</b> - Renvoie vrai si la touche Shift est enfoncée (uniquement pour les évènements Event::KeyPressed et Event::KeyReleased)</li>
|
||||
</ul>
|
||||
<h5>Pour les évènements de type souris et joystick</h5>
|
||||
<ul>
|
||||
<li><b>delta</b> - Renvoie le déplacement de la molette souris (uniquement pour les évènements Event::MouseWheelMoved)</li>
|
||||
<li><b>buttons</b> - Renvoie l'état des boutons de la souris (uniquement pour les évènements souris)</li>
|
||||
<li><b>button</b> - Renvoie l'état des boutons du joystick (uniquement pour les évènements joystick)</li>
|
||||
<li><b>x</b> - Renvoie la position x (uniquement pour les évènements souris et joystick)</li>
|
||||
<li><b>y</b> - Renvoie la position y (uniquement pour les évènements souris et joystick)</li>
|
||||
<li><b>z</b> - Renvoie la position z (uniquement pour les évènements joystick)</li>
|
||||
</ul>
|
||||
<h5>Pour les évènements de type Event::Resize</h5>
|
||||
<ul>
|
||||
<li><b>width</b> - Renvoie la nouvelle largeur de la fenêtre (uniquement pour les évènements Event::Resize)</li>
|
||||
<li><b>height</b> - Renvoie la nouvelle hauteur de la fenêtre (uniquement pour les évènements Event::Resize)</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="floatrect">SFML::FloatRect</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Constructeur par défaut</li>
|
||||
<li><b>initialize(left, top, right, bottom)</b> - Initialise les coordonnées du rectangle (gauche, haut, droite, bas)</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>left, l</b> - Renvoie la position x gauche</li>
|
||||
<li><b>left=, l=</b> - Modifie la position x gauche</li>
|
||||
<li><b>top, t</b> - Renvoie la position y haute</li>
|
||||
<li><b>top=, t=</b> - Modifie la position y haute</li>
|
||||
<li><b>right, r</b> - Renvoie la position x droite</li>
|
||||
<li><b>right=, r=</b> - Modifie la position x droite</li>
|
||||
<li><b>bottom, b</b> - Renvoie la position y basse</li>
|
||||
<li><b>bottom=, b=</b> - Modifie la position y basse</li>
|
||||
<li><b>width, w</b> - Renvoie la largeur du rectangle</li>
|
||||
<li><b>height, h</b> - Renvoie la hauteur du rectangle</li>
|
||||
<li><b>contains(x, y)</b> - Renvoie vrai si le point (x, y) est à l'intérieur du rectangle</li>
|
||||
<li><b>intersects(rect)</b> - Renvoie l'intersection de deux rectangles (nil s'il n'y a aucune intersection)</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="image">SFML::Image</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize</b> - Crée une image vide</li>
|
||||
<li><b>initialize(image)</b> - Crée une copie d'une image</li>
|
||||
<li><b>initialize(path)</b> - Charge une image à partir du fichier spécifié (lève une erreur RuntimeError si échoue)</li>
|
||||
<li><b>initialize(w, h, c=Color.Black)</b> - Crée une image vide avec les dimensions et la couleur données</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>getValidTextureSize(s)</b> - (statique) Renvoie la taille de texture valide la plus proche >= s</li>
|
||||
<li><b>width, w</b> - Renvoie la largeur de l'image</li>
|
||||
<li><b>height, h</b> - Renvoie la hauteur de l'image</li>
|
||||
<li><b>smooth=, setSmooth(bool)</b> - Modifie les paramètres de lissage de l'image (true pour activer, false pour désactiver)</li>
|
||||
<li><b>repeat=, setRepeat(bool)</b> - Modifie les paramètres de répétition de l'image (true pour activer, false pour désactiver)</li>
|
||||
<li><b>loadFromFile(path)</b> - Charge l'image à partir du fichier spécifié (renvoie faux si échoue)</li>
|
||||
<li><b>saveToFile(path)</b> - Sauvegarde l'image dans le fichier spécifié</li>
|
||||
<li><b>create(w, h, c=Color.Black)</b> - Crée une image vide avec les dimensions et la couleur données</li>
|
||||
<li><b>createMaskFromColor(color, a=0)</b> - Remplace la valeur alpha (transparence) de tous les pixels ayant la couleur spécifiée, par la valeur de transparence donnée</li>
|
||||
<li><b>resize(w, h, c=Color.Black)</b> - Redimensionne l'image. Si celle-ci est agrandie, les nouveaux pixels ont la couleur spécifiée</li>
|
||||
<li><b>getPixel(x, y), [x,y]</b> - Renvoie la couleur du pixel (x, y)</li>
|
||||
<li><b>setPixel(x, y, c), [x,y]=</b> - Change la couleur du pixel (x, y) par la couleur spécifiée</li>
|
||||
<li><b>update</b> - Met à jour l'image en mémoire vidéo (à appeler après toute modification manuelle des pixels)</li>
|
||||
<li><b>bind</b> - Utilise l'image pour le rendu (à appeler si vous utiliser l'image en tant que texture pour un rendu OpenGL)</li>
|
||||
<li><b>getTexCoords(rect)</b> - Convertit des coordonnées entières en pixel, en coordonnées flottantes de texture</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="input">SFML::Input</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize</b> - Constructeur par défaut</li>
|
||||
<li><b>isKeyDown(key)</b> - Renvoie vrai si la touche spécifiée est enfoncée</li>
|
||||
<li><b>isMouseButtonDown(button)</b> - Renvoie vrai si le bouton souris spécifié est enfoncé</li>
|
||||
<li><b>isJoystickButtonDown(n, button)</b> - Renvoie vrai si le bouton du joystick n spécifié est enfoncé</li>
|
||||
<li><b>getMouseX</b> - Renvoie la position x actuelle de la souris</li>
|
||||
<li><b>getMouseY</b> - Renvoie la position y actuelle de la souris</li>
|
||||
<li><b>getJoystickX(n)</b> - Renvoie la position x actuelle du joystick n</li>
|
||||
<li><b>getJoystickY(n)</b> - Renvoie la position y actuelle du joystick n</li>
|
||||
<li><b>getJoystickZ(n)</b> - Renvoie la position z actuelle du joystick n</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="intrect">SFML::IntRect</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Constructeur par défaut</li>
|
||||
<li><b>initialize(left, top, right, bottom)</b> - Initialise les coordonnées du rectangle (gauche, haut, droite, bas)</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>left, l</b> - Renvoie la position x gauche</li>
|
||||
<li><b>left=, l=</b> - Modifie la position x gauche</li>
|
||||
<li><b>top, t</b> - Renvoie la position y haute</li>
|
||||
<li><b>top=, t=</b> - Modifie la position y haute</li>
|
||||
<li><b>right, r</b> - Renvoie la position x droite</li>
|
||||
<li><b>right=, r=</b> - Modifie la position x droite</li>
|
||||
<li><b>bottom, b</b> - Renvoie la position y basse</li>
|
||||
<li><b>bottom=, b=</b> - Modifie la position y basse</li>
|
||||
<li><b>width, w</b> - Renvoie la largeur du rectangle</li>
|
||||
<li><b>height, h</b> - Renvoie la hauteur du rectangle</li>
|
||||
<li><b>contains(x, y)</b> - Renvoie vrai si le point (x, y) est à l'intérieur du rectangle</li>
|
||||
<li><b>intersects(rect)</b> - Renvoie l'intersection de deux rectangles (nil s'il n'y a aucune intersection)</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="music">SFML::Music</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize(bufSize=44100)</b> - Permet de spécifier la taille du tampon interne (à modifier si vous rencontrez des problèmes de performances ou de saccades)</li>
|
||||
<li><b>initialize(path)</b> - Ouvre la musique à partir du fichier spécifié (lève une erreur RuntimeError si échoue).</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>loop, loop=</b> - Renvoie / modifie un booléen indiquant si la musique doit boucler lorsqu'elle est terminée</li>
|
||||
<li><b>duration</b> - Renvoie la durée totale de la musique, en secondes</li>
|
||||
<li><b>channels</b> - Renvoie le nombre de canaux de la musique (1 = mono, 2 = stereo).</li>
|
||||
<li><b>sampleRate</b> - Renvoie le taux d'échantillonnage de la musique (44100 = qualité CD).</li>
|
||||
<li><b>status</b> - Renvoie l'état de lecture de la musique (Sound::Stopped, Sound::Paused, Sound::Playing).</li>
|
||||
<li><b>open(path)</b> - Ouvre la musique à partir du fichier spécifié (renvoie faux si échoue).</li>
|
||||
<li><b>play</b> - Démarre la lecture de la musique</li>
|
||||
<li><b>stop</b> - Stoppe la lecture de la musique</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="postfx">SFML::PostFX</a></h4>
|
||||
<ul>
|
||||
<li>(Hérite de toutes les fonctions de <a href="#drawable">SFML::Drawable</a>)</li>
|
||||
<li><b>initialize()</b> - Constructeur par défaut</li>
|
||||
<li><b>initialize(path)</b> - Charge le fichier effet spécifié</li>
|
||||
<li><b>initialize(postFX)</b> - Crée une copie d'un objet PostFX</li>
|
||||
<li><b>loadFromFile(path)</b> - Charge le fichier effet spécifié (renvoie faux si échoue)</li>
|
||||
<li><b>setParameter(name, x, y=nil, z=nil, w=nil)</b> - Change la valeur d'un paramètre de l'effet</li>
|
||||
<li><b>setTexture(name, image)</b> - Change une texture de l'effet</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="renderwindow">SFML::RenderWindow</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize(mode, title, style=Window::Resizable, antialias=0)</b> - Crée une fenêtre de rendu 2D en utilisant le mode vidéo, le titre et le style spécifiés</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>width, w</b> - Renvoie la largeur de la fenêtre</li>
|
||||
<li><b>height, h</b> - Renvoie la hauteur de la fenêtre</li>
|
||||
<li><b>input</b> - Renvoie l'objet <a href="#input">SFML::Input</a> associé à cette fenêtre</li>
|
||||
<li><b>frameTime</b> - Renvoie le temps écoulé depuis le dernier rafraîchissement</li>
|
||||
<li><b>stencilBits</b> - Renvoie le nombre de bits alloués au tampon stencil</li>
|
||||
<li><b>depthBits</b> - Renvoie le nombre de bits alloués au tampon de profondeur</li>
|
||||
<li><b>view, view=</b> - Renvoie / modifie l'objet <a href="#view">SFML::View</a> courant (camera 2D)</li>
|
||||
<li><b>backgroundColor=</b> - Modifie la couleur de fond de la fenêtre</li>
|
||||
<li><b>getEvent</b> - Renvoie le prochain évènement en attente dans la file d'évènements (ou nil s'il n'y en a aucun)</li>
|
||||
<li><b>useVerticalSync(bool)</b> - Active / désactive la synchronisation verticale</li>
|
||||
<li><b>showMouseCursor(bool)</b> - Affiche / cache le curseur souris sur la fenêtre</li>
|
||||
<li><b>display</b> - Met à jour la fenêtre à l'écran</li>
|
||||
<li><b>beginOpenGL</b> - Sauvegarde les états OpenGL internes avant que vous ne placiez des appels OpenGL</li>
|
||||
<li><b>endOpenGL</b> - Restaure les états OpenGL internes après que vous ayiez placé des appels OpenGL</li>
|
||||
<li><b>capture</b> - Prend une capture d'écran et la renvoie sous forme d'image</li>
|
||||
<li><b>draw(obj)</b> - Affiche dans la fenêtre tout objet dérivant de <a href="#drawable">SFML::Drawable</a></li>
|
||||
<li><b>setFramerateLimit</b> - Fixe une limite de rafraîchissement, en images par seconde (0 pour désactiver)</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="sound">SFML::Sound</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize(sound)</b> - Crée une copie d'un objet son</li>
|
||||
<li><b>initialize(buffer=nil, loop=false, pitch=1, volume=100, x=0, y=0, z=0)</b> - Crée un objet son en utilisant le tampon audio et les autres paramètres spécifiés</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>buffer, buffer=</b> - Renvoie / modifie le <a href="#soundbuffer">SFML::SoundBuffer</a> de cet objet</li>
|
||||
<li><b>loop, loop=</b> - Renvoie / modifie l'état de bouclage du son</li>
|
||||
<li><b>pitch, pitch=</b> - Renvoie / modifie le pitch du son</li>
|
||||
<li><b>volume, volume=</b> - Renvoie / modifie le volume du son</li>
|
||||
<li><b>position, position=</b> -Renvoie / modifie la position du son (utilise un tableau de 3 valeurs)</li>
|
||||
<li><b>status</b> - Renvoie l'état de lecture du son (Sound::Stopped, Sound::Paused, Sound::Playing).</li>
|
||||
<li><b>playingOffset</b> - Renvoie la position de lecture courante du son (en secondes).</li>
|
||||
<li><b>play</b> - Démarre la lecture du son</li>
|
||||
<li><b>pause</b> - Met ne pause le son</li>
|
||||
<li><b>stop</b> - Stoppe la lecture du son</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="soundbuffer">SFML::SoundBuffer</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Constructeur par défaut</li>
|
||||
<li><b>initialize(soundBuffer)</b> - Crée une copie d'un objet SoundBuffer</li>
|
||||
<li><b>initialize(path)</b> - Charge le tampon sonore à partir du fichier spécifié (lève une erreur RuntimeError si échoue).</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>samples</b> - Renvoie les échantillons sonores bruts sous forme de chaîne Ruby</li>
|
||||
<li><b>samplesCount</b> - Renvoie le nombre d'échantillons sonores du tampon</li>
|
||||
<li><b>samplesRate</b> - Renvoie le taux d'échantillonnage (nombre d'échantillons par seconde pour chaque canal)</li>
|
||||
<li><b>channels</b> - Renvoie le nombre de canaux (1 = mono, 2 = stereo)</li>
|
||||
<li><b>duration</b> - Renvoie la durée du tampon sonore (en secondes)</li>
|
||||
<li><b>loadFromFile(path)</b> - Charge le tampon sonore à partir du fichier spécifié (renvoie faux si échoue)</li>
|
||||
<li><b>saveToFile(path)</b> - Sauvegarde le tampon sonore dans le fichier spécifié (renvoie faux si échoue)</li>
|
||||
<li><b>loadFromMemory(samples, samplesCount, channels, sampleRate)</b> - Construit le tampon sonore à partir d'échantillons bruts en mémoire</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="soundbufferrecorder">SFML::SoundBufferRecorder</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Constructeur par défaut</li>
|
||||
<li><b>canCapture</b> - (statique) Renvoie vrai si le système est capable d'effectuer les captures audio</li>
|
||||
<li><b>start(sampleRate=44100)</b> - Démarre la capture audio</li>
|
||||
<li><b>stop</b> - Stoppe la capture audio</li>
|
||||
<li><b>buffer</b> - Renvoie l'objet SoundBuffer contenant le son capturé</li>
|
||||
<li><b>sampleRate</b> - Renvoie le taux d'échantillonnage utilisé pour la capture</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="sprite">SFML::Sprite</a></h4>
|
||||
<ul>
|
||||
<li>(Hérite de toutes les fonctions de <a href="#drawable">SFML::Drawable</a>)</li>
|
||||
<li><b>initialize()</b> - Constructeur par défaut</li>
|
||||
<li><b>initialize(image, left=0, top=0, scale=1, rotation=0, c=Color.White)</b> - Construit le sprite à partir de l'image et des autres paramètres donnés (le paramètre scale peut être un nombre simple ou un tableau de deux nombres)</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>width, w</b> - Renvoie la largeur du sprite (affectée par subRect et scale)</li>
|
||||
<li><b>height, h</b> - Renvoie la hauteur du sprite (affectée par subRect et scale)</li>
|
||||
<li><b>right, right=</b> - Renvoie / modifie la position x droite du sprite</li>
|
||||
<li><b>bottom, bottom=</b> - Renvoie / modifie la position y basse du sprite</li>
|
||||
<li><b>x, x=</b> - Renvoie / modifie la position x centrale du sprite</li>
|
||||
<li><b>y, y=</b> - Renvoie / modifie la position y centrale du sprite</li>
|
||||
<li><b>image, image=</b> - Renvoie / modifie l'image utilisée par le sprite</li>
|
||||
<li><b>subRect, subRect=</b> - Renvoie / modifie le sous-rectangle de l'image source utilisé pour le sprite</li>
|
||||
<li><b>getPixel(x,y), [x,y]</b> - Renvoie la couleur d'un pixel du sprite relativement à son sous-rectangle ([0, 0] serait le pixel haut-gauche du sous-rectangle)</li>
|
||||
<li><b>radius</b> - Renvoie le rayon du cercle englobant du sprite (basé sur sa hauteur et sa largeur)</li>
|
||||
<li><b>distance(sprite)</b> - Renvoie la distance entre les centres de deux sprites</li>
|
||||
<li><b>render(window)</b> - (virtuelle) A redéfinir pour effectuer un rendu personnalisé</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="text">SFML::Text</a></h4>
|
||||
<ul>
|
||||
<li>(Hérite de toutes les fonctions de <a href="#drawable">SFML::Drawable</a>)</li>
|
||||
<li><b>initialize(str="", font="", size=32)</b> - Initialise l'objet Text avec le texte, la police et la taille spécifiés</li>
|
||||
<li><b>preloadFont(font, size)</b> - (statique) Force le chargement de la police avant sa première utilisation</li>
|
||||
<li><b>text, text=</b> - Renvoie / modifie la chaîne à afficher</li>
|
||||
<li><b>font, font=</b> - Renvoie / modifie la police de caractères à utiliser</li>
|
||||
<li><b>size, size=</b> - Renvoie / modifie la taille du texte</li>
|
||||
<li><b>getRect</b> - Renvoie le rectangle englobant de la chaîne graphique</li>
|
||||
<li><b>render(window)</b> - (virtuelle) A redéfinir pour effectuer un rendu personnalisé</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="videomode">SFML::VideoMode</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Constructeur par défaut</li>
|
||||
<li><b>initialize(w, h, bpp=32)</b> - Crée un mode vidéo avec les dimensions et la profondeur (bits par pixel) spécifiées</li>
|
||||
<li><b>desktop</b> - (statique) Renvoie le mode vidéo actuel du bureau</li>
|
||||
<li><b>each</b> - (statique) Itère sur tous les modes vidéo plein écran valides</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>width, w, width=, w=</b> - Renvoie / modifie la largeur du mode vidéo</li>
|
||||
<li><b>height, h, height=, h=</b> - Renvoie / modifie la hauteur du mode vidéo</li>
|
||||
<li><b>bitsPerPixel, bpp, bitsPerPixel=, bpp=</b> - Renvoie / modifie la profondeur (bits par pixels) du mode vidéo</li>
|
||||
<li><b>isValid</b> - Renvoie vrai si le mode est un mode plein écran valide</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="view">SFML::View</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize()</b> - Constructeur par défaut</li>
|
||||
<li><b>initialize(left, top, width, height, zoom=1)</b> - Initialise la vue avec la position, taille et le zomm spécifiés</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>left, l, left=, l=</b> - Renvoie / modifie la position x gauche de la vue</li>
|
||||
<li><b>top, t, top=, t=</b> - Renvoie / modifie la position y haute de la vue</li>
|
||||
<li><b>width, w, width=, w=</b> - Renvoie / modifie la largeur de la vue</li>
|
||||
<li><b>height, h, height=, h=</b> - Renvoie / modifie la hauteur de la vue</li>
|
||||
<li><b>zoom, zoom=</b> - Renvoie / modifie le facteur de zoom de la vue</li>
|
||||
</ul>
|
||||
|
||||
<hr/>
|
||||
<h4><a name="window">SFML::Window</a></h4>
|
||||
<ul>
|
||||
<li><b>initialize(mode, title, style=Window::Resizable, antialias=0)</b> - Crée une fenêtre en utilisant le mode vidéo, le titre et le style spécifiés</li>
|
||||
<li><b>to_s</b> - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)</li>
|
||||
<li><b>width, w</b> - Renvoie la largeur de la fenêtre</li>
|
||||
<li><b>height, h</b> - Renvoie la hauteur de la fenêtre</li>
|
||||
<li><b>input</b> - Renvoie l'objet <a href="#input">SFML::Input</a> associé à cette fenêtre</li>
|
||||
<li><b>frameTime</b> - Renvoie le temps écoulé depuis le dernier rafraîchissement</li>
|
||||
<li><b>stencilBits</b> - Renvoie le nombre de bits alloués au tampon stencil</li>
|
||||
<li><b>depthBits</b> - Renvoie le nombre de bits alloués au tampon de profondeur</li>
|
||||
<li><b>getEvent</b> - Renvoie le prochain évènement en attente dans la file d'évènements (ou nil s'il n'y en a aucun)</li>
|
||||
<li><b>useVerticalSync(bool)</b> - Active / désactive la synchronisation verticale</li>
|
||||
<li><b>showMouseCursor(bool)</b> - Affiche / cache le curseur souris sur la fenêtre</li>
|
||||
<li><b>display</b> - Met à jour la fenêtre à l'écran</li>
|
||||
<li><b>setCurrent</b> - Rend la fenêtre courante active pour le rendu</li>
|
||||
<li><b>setFramerateLimit</b> - Fixe une limite de rafraîchissement, en images par seconde (0 pour désactiver)</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue