Browsing: xna

 

XNA Skinned Model Animations

May 30, 2011 by Rew

The Skinned Model sample from the App Hub education catalogue is great for getting animated characters into your game, but there’s a bit of a flaw with the export process. The problem is, when you export your character from 3DS Max (and possibly other modelling programs), all you get is one animation, named ‘Take 001′. Wouldn’t it be nice if we could define different animations for different parts of the animation timeline? Well, we’re going to do just that :) . As an added bonus, we’ll also be adding in events, so you can be notified when certain parts of your animation are hit.

(more…)

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Google Bookmarks
  • FriendFeed
  • LinkedIn
  • Mixx
  • Sphinn
  • Blogplay
 

Texture Atlas (Sprite Sheet) Generator

March 20, 2010 by Rew

A texture atlas, or sprite sheet, is a single image containing a number of smaller textures or sprites. This is useful as it is more efficient for the graphics card to process (it doesn’t have to keep switching textures when drawing different textures, as it can just use the single texture and sample from different parts of it). It is also faster to load into RAM, as you are only loading in one image, as opposed to several smaller ones, so the loading can be done in one stage.

(more…)

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Google Bookmarks
  • FriendFeed
  • LinkedIn
  • Mixx
  • Sphinn
  • Blogplay
 

Windows Phone 7 Flashlight (With SOS)

March 19, 2010 by Rew

I tried posting this as a comment in reply to this post, but the code got mangled, so I’m posting it here :)

            graphics.GraphicsDevice.Clear(
                /* Check for touch panel being pressed */
            TouchPanel.GetState().Count == 0 ?
                /* Touch panel released, so reset the timer. This is stored in the target elapsed time, so we don't have to create any variables :) We also turn off IsFixedTimeStep, so that TargetElapsedTime isn't used. */
                ((((this.IsFixedTimeStep = false) == false) && ((this.TargetElapsedTime = TimeSpan.FromMilliseconds(Math.Max(1.0f, gameTime.TotalGameTime.TotalMilliseconds))) == TimeSpan.Zero)) ? Color.Gray : Color.Gray) :
                /* Touch panel pressed, so do SOS */
                (gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 1 ? Color.White :
                (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 2) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 3)) ? Color.White :
                (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 4) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 5)) ? Color.White :
                (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 7) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 9)) ? Color.White :
                (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 10) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 12)) ? Color.White :
                (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 13) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 15)) ? Color.White :
                (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 17) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 18)) ? Color.White :
                (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 19) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 20)) ? Color.White :
                (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 21) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 22)) ? Color.White :
                Color.Black);

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Twitter
  • Google Bookmarks
  • FriendFeed
  • LinkedIn
  • Mixx
  • Sphinn
  • Blogplay