Merge branch 'master' of https://github.com/bokrosbalint/cicaprojekt
This commit is contained in:
commit
76dcbc7488
BIN
Jaffa_east.png
Normal file
BIN
Jaffa_east.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
Jaffa_west.png
Normal file
BIN
Jaffa_west.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 647 B |
BIN
ONeill_east.png
Normal file
BIN
ONeill_east.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
ONeill_west.png
Normal file
BIN
ONeill_west.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
Replicator_east.png
Normal file
BIN
Replicator_east.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
Replicator_west.png
Normal file
BIN
Replicator_west.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -1,10 +1,27 @@
|
|||||||
package cicaprojekt;
|
package cicaprojekt;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public interface Drawer {
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
public abstract class Drawer {
|
||||||
|
private BufferedImage image;
|
||||||
|
|
||||||
|
public Drawer(String path) throws IOException {
|
||||||
|
image = ImageIO.read(new File(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeImage(String path) throws IOException {
|
||||||
|
image = ImageIO.read(new File(path));
|
||||||
|
}
|
||||||
|
|
||||||
public void draw() throws IOException;
|
public BufferedImage getImage() {
|
||||||
public int getTileX();
|
return image;
|
||||||
public int getTileY();
|
}
|
||||||
|
|
||||||
|
public abstract void draw() throws IOException;
|
||||||
|
public abstract int getTileX();
|
||||||
|
public abstract int getTileY();
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,12 @@ package cicaprojekt;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class FieldDrawer extends ImagePanel implements Drawer {
|
public class FieldDrawer extends Drawer {
|
||||||
|
|
||||||
Field field;
|
Field field;
|
||||||
|
|
||||||
public FieldDrawer(Field f) throws IOException {
|
public FieldDrawer(Field f) throws IOException {
|
||||||
super("Field.png");
|
super("Field.png");
|
||||||
field = f;
|
field = f;
|
||||||
setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -21,7 +19,6 @@ public class FieldDrawer extends ImagePanel implements Drawer {
|
|||||||
else
|
else
|
||||||
changeImage("Field.png");
|
changeImage("Field.png");
|
||||||
|
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,19 +2,17 @@ package cicaprojekt;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class GapDrawer extends ImagePanel implements Drawer{
|
public class GapDrawer extends Drawer{
|
||||||
|
|
||||||
private Gap gap;
|
private Gap gap;
|
||||||
|
|
||||||
public GapDrawer(Gap g) throws IOException {
|
public GapDrawer(Gap g) throws IOException {
|
||||||
super("Gap.png");
|
super("Gap.png");
|
||||||
gap = g;
|
gap = g;
|
||||||
setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw() {
|
public void draw() {
|
||||||
setVisible(true);
|
//TODO kezdeni ezzel valamit.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,14 +2,12 @@ package cicaprojekt;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class GateDrawer extends ImagePanel implements Drawer{
|
public class GateDrawer extends Drawer{
|
||||||
|
|
||||||
Gate gate;
|
Gate gate;
|
||||||
|
|
||||||
public GateDrawer(Gate g) throws IOException {
|
public GateDrawer(Gate g) throws IOException {
|
||||||
super("ClosedGate.png");
|
super("ClosedGate.png");
|
||||||
gate = g;
|
gate = g;
|
||||||
setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -17,9 +15,7 @@ public class GateDrawer extends ImagePanel implements Drawer{
|
|||||||
if(gate.isOpen())
|
if(gate.isOpen())
|
||||||
changeImage("Field.png"); //TODO picture for open gate.
|
changeImage("Field.png"); //TODO picture for open gate.
|
||||||
else
|
else
|
||||||
changeImage("ClosedGate.png");
|
changeImage("ClosedGate.png");
|
||||||
|
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
package cicaprojekt;
|
|
||||||
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
|
|
||||||
public class ImagePanel extends JPanel{
|
|
||||||
|
|
||||||
private BufferedImage image;
|
|
||||||
|
|
||||||
public ImagePanel(String path) throws IOException {
|
|
||||||
image = ImageIO.read(new File(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void paintComponent(Graphics g) {
|
|
||||||
super.paintComponent(g);
|
|
||||||
g.drawImage(image, 0, 0, null); // see javadoc for more info on the parameters
|
|
||||||
}
|
|
||||||
|
|
||||||
public void changeImage(String path) throws IOException {
|
|
||||||
image = ImageIO.read(new File(path));
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,13 +2,12 @@ package cicaprojekt;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class PlayerBaseDrawer extends ImagePanel implements Drawer {
|
public class PlayerBaseDrawer extends Drawer {
|
||||||
PlayerBase playerbase;
|
PlayerBase playerbase;
|
||||||
|
|
||||||
public PlayerBaseDrawer(PlayerBase pb) throws IOException {
|
public PlayerBaseDrawer(PlayerBase pb) throws IOException {
|
||||||
super("Replicator.png");
|
super("Replicator.png");
|
||||||
playerbase = pb;
|
playerbase = pb;
|
||||||
setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -33,7 +32,6 @@ public class PlayerBaseDrawer extends ImagePanel implements Drawer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,13 +2,12 @@ package cicaprojekt;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class PlayerDrawer extends ImagePanel implements Drawer {
|
public class PlayerDrawer extends Drawer {
|
||||||
Player player;
|
Player player;
|
||||||
|
|
||||||
public PlayerDrawer(Player p) throws IOException {
|
public PlayerDrawer(Player p) throws IOException {
|
||||||
super("ONeill.png");
|
super("ONeill.png");
|
||||||
player = p;
|
player = p;
|
||||||
setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -49,9 +48,7 @@ public class PlayerDrawer extends ImagePanel implements Drawer {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,14 +2,12 @@ package cicaprojekt;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class ScaleDrawer extends ImagePanel implements Drawer {
|
public class ScaleDrawer extends Drawer {
|
||||||
|
|
||||||
Scale scale;
|
Scale scale;
|
||||||
|
|
||||||
public ScaleDrawer(Scale s) throws IOException {
|
public ScaleDrawer(Scale s) throws IOException {
|
||||||
super("Scale.png");
|
super("Scale.png");
|
||||||
scale = s;
|
scale = s;
|
||||||
setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -19,7 +17,6 @@ public class ScaleDrawer extends ImagePanel implements Drawer {
|
|||||||
else
|
else
|
||||||
changeImage("Scale.png");
|
changeImage("Scale.png");
|
||||||
|
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,14 +2,12 @@ package cicaprojekt;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class WallDrawer extends ImagePanel implements Drawer {
|
public class WallDrawer extends Drawer {
|
||||||
|
|
||||||
Wall wall;
|
Wall wall;
|
||||||
|
|
||||||
public WallDrawer(Wall w) throws IOException {
|
public WallDrawer(Wall w) throws IOException {
|
||||||
super("Wall.png");
|
super("Wall.png");
|
||||||
wall = w;
|
wall = w;
|
||||||
setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -34,9 +32,7 @@ public class WallDrawer extends ImagePanel implements Drawer {
|
|||||||
changeImage("Wall.png");
|
changeImage("Wall.png");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user