Thursday, 28 November 2013

XNA 2D game tutorial - animated sprite

1. Initialize state and time (continue from the XNA 2D games static sprite tutorial)

GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D character;
Vector2 position = new Vector2(200, 200);
Point frameSize = new Point(28, 41);
Point currentFrame = new Point(1, 0);
Point sheetSize = new Point(12, 8);
int state = 1; // 1 = walking state
TimeSpan nextFrameInterval = TimeSpan.FromSeconds((float)1 / 16);
public Game1()
{
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
           TargetElapsedTime = new TimeSpan(0, 0, 0 , 0, 100);
            // means, frame will be updated every 100ms.
  }

Sunday, 17 November 2013

Example of using PopupWindow

android.widget.PopupWindow can be used to display an arbitrary view. The popup windows is a floating container that appears on top of the current activity.

Example of PopupWindow