IT IS FINALLY DONE!
Took some time and a lot of effort but rbSFML is finally up to date with Laurent/SFML @ Github.
With time documentation and Rspec's will be put up to complete the binding.
Getting started steps are available in the
readme and if you have programmed before with SFML but in any other language it should be really easy to get started as every method has an alias method which mimics the C++ Documentation so you can more or less both write Ruby-style code and C++-style code with the binding to make it as easy as possible to get started with rbSFML.
Example:
text = SFML::Text.new( "Hello World!" )
text.color = [ 255, 0, 255 ]
text.position = [ 10, 10 ]
image = SFML::Image.new( 100, 100, SFML::Color::White )
texture = SFML::Texture.new( 100, 100 )
sprite = SFML::Sprite.new( texture )
sprite.origin = [ 50, 50 ]
texture.update( image )
Is the same as
text = SFML::Text.new( "Hello World!" )
text.setColor( SFML::Color.new( 255, 0, 255 ) )
text.setPosition( SFML::Vector2.new( 10, 10 ) )
image = SFML::Image.new( 100, 100, SFML::Color::White )
texture = SFML::Texture.new( 100, 100 )
sprite = SFML::Sprite.new( texture )
sprite.setOrigin( SFML::Vector2.new( 50, 50 ) )
texture.update( image )
As you can also see we have provided an implicit way to define the common SFML structures to make it easier and faster to use. So instead of having to write the code to create a vector object you can just provide an equivalent array and rbSFML will construct a vector object from it.
I hope my previous users like the bindings and if they have opinions on how to improve it and make it more Ruby-like I would love to hear them. And I hope I will get more users and I hope they as well will have opinions and give them to me
Until I get going with Rspec and documentation here is a working example you can play around with:
require 'sfml/system'
require 'sfml/window'
require 'sfml/graphics'
window = SFML::RenderWindow.new( [ 800, 600 ], "Test" )
text = SFML::Text.new( "Hello World!" )
text.color = [ 255, 0, 255 ]
text.position = [ 10, 10 ]
image = SFML::Image.new( 100, 100, SFML::Color::White )
texture = SFML::Texture.new( 100, 100 )
sprite = SFML::Sprite.new( texture )
sprite.origin = [ 50, 50 ]
texture.update( image )
while window.open?
window.clear
window.draw text
window.draw sprite
window.display
sprite.position = SFML::Mouse.position( window )
window.each_event do |event|
if event.type == SFML::Event::Closed
window.close
end
end
end
Have fun!