mirror of
https://github.com/Akomry/makeyourownapp-jam.git
synced 2025-12-06 08:43:54 +00:00
feat: début environnement graphique, dessin fonctionnel, sauvegarde et chargement temporaire possible
This commit is contained in:
parent
8af801e4fd
commit
70e583a380
6 changed files with 195 additions and 19 deletions
|
|
@ -0,0 +1,39 @@
|
|||
package fr.emiko.graphicsElement;
|
||||
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
import javafx.scene.shape.Path;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class Stroke {
|
||||
private final double fromX;
|
||||
private final double fromY;
|
||||
private final double toX;
|
||||
private final double toY;
|
||||
|
||||
public Stroke (double fromX, double fromY, double toX, double toY) {
|
||||
this.fromX = fromX;
|
||||
this.fromY = fromY;
|
||||
this.toX = toX;
|
||||
this.toY = toY;
|
||||
}
|
||||
|
||||
public void draw (GraphicsContext g) {
|
||||
// g.setStroke(javafx.scene.paint.Color.BLACK);
|
||||
// g.setLineWidth(1);
|
||||
// g.beginPath();
|
||||
// g.moveTo(fromX, fromY);
|
||||
// g.lineTo(toX, toY);
|
||||
// g.closePath();
|
||||
// g.stroke();
|
||||
// g.fill();
|
||||
|
||||
g.setFill(javafx.scene.paint.Color.BLACK);
|
||||
g.fillOval(toX-5, toY-5, 10, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString () {
|
||||
return "Stroke{fromX=%f, fromY=%f, toX=%f, toY=%f}".formatted(fromX, fromY, toX, toY);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue