using System;
using Microsoft.DirectX.DirectDraw;
using Global;
using Global.GlobalClass;
using KillerInstinct.DirectX;
using System.Drawing;
namespace KillerInstinct.Sprites{
public class DigitClass : SpriteClass
{
public DigitClass(string file, float x, float y)
{
frame.Width = 30;
frame.Height = 40;
framesCount = 10;
framesPerRow = 10;
whichFrame = 0;
layer = LAYER_TOP;
Init(file, CONST.COLORKEY_BLACK, x, y);
}
public void Draw(Surface dest, int digitCount, int num, string text, Color textColor, int textX, int textY)
{
int x = (int)posX;
string numStr = num.ToString().PadLeft(digitCount, '0');
if (text.CompareTo("") != 0)
{
global.DC.DrawText(textX, textY, text, textColor);
}
for (int i=0; i<digitCount; ++i)
{
whichFrame = ((int)(numStr[i]) - 48);
global.dbg.Out(Debug.DBG3, "Draw(whichFrame): " + whichFrame);
if ((whichFrame < 0) || (whichFrame > framesCount))
whichFrame = 0;
dest.DrawFast(x, (int)posY, surface, GetBitmapFrameRect(whichFrame), DrawFastFlags.Wait | DrawFastFlags.SourceColorKey);
x += 32;
}
}
public override void Update()
{
}
public override void ReactToCollision(SpriteClass s)
{
}
}
}
|