refactor(all)
This commit is contained in:
28
src/ru/dmitriymx/game/engine/Sprite2.java
Normal file
28
src/ru/dmitriymx/game/engine/Sprite2.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user