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

Author Topic: rbSFML  (Read 159545 times)

0 Members and 2 Guests are viewing this topic.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #90 on: February 11, 2011, 03:15:02 pm »
It's okay, I got school too :P

Anyway commit what you have and I'll have a look at it. IS the error occuring on your laptop with intel or ATI? Because that might just be what is happening, the old ATI/Intel bug :P

Anyway I'll have a go on my new laptop with a REAL nvidia card and on my university computer which also have a nvidia card and on my old intel laptop to see if the error occurs on all of them. Unfortunley I do not have access to any ATI cards :/
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

TricksterGuy

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
rbSFML
« Reply #91 on: February 13, 2011, 06:08:43 am »
I'll have it committed in a second. Checking to make sure I didn't break anything. EDIT It is now committed.

I am testing the changes on linux now and I don't get the crash on exit thing.  Interesting...

Also this laptop has an Intel



So as I said I was testing this under windows with the window-demo.rb test.
It works fine however upon closing ruby crashes.
Interesting enough if I comment all of the code to initialize the window library and require it. It will still crash. That is regardless of the code for window.so requiring it makes ruby crash upon closing.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #92 on: February 13, 2011, 01:02:54 pm »
Yep, it's probably the global opengl context. Laurent is working on it, I'll try it out 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 #93 on: February 13, 2011, 01:41:19 pm »
Aight running Window worked :) Though since it's Windows it was bit tricky to get it to find SFML and be able to compile because of that, don't think you can help out the user with that somehow? Also "rake install" didn't work for me? I normally don't use Ruby on Windows so I don't know what I did wrong. Anyway what it failed on was simply copying audio.so to the ruby directory. I'm using Win7.
Also you have messed up something so that Graphics can't be loaded because WindowLoaded haven't been defined or something... I haven't looked at it really yet, just noticed that I couldn't run render-window-demo.rb because Graphics failed to load. *Fixed* You didn't gain access to the SFML namespace module or the shared objects in here. :)
It's a weird name for a function: rb_define_* because you don't define anything if it already exists, it just returns a VALUE reference to it.

I'll fix it now ^^  Got nothing to do with my coffee.

Anyway it works here without crashing like you said and it's on WINDOWS :D
So we officially support windows now too ^^
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

TricksterGuy

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
rbSFML
« Reply #94 on: February 13, 2011, 06:52:17 pm »
If you get it from svn (the whole sfml2 stuff) it should compile out of the box.  The default directories it searches assumes the same directory structure as whats in the repository.

You can switch them by defining some environment variables in which case it will override the default.

SFML_INCLUDE to tell it where the SFML header files are
SFML_LIB to tell it where the SFML library files are

and currently rake install does put the things in the wrong directory however on linux it installs in the correct directory at least from what I have seen :|
This should be an easy fix however.

Haha cool, but ruby still crashes on exit on my computer :P

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #95 on: February 13, 2011, 07:12:51 pm »
Quote from: "TricksterGuy"
If you get it from svn (the whole sfml2 stuff) it should compile out of the box.  The default directories it searches assumes the same directory structure as whats in the repository.

Ah okay, I took it down from the repo but I didn't care to compile SFML2 since I already had it.

Quote from: "TricksterGuy"

You can switch them by defining some environment variables in which case it will override the default.

SFML_INCLUDE to tell it where the SFML header files are
SFML_LIB to tell it where the SFML library files are

Sweet, can you pass that to rake as arguments? That would be handy. I had a problem with the environment variable since the path has spaces in it and Ruby didn't like that :P

Quote from: "TricksterGuy"

and currently rake install does put the things in the wrong directory however on linux it installs in the correct directory at least from what I have seen :|
This should be an easy fix however.

In my eyes it looked like the correct one: #<RuntimeError: Command failed with status (127): [install sfml/audio.so C:/Ruby
192/lib/ruby/...]>

Quote from: "TricksterGuy"

Haha cool, but ruby still crashes on exit on my computer :P

Well like I said, Laurent is working on it :)
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 #96 on: February 26, 2011, 02:27:20 am »
Just a general warning for anyone, cloning a SFML object that is not mixed in non-copyable and wraps a C++ instance will result in undefined behaviour, most probably a crash if Ruby is kind on you. I thought I only had to define the SFML::<insert class here>#initialize_copy method in order to have it working. But what I forgot is that a new instance is never allocated, so I am actually working on a wild pointer in that method.

I am going to fix it this weekend, I have already made a fix for SFML::Sprite that worked. I'll upload it all in one bunch.

EDIT: Added task here

EDIT2: Only got Graphics and Audio library left.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Mon ouïe

  • Newbie
  • *
  • Posts: 27
    • View Profile
rbSFML
« Reply #97 on: February 26, 2011, 07:42:16 am »
The new instance *is* allocated. What you are doing wrong is overriding new. The default implementation does something like that:
Code: [Select]

class Class
  def new(*args, &block)
    obj = alloc
    obj.send :initialize, *args, &block
    obj
  end
end


alloc is the method tha allocates the object. If you need to wrap a C++ object in the Ruby object, you shouldn't override new, but rather alloc, since new isn't the only method that could create an object.

To override alloc, use rb_define_alloc_func.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
rbSFML
« Reply #98 on: February 26, 2011, 04:45:15 pm »
I'll have a look at it.

Update: Initial testing seems to work. More re-factoring for me... YAY!
Update: The different event type classes won't be re-factored, they should only be acquired trough an event instance anyway. Might re-factor them when I got the time to do it.
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 #99 on: February 27, 2011, 02:39:02 pm »
I'm wondering, is these classes copyable?
SoundBufferRecorder
SoundRecorder

They don't inherit from NonCopyable but they don't have an assignment operator or copy constructor defined. Is it still safe to copy them?

Edit: When I tried I got massive failure, but this is not reflected in the documentation. =/

In any case the re-factoring is done.

Update: Well ruby is bad mouthing me about my allocating in drawable. Don't know why I made a special case there. Anyway I've fixed it, I'll commit it when I get home. So if you get a warning message about deprecated allocation method setting or something, just update to a later rbSFML binding.
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 #100 on: March 05, 2011, 03:42:31 pm »
I'm wondering what you think trickster? Should we support that the end user compile rbSFML with static sfml libraries? Like he writes in the console:
Code: [Select]
rake static and it uses the static libraries instead?

I'm just thinking it might be annoying for some people having to juggle around double shared libraries, especially on windows. It probably should even be the default on windows.

It's just a convenience thing and not something important really. They can live with it. So it depends on if you got the time to modify the rakefile to support it. If not, then we don't do it unless someone complains.

Since the libraries should be encapsulated in a gem normally, it shouldn't be a bother.
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 #101 on: March 28, 2011, 10:15:46 am »
Aight a Github repo is up for rbSFML: https://github.com/Groogy/rbSFML
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 #102 on: April 06, 2011, 10:48:09 pm »
rbSFML should be up-to-date right now. At least it compiles. If there's a new function in the API that I've missed please notify me. I am doing my best following Laurent's commits.
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 #103 on: April 07, 2011, 07:47:35 am »
The latest modifications didn't add anything, they removed RenderImage::IsAvailable.

There are default values that changed in sf::ContextSettings and sf::Image, I don't know if it makes a difference for you.
Laurent Gomila - SFML developer

TricksterGuy

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
rbSFML
« Reply #104 on: April 07, 2011, 07:49:36 am »
Quote from: "Groogy"
I'm wondering what you think trickster? Should we support that the end user compile rbSFML with static sfml libraries? Like he writes in the console:
Code: [Select]
rake static and it uses the static libraries instead?

I'm just thinking it might be annoying for some people having to juggle around double shared libraries, especially on windows. It probably should even be the default on windows.

It's just a convenience thing and not something important really. They can live with it. So it depends on if you got the time to modify the rakefile to support it. If not, then we don't do it unless someone complains.

Since the libraries should be encapsulated in a gem normally, it shouldn't be a bother.


I'll wait until someome complains.

I also have little time for the next couple of weeks due to graduate school...

However the good news is I have purchased a new laptop with a better graphics card than my old laptop and its a 64 bit system. So I'll play around it with it with this when I am able.