30 lines
1.0 KiB
Java
30 lines
1.0 KiB
Java
package ProjectElectricLocomotive;
|
|
|
|
import java.awt.*;
|
|
|
|
public interface IDrawingWheels {
|
|
void SetWheelsCount(int wheelsCount);
|
|
|
|
WheelsCount GetWheelsCount();
|
|
|
|
// WheelsCount GetWheelsCount();
|
|
|
|
void DrawWheel(Graphics2D g2d, Color color, int x, int y, int w, int h);
|
|
|
|
default void DrawWheels(Graphics g, Color color, int startPosX, int startPosY, int drawingWidth, int drawingHeight){
|
|
WheelsCount wheelsCount = GetWheelsCount();
|
|
if(wheelsCount == null) return;
|
|
Graphics2D g2d = (Graphics2D) g;
|
|
int wheelWidth = 9;
|
|
int wheelHeight = 9;
|
|
|
|
if (wheelsCount.count >= wheelsCount.Three.count) {
|
|
DrawWheel(g2d, color, startPosX + 105, startPosY + 45, wheelWidth, wheelHeight);
|
|
}
|
|
if (wheelsCount.count >= wheelsCount.Four.count) {
|
|
DrawWheel(g2d, color, startPosX + 105, startPosY + 45, wheelWidth, wheelHeight);
|
|
DrawWheel(g2d, color, startPosX + 130, startPosY + 45, wheelWidth, wheelHeight);
|
|
}
|
|
}
|
|
}
|