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

Author Topic: rbSFML  (Read 155361 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
Re: rbSFML
« Reply #255 on: May 01, 2012, 05:24:44 pm »
Yes it is. I don't understand why though... this code should be safe:

VALUE rbRenderTarget::SetView( VALUE aSelf, VALUE aView )
{
        rbRenderTarget::ToSFML( aSelf )->setView( *rbMacros::ToSFML< sf::View >( aView, rbView::Class ) );
        return Qnil;
}

VALUE rbRenderTarget::GetDefaultView( VALUE aSelf )
{
        const sf::View& view = rbRenderTarget::ToSFML( aSelf )->getDefaultView();
        VALUE obj = rbMacros::ToRuby( const_cast< sf::View* >( &view ), rbView::Class );
        rb_iv_set( obj, "@__ref__owner", aSelf );
        rb_obj_freeze( obj );
        return obj;
}

I am having a hard time seeing what is wrong here =/


Update: Nevermind I just saw it I think.
The problem is that I more or less forgot about the garbage collector here and is collecting memory inside the render target which is very very bad. Somehow the Mac version garbage collector is invoked more often or something I guess. Anyway there is probably mistakes like this all over the binding.
« Last Edit: May 01, 2012, 05:30:24 pm by Groogy »
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: rbSFML
« Reply #256 on: May 01, 2012, 07:55:57 pm »
Hmm ok. So I suppose I'll just have to wait for you to fix memory handling?
Maybe you could try to fix it for this instruction only so that we can check whether the issue is really related to the garbage collector.
Want to play movies in your SFML application? Check out sfeMovie!

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Re: rbSFML
« Reply #257 on: May 02, 2012, 03:51:27 pm »
I already did. Now I am just waiting for the next bug for you to find :D
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: rbSFML
« Reply #258 on: May 02, 2012, 03:54:55 pm »
The game is working fine now :D .
Want to play movies in your SFML application? Check out sfeMovie!

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Re: rbSFML
« Reply #259 on: May 02, 2012, 10:32:25 pm »
The game is working fine now :D .

Great! I hope you will try out Ruby and find all the bugs I have made in Mac ^^
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

vivo

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • Email
Re: rbSFML
« Reply #260 on: May 05, 2012, 01:29:02 am »
Hello Groogy, I've been asking for the code intelligence, you were right, the only way to get completions would be to create a pure ruby file that defined the classes/functions of the module.

http://support.activestate.com/node/8496#comment-21090

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Re: rbSFML
« Reply #261 on: May 05, 2012, 02:05:32 am »
Thought so.

The documentation is done with ruby files and contain all the information you need. So if you only can get the code intelligence tool to parse those files then you are good to go!
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

vivo

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • Email
Re: rbSFML
« Reply #262 on: May 11, 2012, 07:00:50 pm »
Hi. Not sure if it's an error, but when I try to get a Texture from a RenderTexture using getTexture i get:
undefined method `getTexture' for SFML::RenderTexture(500x300, 0x9a16848):SFML::RenderTexture (NoMethodError)

this is a piece of my code:
...
rendertexture = RenderTexture.new(500,300)
 #drawing the texture
showText("A RAGE Game",rendertexture)
texture.display
texture = rendertexture.getTexture
sprite = Sprite.new(texture)
...

 #draws a text in the window
        #default position is like a subtittle
        def showText(text, render = main_window, size = 50, color = Color::White, pos = nil)
                if(!pos)
                        pos = main_window.getSize/2
                        pos.y += 2*pos.y/3
                end
                txt = Text.new(text)
                #txt.setString(text)
                txt.setFont(main_font)
                txt.setCharacterSize(50)
                txt.setColor(color)
                txt.setPosition(pos)
                render.draw txt

        end

 

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Re: rbSFML
« Reply #263 on: May 12, 2012, 11:01:02 am »
That's a bug, I have somehow, I don't know how, missed the getTexture function. I'll add it as soon as I'm at a computer where I can.
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
Re: rbSFML
« Reply #264 on: May 12, 2012, 02:37:54 pm »
Alright fixed and updated the repo.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

vivo

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • Email
Re: rbSFML
« Reply #265 on: May 15, 2012, 08:58:39 pm »
Great Groogy
« Last Edit: May 15, 2012, 09:05:05 pm by vivo »

vivo

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • Email
Re: rbSFML
« Reply #266 on: May 15, 2012, 09:09:42 pm »
Have you tried the Font::loadFromFile method ?
Maybe it's because of my ATI card, but I get a seg fault  :-\

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Re: rbSFML
« Reply #267 on: May 15, 2012, 10:24:16 pm »
Was just the result of a stupid typo from me. It's fixed now.

I'm interested in seeing anything you are working on :)
« Last Edit: May 15, 2012, 10:33:29 pm by Groogy »
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

vivo

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • Email
Re: rbSFML
« Reply #268 on: May 19, 2012, 12:35:50 pm »
It's an adventure game engine (and a little sample game). Its taking longer than I expected, as soon as It will be able to display something near to a game I'll show you  ;D

vivo

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • Email
Re: rbSFML
« Reply #269 on: May 19, 2012, 08:57:23 pm »
Hi again Groogy, I can't use RenderWindow::getFrameTime wich should give me the time between frames 
« Last Edit: May 20, 2012, 01:47:44 am by vivo »