Archived
0

refactor(all)

This commit is contained in:
2013-10-28 18:12:15 +04:00
parent 2dd4d8929b
commit 58e3a123f3
7 changed files with 150 additions and 18 deletions

View File

@@ -0,0 +1,28 @@
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);
}
}