[Ironruby-core] IronRuby and XNA. Super and Generics

Curt Hagenlocher curth at microsoft.com
Wed Nov 26 10:45:32 EST 2008


For the first problem, does it work if you just use "super" without any arguments?

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Dudu Baião
Sent: Tuesday, November 25, 2008 6:26 PM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] IronRuby and XNA. Super and Generics

Hi guys!

Im playing with XNA trying to run the simplest xna example: To show a
SpriteBatch on screen.

After some tests I found some problems:

1- The "Microsoft::Xna::Framework::Game" expects that we implement
some methods like "Update", "Drawn" etc, and inside the method we have
to call the base class (super) actual method passing some parameters.

If I try to do this:

    def update(game_time)
      super(game_time)
    end

I get this error:

my_game.rb:23:in `update': wrong number or type of arguments for
`update' (ArgumentError)
    from Snippets.scripting:0:in `Update'
    from Microsoft.Xna.Framework.Game:0:in `Run'
    from program.rb:23:in `main'
    from :0

2- XNA uses generic functions to load the game contents. How can I
convert the code above to IronRuby?

// This is a texture we can render.
Texture2D myTexture;

protected override void LoadContent()
{
    myTexture = Content.Load<Texture2D>("mytexture");
}

Can IronRuby consume generics?

Thanks!
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core



More information about the Ironruby-core mailing list