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

Tomas Matousek Tomas.Matousek at microsoft.com
Wed Nov 26 14:04:54 EST 2008


I'm thinking of something like:

myTexture = content.load of(Texture2D), "mytexture"

I.e. we would add Kernel#of method that takes a list of classes/modules and returns a special object representing generic parameters that binder would use for selecting the right method.

We are open for more ideas.

Tomas

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Dudu Baião
Sent: Wednesday, November 26, 2008 10:49 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] IronRuby and XNA. Super and Generics

Thanks John!

I will do that.

Just for curiosity, what will be the syntax to call generic methods? :)


2008/11/26 John Lam (IRONRUBY) <jflam at microsoft.com>:
> 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.
>
> Thanks,
> -John
>
> -----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
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core



More information about the Ironruby-core mailing list