public NumberBlit(BitmapData spriteSheet, Rectangle rect, int digits = 1, double step = 0.25, int dx = 0, int dy = 0, int spacing = 0, int stepY = 0) : base(spriteSheet, rect, dx, dy) { this.height = height; this.digits = digits; this.step = step; if (stepY > 0) { this.stepY = stepY; } else { this.stepY = (int)rect.width; } if (spacing > 0) { this.spacing = spacing; } else { this.spacing = (int)rect.width; } sourceY = (int)rect.y; drums = new Array <double>(new double [digits]); this.rect = new Rectangle(rect.x, rect.y, spacing, spacing + 1); }
public void renderPreview(Library.LevelData obj, double x, double y, BitmapData target) { BitmapData bitmapData = Level.getLevelBitmapData(obj.map, Level.ROOM_WIDTH, Level.ROOM_HEIGHT); var p = new Point(x, y); target.copyPixels(bitmapData, bitmapData.rect, p); }
// I really did just type that out instead of wasting cpu on an automata or bothering to write a nifty bit // of code that would auto-generate it, figuring it out would have taken just as long // what makes this worse is that I realised I'd counted the pixels backwards and had to swap it around // for the sanity of the code. Oh, you want to change the player's graphics? Have fun. public FoodClockFX(BlitSprite blit, uint deadCol) { this.blit = blit; spriteSheet = blit.spriteSheet; this.deadCol = deadCol; food = maxFood = pixels.length - 1; col = spriteSheet.getPixel32((int)blit.rect.x, (int)blit.rect.y); }
public void render(BitmapData bitmapData) { blit.x = (int)x; blit.y = (int)y; if (states) { frame = over ? 1 : 0; frame += active ? 2 : 0; } blit.render(bitmapData, frame); }
public void render(BitmapData bitmapData) { for (i = 0; i < buttons.length; i++) { button = buttons[i]; if (button.visible) { button.render(bitmapData); } } }
public FadingBlitRect(int dx = 0, int dy = 0, int width = 1, int height = 1, int totalFrames = 1, uint col = 0xFF000000) : base(dx, dy, width, height, col) { frames = new Array <BitmapData>(new BitmapData[totalFrames]); this.totalFrames = totalFrames; int step = 255 / totalFrames; for (int i = 0; i < totalFrames; i++) { frames[i] = new BitmapData(width, height, true, (uint)(col - 0x01000000 * i * step)); } }
public void renderNumbers(BitmapData bitmapData) { double yTemp = y; Rectangle rectTemp = rect.clone(); for (i = 0; i < digits; i++) { rect.y = sourceY + drums[i] * stepY; render(bitmapData); x += spacing; } rect = rectTemp; }
public void apply(BitmapData target, int offsetX = 0, int offsetY = 0) { rect.y = 0; rect.width = 1; rect.height = target.height; for (i = cols.length - 1; i > -1; i--) { g = cols[i]; rect.x = p.x = g.x + offsetX; p.y = g.y; target.copyPixels(target, rect, p); } rect.x = 0; rect.width = target.width; rect.height = 1; for (i = rows.length - 1; i > -1; i--) { g = rows[i]; rect.y = p.y = g.y + offsetY; p.x = g.x; target.copyPixels(target, rect, p); } }
override public void render(BitmapData destination, int frame = 0) { p.x = x + dx; p.y = y + dy; destination.copyPixels(spriteSheet, rect, p, null, null, true); }
public BlitSprite(BitmapData spriteSheet, Rectangle rect, int dx = 0, int dy = 0) : base(dx, dy, (int)rect.width, (int)rect.height) { this.spriteSheet = spriteSheet; this.rect = rect; }
public virtual void render(BitmapData destination, int frame = 0) { rect.x = x + dx; rect.y = y + dy; destination.fillRect(rect, col); }