Add interface
This commit is contained in:
parent
41e6816ee5
commit
56c85de909
38
DrawningObjectPlane.java
Normal file
38
DrawningObjectPlane.java
Normal file
@ -0,0 +1,38 @@
|
||||
import java.awt.*;
|
||||
|
||||
public class DrawningObjectPlane implements IDrawningObject {
|
||||
private DrawningPlane _plane = null;
|
||||
|
||||
public DrawningObjectPlane(DrawningPlane plane)
|
||||
{
|
||||
_plane = plane;
|
||||
}
|
||||
|
||||
public float Step() {
|
||||
if(_plane != null && _plane.Plane != null)
|
||||
return _plane.Plane.Step;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SetObject(int x, int y, int width, int height) {
|
||||
_plane.SetPosition(x,y,width,height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void MoveObject(Direction direction) {
|
||||
_plane.MoveTransport(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void DrawingObject(Graphics g) {
|
||||
_plane.DrawTransport(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] GetCurrentPosition() {
|
||||
if(_plane!=null)
|
||||
return _plane.GetCurrentPosition();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -143,4 +143,13 @@ public class DrawningPlane extends JPanel {
|
||||
_startPosY = _pictureHeight - _PlaneHeight;
|
||||
}
|
||||
}
|
||||
|
||||
public float[] GetCurrentPosition() {
|
||||
float[] dim = new float[4];
|
||||
dim[0] = _startPosX;
|
||||
dim[1] =_startPosY;
|
||||
dim[2] = _startPosX + _PlaneWidth;
|
||||
dim[3] = _startPosY + _PlaneHeight;
|
||||
return dim;
|
||||
}
|
||||
}
|
||||
|
13
IDrawningObject.java
Normal file
13
IDrawningObject.java
Normal file
@ -0,0 +1,13 @@
|
||||
import java.awt.*;
|
||||
|
||||
public interface IDrawningObject {
|
||||
public float Step = 0;
|
||||
|
||||
void SetObject(int x, int y, int width, int height);
|
||||
|
||||
void MoveObject(Direction direction);
|
||||
|
||||
void DrawingObject(Graphics g);
|
||||
|
||||
float[] GetCurrentPosition();
|
||||
}
|
Loading…
Reference in New Issue
Block a user