Fill screen around sniper aim
This commit is contained in:
parent
6ac559a635
commit
e032a9cba5
@ -9,6 +9,7 @@ import com.annimon.jecp.Image;
|
|||||||
public class SniperAim {
|
public class SniperAim {
|
||||||
|
|
||||||
private final Image aim;
|
private final Image aim;
|
||||||
|
private final int aimWidth, aimHeight;
|
||||||
private final int width, height;
|
private final int width, height;
|
||||||
private int x, y;
|
private int x, y;
|
||||||
|
|
||||||
@ -16,11 +17,20 @@ public class SniperAim {
|
|||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
aim = ImageLoader.load(ImageLoader.SNIPER_AIM);
|
aim = ImageLoader.load(ImageLoader.SNIPER_AIM);
|
||||||
x = (width - aim.getWidth()) / 2;
|
aimWidth = aim.getWidth();
|
||||||
y = (height - aim.getHeight()) / 2;
|
aimHeight = aim.getHeight();
|
||||||
|
x = (width - aimWidth) / 2;
|
||||||
|
y = (height - aimHeight) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Graphics g) {
|
public void draw(Graphics g) {
|
||||||
g.drawImage(aim, x, y);
|
g.drawImage(aim, x, y);
|
||||||
|
g.setColor(0xFF000000);
|
||||||
|
final int bottom = y + aimHeight;
|
||||||
|
g.fillRect(0, 0, width, y);
|
||||||
|
g.fillRect(0, bottom, width, height - bottom);
|
||||||
|
final int right = x + aim.getWidth();
|
||||||
|
g.fillRect(0, y, x, aimHeight);
|
||||||
|
g.fillRect(right, y, width - right, aimHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user