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

Author Topic: rbSFML  (Read 160674 times)

0 Members and 3 Guests are viewing this topic.

TricksterGuy

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
rbSFML
« Reply #60 on: December 04, 2010, 09:31:10 am »
tricksterguy

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
rbSFML
« Reply #61 on: December 04, 2010, 11:16:27 am »
Done.
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #62 on: December 04, 2010, 03:36:07 pm »
Aight goodie!

I've created a Bugtracker here( the same as SFML uses ) which we can use to organize who does what.

I'll add the rake build as a feature request assigned to no one until you register Trickster.
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 #63 on: December 04, 2010, 08:02:26 pm »
Laurent, I'm curious how you did for the .NET/Python bindings with the constructors when it comes to Shaders. How do you detect if it's a file or if it's loading from memory? Both takes a string.
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 #64 on: December 04, 2010, 08:09:28 pm »
Quote
How do you detect if it's a file or if it's loading from memory? Both takes a string.

Ah ah :D
I have a LoadFromString function (which is not very clean). For Python, they chose to use static functions instead of constructors, which is more flexible as you can use different names. For example:
Code: [Select]
shader = Shader.CreateFromFile("...")
shader = Shader.CreateFromString("...")
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #65 on: December 04, 2010, 08:37:42 pm »
Quote from: "Laurent"
Quote
How do you detect if it's a file or if it's loading from memory? Both takes a string.

Ah ah :D
I have a LoadFromString function (which is not very clean). For Python, they chose to use static functions instead of constructors, which is more flexible as you can use different names. For example:
Code: [Select]
shader = Shader.CreateFromFile("...")
shader = Shader.CreateFromString("...")


Hmm I can do that for Ruby too, really interesting. Wouldn't be hard to implement. But then I'll just do that a:
Code: [Select]
SFML::Shader.new( string )
will always assume that it's a file name. And then also provide these methods:
Code: [Select]
SFML::Shader.new_from_file( filename )
SFML::Shader.new_from_memory( source )

And so on for each resource class.

It's no major implementation. I'll create it as a new task at http://task.groogy.se and if you want to do it then you are free to assign it to yourself TricksterGuy. I have some documentation to do first.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

TricksterGuy

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
rbSFML
« Reply #66 on: December 04, 2010, 10:10:12 pm »
Ok I have created an account there.

Groogy if you are interested you can look at the rdocs for my version of the bindings I did a while back

http://trickster.wg2140.com/doc/index.html

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #67 on: December 04, 2010, 10:13:42 pm »
I'll do that, might be something there I can steal.

Though I noticed that you made the bind with the C bindings? That would have simplified a lot of things. But would you have had correct inheritance?

Anyway I made you a developer so you are now free to assign any tasks you like as I put them up. You can also put up your own tasks when you find bugs or come up with something you would like to add to the project.

Also you might notice I've added a "Extension" category. I has been thinking of adding a "sfml/ext" module which would contain some standard data structures like arrays, stacks, queues, bitsets and so on which are quite common. Ruby itself supports a form of array and hash but I'd like to extend that capability with some more data structures. There might even be room for things like common algorithms as binary search and so on.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

TricksterGuy

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
rbSFML
« Reply #68 on: December 05, 2010, 05:27:20 am »
I was wondering how one would wrap a C++ library for use with ruby.  I did not know how to do that 2 years ago so I just stuck with CSFML.

When I tested the methods I wrapped they worked.

Also can't you just use
Array#push Array#pop if you want to have a stack
Array#shift Array#push if you want to have a queue (though inefficient since shift moves all of the elements down)

I believe this kind of stuff is straying away from the focus of this, and should be left to another library whose focus is dedicated to datastructures and making them efficient as possible for ruby. As they say don't reinvent the wheel :P

Now that is not to say you should not add anything of this sort.  There are some things that could be added to make peoples lives a little easier.  

For example you can add a datastructure that holds drawables and each drawable has a z value.  You overload RenderWindow#draw to also be able to draw this and it will draw them all in order of z value

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #69 on: December 05, 2010, 03:43:38 pm »
Quote from: "TricksterGuy"
Also can't you just use
Array#push Array#pop if you want to have a stack
Array#shift Array#push if you want to have a queue (though inefficient since shift moves all of the elements down)

I've already made some container classes in Ruby to do these things for me and that I feel are more efficient. Though it might just be a "I've done it myself so I know it's better"-thingy :P
Quote from: "TricksterGuy"

I believe this kind of stuff is straying away from the focus of this, and should be left to another library whose focus is dedicated to datastructures and making them efficient as possible for ruby. As they say don't reinvent the wheel :P

Well that's pretty much true. Though multimedia means several contents or something like that so it might just fit in, but most probably not :P

Quote from: "TricksterGuy"

Now that is not to say you should not add anything of this sort.  There are some things that could be added to make peoples lives a little easier.  

For example you can add a datastructure that holds drawables and each drawable has a z value.  You overload RenderWindow#draw to also be able to draw this and it will draw them all in order of z value

Well that could be easily be implemented with a custom drawable. Something like this:
Code: [Select]
class ZOrderedDrawables
  include SFML::Drawable
 
  def initialize
    @drawables = []
  end
 
  def add( aDrawable )
    index = # find the index to place it so the drawables stay in order.
    @drawables.insert( index, aDrawable )
  end

  def render( aTarget, aRenderer )
    for drawable in @drawables
      aTarget.draw( drawable )
    end
  end
end


Though the thing is if it does fit into the SFML library. Though we could make it so that sfml/ext is a totally separate library from SFML that you have to write explicitly to compile. So it's not included in a "rake all" and have to write by yourself "rake extension" or something like that. This depends on how Laurent feels if it fits into a Ruby bindings.
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 #70 on: December 05, 2010, 08:33:30 pm »
If you want my opinion, I think there should be the binding and the extension as two clearly separated things.
Laurent Gomila - SFML developer

Calmatory

  • Newbie
  • *
  • Posts: 16
    • View Profile
rbSFML
« Reply #71 on: December 08, 2010, 10:33:01 pm »
This is just awesome work, Swede. :)

A big big thank you.
The amount of effort we put into something arbitrary we do in our everyday lives is proportional to the amount we gain from it. It's fascinating how this applies to everything in our lives. Your task is to try to enjoy and make the most out of it.

Hugo

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
rbSFML
« Reply #72 on: December 26, 2010, 01:02:22 am »
+1 dev points for you I've been wanting to learn ruby

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #73 on: January 08, 2011, 04:04:09 pm »
Trickster, I added a new project to our task tracker so I had to move the rights around a little. So now your not a global developer but only a rbSFML developer. It's not that I think you would mess anything up(and even if you did it wouldn't matter) but I'm quite picky and right should be right :P

And if I would get more developers to rbSFML or Ascension then it would be nice to know what I am doing :)

Anyway tell me if you still got full access to the rbSFML project but none to the new one.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

TricksterGuy

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
rbSFML
« Reply #74 on: January 18, 2011, 04:09:12 pm »
Its fine I would have done the same thing, but it looks like its down.  I can't access it.

 

anything