IronPythonでXNA

import clr

clr.AddReference('System')
clr.AddReference('Microsoft.Xna.Framework')
clr.AddReference('Microsoft.Xna.Framework.Game')

from System import *
from Microsoft.Xna.Framework import *
from Microsoft.Xna.Framework.Graphics import *

class Game1(Game):
    def __init__(self):
        self.graphics = GraphicsDeviceManager(self)

    def Initialize(self):
        self.spriteBatch = SpriteBatch(self.graphics.GraphicsDevice);

        Game.Initialize(self)

    def LoadGraphicsContent(self, loadAllContent):
        if (loadAllContent):
            self.texture = Texture2D.FromFile(self.graphics.GraphicsDevice, "../Content/Texture.png")

        Game.LoadGraphicsContent(self, loadAllContent)

    def Draw(self, gameTime):
        self.graphics.GraphicsDevice.Clear(Color.CornflowerBlue)

        self.spriteBatch.Begin()
        self.spriteBatch.Draw(self.texture, Vector2(0, 0), Color.White)
        self.spriteBatch.End()

        Game.Draw(self, gameTime)

Game1().Run()

IronPythonXNA
座標指定で画像(テクスチャー)を表示するだけのもの。基本的に基本のまま移植なんだけど一点、Content Pipelineなる仕組みを使ってないつーか使い方が良く分からないのでテクスチャーのロード部分がこんな感じになります。
あと継承してのスーパーなメソッド呼ぶ部分(Game.Draw(self, gameTime)とか)が警告になる。理由はしらね。


Pythonはあれだね、selfがうざいわ。インデントが有意なのはどうでもいいや。