29 lines
764 B
Java
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);
|
|
}
|
|
}
|