Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: rbSFML  (Read 160569 times)

0 Members and 1 Guest are viewing this topic.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #15 on: November 23, 2010, 08:46:30 am »
But how come then that the:
Code: [Select]
sf::RenderTarget &target = /* Somewhere */
target.Draw( aDrawable );

works but not this:
Code: [Select]
sf::RenderTarget *target = /* Somewhere */
target->Draw( aDrawable );


If I remember correctly, the error is a Segmentation fault, I'll make a check as soon as I boot up my dev-environment here at school. And like I said, I've checked, the correct objects are there and they are initiated and everything is perfect. Also just changing the type of the pointer fixes my problem.

**EDIT**
The error is a Segmentation Fault and the C level backtrace tells me that it crashes in sf::RenderTarget::Draw( Drawable ) when it happens.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #16 on: November 24, 2010, 07:03:54 am »
Aight now the Graphics module is completed and everything seems to be working. Though I suspect a possible bug in when you create your custom drawable class. But I'll look deeper into that later today.

Anyway your free to start playing around with the graphics library now too.
After this I'm going to jump into the Audio module. Also I'm wondering about if I should do the network module since Ruby got a very large network library by itself. Though I don't know if it's easier to use or even better than the SFML network module. So I'll probably make it just to be sure.

The largest difference between SFML network and Ruby network would be Distributed Ruby I think. This let's you share one common object between two clients or client and server, don't remember which it was. Anyway this is a really sweet feature and I might try to add it into the SFML library too so you can have one common interface.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
rbSFML
« Reply #17 on: November 24, 2010, 08:25:16 am »
Usually, sfml-system and sfml-network are ignored in bindings, since the target languages have a decent (and better) standard library. I don't think you should bind sfml-network if Ruby has the features you describe.
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #18 on: November 25, 2010, 08:36:26 pm »
Well since Ruby standard library offer better network capabilities means that the new rbSFML is now up-to date with SFML2!

As soon as SFML2 is officially released I'll release rbSFML officially as an extension gem and also publish it at sites like Rubyforge. I think it is that site that makes the gem available directly trough rubygem.

So all ruby crazy people like me start using rbSFML now! :D
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
rbSFML
« Reply #19 on: November 25, 2010, 08:40:08 pm »
By the way, I added a news about rbSFML on the website home page ;)
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #20 on: November 25, 2010, 08:49:29 pm »
Quote from: "Laurent"
By the way, I added a news about rbSFML on the website home page ;)


That's just awesome :D
I'm already spending my bragging rights ^^
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #21 on: November 25, 2010, 08:56:14 pm »
Also I know of a first bug(or at least I think it will crash the app) which is defining a custom Drawable. Defining it works fine but as soon as you try to tell the SFML::RenderTarget to draw anything in the render method it should crash with ruby telling you about a segmentation fault. I haven't confirmed it yet but logically it should crash.

A fix for this would be using RTTI with dynamic_cast to cast the RenderTarget into it's proper type before trying to draw any drawable. This will only be used in the SFML::RenderTarget#draw method and not the SFML::RenderImage#draw and SFML::RenderWindow#draw method. So more or less, when we are not sure of what type the render target actually is. I hope that the dynamic_cast won't take up TOO much performance. Taking performance on every draw call is very bad.

The history for this bug is the previous problem in this post: http://sfml-dev.org/forum/viewtopic.php?p=23512#23512
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

mistergibson

  • Newbie
  • *
  • Posts: 1
    • View Profile
rbSFML release suggestion
« Reply #22 on: November 26, 2010, 12:39:06 am »
When you release rbSFML, I would suggest you post it as a gem at:

http://rubygems.org/

That will put you instantly into a very easy deploy position as pretty much everyone uses it.

Also: do you have an Ubuntu PPA presence for SFML 2.0 - I found one carrying 1.5, but not 2.0.

I see you are building rbSFML for SFML 2.0, but will it also work (call compatible) with SFML 1.5 ?

Just curious.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Re: rbSFML release suggestion
« Reply #23 on: November 26, 2010, 01:05:41 am »
Quote from: "mistergibson"
When you release rbSFML, I would suggest you post it as a gem at:

http://rubygems.org/

That will put you instantly into a very easy deploy position as pretty much everyone uses it.

Thx! Had no idea where the gems repo actually were placed, I guessed on Rubyforge.

Quote from: "mistergibson"

I see you are building rbSFML for SFML 2.0, but will it also work (call compatible) with SFML 1.5 ?

Just curious.


No, I was supposed to originally make rbSFML for SFML 1.6 actually but Laurent told me that it wouldn't be worth it. SFML 2.0 is more or less done soon with a better, faster and easier interface than the 1.X branch.

So I advice you to step over to SFML2 if not already now. Documentation is up for SFML2 and if you need you can generate rdoc documentation from rbSFML. Also you won't find any broken features in SFML2. If something crashes or is broken then I'm 99% certain that it's me that has done something wrong and 0.5% that it is Laurent and 0.5% that it's somewhere else.

And as a side note, I've committed a fix for the "unkown type" RenderTarget problem. If there even was a bug there before that I suspected then it's fixed now.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #24 on: November 28, 2010, 02:08:29 am »
Got an annoying bug that doesn't always show up. I don't know what replicates it but seems like I have done something special to screw it up in my own ruby source code. While doing basic tests everything works but directly in my source it appears.

The problem is somehow that calling SFML::Text#getRect touches something it shouldn't and that messes the font resource up or something. Because when I try to draw the text later, it displays some garbage data or something. How this happens I don't know since it has only happened once for me. Tried staring at my code but doesn't help. I reckon it's something with the ruby garbage collector. Though I'm using the default arial sfml font which I've specified is not allowed to be garbage collected.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

TricksterGuy

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
rbSFML
« Reply #25 on: November 28, 2010, 03:53:06 am »
Nice job on this :D.

I was working on ruby bindings of my own (some two years ago I believe there is a topic in this forum with it), but I stopped since SFML 2 was in development and I didn't want to waste time doing 1.5 if 2.0 had many API changes. I was going to work on it again when Laurent officially released SFML 2.0, but I see that you will beat me to it.

(not to hijack or anything, but there were a number of things holding me back from continuing i.e. I didn't have a linux box to test anything at the time nor did my laptop have an advanced enough video card)

If you need any help on anything or need a second developer I can provide assistance. (And there were also people sending me private messages also I can send those people your way as well)

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #26 on: November 28, 2010, 10:52:23 am »
Sure why not. It would be nice if you could use and try it out. Currently I think most of my problems are coming from my drivers on my home computer. Because everything works when I am at the university at my workstation but when I come home everything start's to crash on me and I get very weird undefined behavior. Also one of the call-stacks ended in my driver shared library so that's a pretty good lead :P

But it would be nice if someone else than me would have a look at the code to see if there's something I've done wrong. The undefined behavior could be because of something I've done.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #27 on: November 28, 2010, 06:50:38 pm »
About those last bugs. I have confirmed it was my stupid graphics drivers. I've tested on some other machines the exact same code and it works without any thing weird happening. How a bad graphic driver can make ruby stop working is still a mystery to me. But at least now I know not to work when I'm at home.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

TricksterGuy

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
rbSFML
« Reply #28 on: November 29, 2010, 09:25:37 am »
Ok so I got a fresh copy of sfml2 from svn.

audio and system compile fine

however window and graphics do not.

for window
Quote
brandon@ubuntu:~/Documents/src/sfml/bindings/ruby/sfml-window$ ruby extconf.rb
checking for main() in -lsfml-window... no
checking for main.hpp in ../sfml-system/system... yes
creating Makefile
brandon@ubuntu:~/Documents/src/sfml/bindings/ruby/sfml-window$ make
g++ -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -I../sfml-system/system -D_FILE_OFFSET_BITS=64  -fPIC -fno-strict-aliasing -g -g -O2  -fPIC    -c window/Window.cpp
window/Window.cpp: In function ‘VALUE Window_SetTitle(VALUE, VALUE)’:
window/Window.cpp:482: error: ‘class sf::Window’ has no member named ‘SetTitle’
make: *** [Window.o] Error 1


for graphics
Quote

brandon@ubuntu:~/Documents/src/sfml/bindings/ruby/sfml-graphics$ ruby extconf.rb
checking for main() in -lsfml-graphics... no
checking for main.hpp in ../sfml-system/system... yes
creating Makefile
brandon@ubuntu:~/Documents/src/sfml/bindings/ruby/sfml-graphics$ make
g++ -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -I../sfml-system/system -D_FILE_OFFSET_BITS=64  -fPIC -fno-strict-aliasing -g -g -O2  -fPIC    -c graphics/Shape.cpp
g++ -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -I../sfml-system/system -D_FILE_OFFSET_BITS=64  -fPIC -fno-strict-aliasing -g -g -O2  -fPIC    -c graphics/View.cpp
graphics/View.cpp: In function ‘VALUE View_Initialize(int, VALUE*, VALUE)’:
graphics/View.cpp:74: error: ‘class sf::FloatRect’ has no member named ‘Width’
graphics/View.cpp:75: error: ‘class sf::FloatRect’ has no member named ‘Height’
graphics/View.cpp: In function ‘VALUE View_GetViewport(VALUE)’:
graphics/View.cpp:139: error: ‘const class sf::Rect<float>’ has no member named ‘Width’
graphics/View.cpp:139: error: ‘const class sf::Rect<float>’ has no member named ‘Height’
graphics/View.cpp: In function ‘VALUE View_Reset(VALUE, VALUE)’:
graphics/View.cpp:191: error: ‘class sf::FloatRect’ has no member named ‘Width’
graphics/View.cpp:192: error: ‘class sf::FloatRect’ has no member named ‘Height’
graphics/View.cpp: In function ‘VALUE View_SetViewport(VALUE, VALUE)’:
graphics/View.cpp:311: error: ‘class sf::FloatRect’ has no member named ‘Width’
graphics/View.cpp:312: error: ‘class sf::FloatRect’ has no member named ‘Height’
make: *** [View.o] Error 1
brandon@ubuntu:~/Documents/src/sfml/bindings/ruby/sfml-graphics$ clear

brandon@ubuntu:~/Documents/src/sfml/bindings/ruby/sfml-graphics$ ruby extconf.rb
checking for main() in -lsfml-graphics... no
checking for main.hpp in ../sfml-system/system... yes
creating Makefile
brandon@ubuntu:~/Documents/src/sfml/bindings/ruby/sfml-graphics$ make
g++ -I. -I. -I/usr/lib/ruby/1.8/i686-linux -I. -I../sfml-system/system -D_FILE_OFFSET_BITS=64  -fPIC -fno-strict-aliasing -g -g -O2  -fPIC    -c graphics/View.cpp
graphics/View.cpp: In function ‘VALUE View_Initialize(int, VALUE*, VALUE)’:
graphics/View.cpp:74: error: ‘class sf::FloatRect’ has no member named ‘Width’
graphics/View.cpp:75: error: ‘class sf::FloatRect’ has no member named ‘Height’
graphics/View.cpp: In function ‘VALUE View_GetViewport(VALUE)’:
graphics/View.cpp:139: error: ‘const class sf::Rect<float>’ has no member named ‘Width’
graphics/View.cpp:139: error: ‘const class sf::Rect<float>’ has no member named ‘Height’
graphics/View.cpp: In function ‘VALUE View_Reset(VALUE, VALUE)’:
graphics/View.cpp:191: error: ‘class sf::FloatRect’ has no member named ‘Width’
graphics/View.cpp:192: error: ‘class sf::FloatRect’ has no member named ‘Height’
graphics/View.cpp: In function ‘VALUE View_SetViewport(VALUE, VALUE)’:
graphics/View.cpp:311: error: ‘class sf::FloatRect’ has no member named ‘Width’
graphics/View.cpp:312: error: ‘class sf::FloatRect’ has no member named ‘Height’
make: *** [View.o] Error 1
brandon@ubuntu:~/Documents/src/sfml/bindings/ruby/sfml-graphics$


Could have something to do with the extconf output !!!


I am testing on the latest ubuntu (obviously) and ruby 1.8.7 from the repository.


Also I don't like how I have to go to four directories and type the same thing four times.  A simple command that does all of that for you would be optimal.

When I was working on my own bindings created a Rakefile that handled all of the building / documentation / installing / clean up tasks. And I can adapt it for your code, however I don't know how everyone feels about rake though.

I'm too lazy to try and fix these errors right now (and its my bedtime and I have a class in < 5 hours).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
rbSFML
« Reply #29 on: November 29, 2010, 09:32:10 am »
It seems like you're using SFML 1 headers (SetTitle, Width, Height are all new to SFML 2).
Laurent Gomila - SFML developer

 

anything