Archived
0
This repository has been archived on 2022-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
the-game-old/src/ru/dmitriymx/game/engine/Sprite2.java
2013-10-31 01:00:12 +04:00

29 lines
764 B
Java

package ru.dmitriymx.game.engine;
import java.awt.image.BufferedImage;
import java.io.InputStream;
public class Sprite2 extends Texture {
private int width_frame, height_frame;
private int count_frames;
private int[][] frames_coords;
private void prepare_sprite(int width, int height) {
width_frame = width;
height_frame = height;
count_frames = (int) (Math.floor(this.getWidth() / width_frame) * Math.floor(this.getHeight() / height_frame));
frames_coords = new int[4][count_frames];
}
public Sprite2(BufferedImage image, int width, int height) {
super(image);
prepare_sprite(width, height);
}
public Sprite2(InputStream stream, int width, int height) {
super(stream);
prepare_sprite(width, height);
}
}