June 2007 - Posts

XNA AnimatedTexture Class

If you've been trying to try out the XNA Tutorial on the documentation and could not seem to find the AnimatedTexture class, here it is! It's not part of the class library.

public class AnimatedTexture
{

private int framecount;
private Texture2D myTexture;
private float TimePerFrame;
private int Frame;
private float TotalElapsed;
private bool Paused;
public float Rotation, Scale, Depth;
public Vector2 Origin;

public AnimatedTexture(Vector2 Origin, float Rotation, float Scale, float Depth)
{

this.Origin = Origin;
this.Rotation = Rotation;
this.Scale = Scale;
this.Depth = Depth;

}

public void Load(GraphicsDevice device, ContentManager content, string asset, int FrameCount, int FramesPerSec)
{

framecount = FrameCount;
myTexture = content.Load<
Texture2D>(asset);
TimePerFrame = (
float)1 / FramesPerSec;
Frame = 0;
TotalElapsed = 0;
Paused =
false;

}

// class AnimatedTexture
public void UpdateFrame(float elapsed)
{

if (Paused)
return;

TotalElapsed += elapsed;

if (TotalElapsed > TimePerFrame)
{

Frame++;

// Keep the Frame between 0 and the total frames, minus one.
Frame = Frame % framecount;
TotalElapsed -= TimePerFrame;

}

}

// class AnimatedTexture
public void DrawFrame(SpriteBatch Batch, Vector2 screenpos)
{

DrawFrame(Batch, Frame, screenpos);

}

public void DrawFrame(SpriteBatch Batch, int Frame, Vector2 screenpos)
{

int FrameWidth = myTexture.Width / framecount;
Rectangle sourcerect = new Rectangle(FrameWidth * Frame, 0,
FrameWidth, myTexture.Height);
Batch.Draw(myTexture, screenpos, sourcerect,
Color.White,
Rotation, Origin, Scale,
SpriteEffects.None, Depth);

}

public bool IsPaused
{

get { return Paused; }

}

public void Reset()
{

Frame = 0;
TotalElapsed = 0f;

}

public void Stop()
{

Pause();
Reset();

}

public void Play()
{

Paused = false;

}

public void Pause()
{

Paused = true;

}

}

Posted by Technical Bits
Filed under:

Starhub dares to increase charges?

If I didn't hear wrongly, Starhub has announced that they're going to increase the charges for their services. Aww! They really have the guts eh! I've just switched over to Singnet 5mps today and it's so much faster then the starhub 10mps or something and guess what? This singnet plan's cheaper by 20 bucks somemore!

What are the folks at starhub thinking?

Posted by Technical Bits

Look for a new job!

Nope. I'm not talking about Steve Jobs! haha...

Just read this really interesting article from CIO.com, which gives a really nice insight on signs that you (if you're the CIO) should start looking for a new job! Indifferent

1. You report to the CFO now, not to the CEO. Once the CEO restructures and puts you under finance, he or she is sending a clear sign that IT is not strategic; it’s a cost center. Unless cutting budgets and watching your pennies is your thing, it is probably time to get out.

2. Your company is on the block. If the parent company announces its intention to sell your division, your future will most likely take one of three paths: 1) in the typical cost-cutting that happens before a sale, you will be asked to downsize your organization, 2) you will be asked to take a package and leave yourself, or 3) once the sale takes place, you will be replaced by the CIO of the acquiring company. Of course, it is possible that the sale of your division will provide new opportunities for you in the acquiring company, but it is better to have a job search under way as you wait to find out.

3. You’re a turnaround CIO in maintenance mode. When I talk with CIOs who are ready to make a move, I often hear them say, “I fixed everything and now I’m bored.” If you, like so many CIOs, are a change addict who gains gratification from bringing order to chaos, it is time to move on when you’ve steadied the ship and can put it on auto-pilot. In the best of circumstances, once you’ve turned around an organization, you are in a position to innovate and help grow the company. However, not every company can invest in enough technology-driven innovation to keep you challenged, and not every CIO can handle slow, incremental growth. If you love a big mess, go find another one.

4. You hate your new boss. In order to work effectively, members of a management team need to have some rapport. Chances are that you took the job–in part–because you were excited to work with the person hiring you. If that person leaves, and his or her replacement possesses characteristics and opinions that are anathema to your own, it may make sense to begin a job search. Perhaps you have thrived in a consensus-driven organization, and your new CEO’s command and control approach doesn’t work for you. As you spend the time doing your best to nurture the new relationship, you can evaluate new opportunities as they come along.

5. Your industry is failing. It is a courageous move to stay with a company that is dying but cannot reinvent itself to survive. You will gain valuable perspective, build character, and have enough lessons learned to fill a book. Once you’ve gained all that you can from helping a company try to survive in an industry that isn’t making it, you might consider moving to an industry in growth mode. (It’s much more fun.)

Read more at http://www.cio.com/article/116802/Five_Warning_Signs_It_s_Time_to_Look_for_a_New_Job

Posted by Technical Bits

Safari on Windows Beta 1

Apple has recently released the first ever version of the MAC browser, Safari for Windows XP and Vista (download). This is certainly good news for web-developers who want to test your web applications for the macintosh platform. Although it's quite neat, it still lacks many feature in this early stage.

Technical Bits on Safari

Technical Bits on IE 7

There's no status bar in Safari and scaling it could be a little confusing. Something I'm sure Apple's going to work on to fix.

Why Software Companies are Moving towards winning the browser?
Well, I guess this is a really simple question to answer. As we are moving towards an era where you at least use your browser once a day, winning over the browser, would allow the IT company to at least park some stuff on your computer, and that's definitely good! And as software is moving towards "Software as a Service" (SAAS v1) and "Software and a Service" (SAAS v2/ S+S), the importance of service is now something that many companies cannot ignore. So what's so good about service based approach? Well, at least it's not easy to pirate it?

Posted by Technical Bits

Technical Focus

Ok. Now finally after working in Microsoft Singapore for right about 1.5 months, I've finally been able to have great clarity on what technologies I would have to deal with. Haha...

In terms of work related stuff (means 8 hours x 5 days) I would be working on game development related technologies/topics such as

  • XNA Framework
  • Particle Physics
  • Algebraric Equations
  • DirectX
  • Maya

However, in my free time, I would certainly want to look at other technologies which would include

  • Software security (CAS, SD3C, Stagonography, RFID Timestamping)
  • Silverlight & XAML
  • Enterprise Application Development
  • Team Foundation Server
  • Ajax
  • PHP 5.0
  • C# 3.0
  • LinQ
  • C++
  • Web Services (Enhancements, Security, WCF)
  • Mobile Development (.NETCF, J2ME)

So if you happen to share the similiar interest, I would love to talk to u to see how we could adventure into this technical rollercoaster (you should know why) together. Big Smile

Posted by Technical Bits
Filed under: