SFML community forums

General => SFML projects => Topic started by: MetalCoder on June 05, 2020, 09:47:06 pm

Title: Ruby Wrapper Using FFI
Post by: MetalCoder on June 05, 2020, 09:47:06 pm
Hello all,

I have made a wrapper for SFML in the Ruby programming language. This updates it to 2.5. It is based off the C port of SFML. I used FFI to help make things easier. I have most of the modules wrapped. The only one I don't have wrapped is the Net module. I noticed the last SFML wrapper for Ruby hasn't been updated in a long time. I don't have this on Github or anything yet. Just wondering if anyone would be interested?

Here is a brief example of the wrapper using FFI.
attach_function :sfRenderWindow_create,[:uint,:uint,:uint,:string,:uint32,:pointer],:pointer

require 'ffi'
#don't run infinite loop
x = Graphics.sfRenderWindow_create(800,600,32,"SFML",0,nil)
while Graphics.sfRenderWindow_isOpen(x)
        Graphics.sfRenderWindow_display(x)
end