Hello everyone. I've been working on a SFML wrapper for Ruby, I've been testing RubyRice and SFML in C++ for a while, but I noticed that the performance left a lot to be desired. So I decided to continue switching to CSFML and C, the project is not finished yet but it is already possible to compile the package to install in Ruby, it installs the dependencies automatically (In case of Linux and Windows with MSYS2)
The project tries to be as faithful to the Ruby syntax (
snake_case and properties instead of "getters/setters") as
pysdl2 does with the
pysdl2.ext module, I leave a sample of the code that runs without problems:
require "sfml"
window = SFML::Window.new(SFML::VideoMode.new(640, 480, 32), "SFML in Ruby")
event = SFML::Event.new
while window.is_open?
while window.poll_event! event
case event.type
when "closed"
puts "Goodbye!"
window.close!
when "resized"
puts "Resized: #{event.size}"
when "key-pressed"
puts "Key pressed: #{event.key}"
end
end
puts window.position.to_s
window.display
end
I reiterate, the project is not finished yet but at least it already has bases to build on, it will be in constant change
, Here is the project repository on Github:
https://github.com/SealtielFreak/sfml.rbDoubts or questions are welcome
.