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

John Lam (IRONRUBY) jflam at microsoft.com
Tue Nov 25 23:11:43 EST 2008

We can't consume generic methods today. It's on the list of things to do though.

You can work around this by defining a concrete method in C# that calls the appropriate generic method and call the concrete method from IronRuby.


-----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)

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?

Ironruby-core mailing list
Ironruby-core at rubyforge.org

More information about the Ironruby-core mailing list