private MyApplication() { //setup gameWindow = new GameWindow(700, 700); gameWindow.KeyDown += (s, arg) => gameWindow.Close(); gameWindow.Resize += (s, arg) => GL.Viewport(0, 0, gameWindow.Width, gameWindow.Height); gameWindow.RenderFrame += GameWindow_RenderFrame; gameWindow.RenderFrame += (s, arg) => gameWindow.SwapBuffers(); //animation using a single SpriteSheet explosion = new SpriteSheetAnimation(new SpriteSheet(TextureLoader.FromBitmap(Resourcen.explosion), 5), 0, 24, 1); //animation using a bitmap for each frame alienShip = new AnimationTextures(.5f); //art from http://millionthvector.blogspot.de/p/free-sprites.html alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10001)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10002)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10003)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10004)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10005)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10006)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10007)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10008)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10009)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10010)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10011)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10012)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10013)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10014)); alienShip.AddFrame(TextureLoader.FromBitmap(Resourcen.alien10015)); //for transparency in textures GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); //start game time timeSource.Start(); }
public AnimatedSprite(Texture tex, Box2D extents, IAnimation animation) { this.spriteSheet = new SpriteSheetAnimation(new SpriteSheet(tex, 5), 0, 24, animation.Length); this.Rect = extents; this.Animation = animation; }