-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
small modifications to the SVGPaths creation
Adding a setting pane to be able to change language in game
- Loading branch information
1 parent
8f1dba3
commit bb7bfd1
Showing
16 changed files
with
304 additions
and
48 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/puzzlegame/puzzlescreen/puzzletable/puzzlepiece/svgpath/PuzzleLineDrawer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package puzzlegame.puzzlescreen.puzzletable.puzzlepiece.svgpath; | ||
|
||
import puzzlegame.puzzlescreen.puzzletable.Size; | ||
|
||
import java.util.Random; | ||
|
||
public class PuzzleLineDrawer extends LineDrawer{ | ||
|
||
private static final Random rand = new Random(); | ||
|
||
public PuzzleLineDrawer(Size size, Direction direction) { | ||
super(size, direction); | ||
|
||
commands.add(new Command(Operators.M, new SVGPoint(0,0))); | ||
|
||
double range = perpendicularSize(size, direction) * 0.2; | ||
double startPin = 0.2 + rand.nextDouble() * 0.6; | ||
|
||
// this is horizontal | ||
// M 0,0 C 10,0 10,10 100,-20 Q 150,-60 100,-100 T150,-150 T200,-100 Q150,-60 250,-20 C300,10 350,0 400,0 | ||
// M 0,0 L100,-20 Q 150,-60 100,-100 T150,-150 T200,-100 Q150,-60 250,-20 L400,0 | ||
|
||
|
||
// the line from the start of the piece to the start of the dent | ||
commands.add(new Command(Operators.L, markPoint(0, parallelSize(size, direction) * 0.3, direction))); | ||
|
||
// lower half of the left* half | ||
commands.add(new Command(Operators.Q, markPoint(perpendicularSize(size, direction) * 0.025, parallelSize(size, direction)* 0.4, direction), | ||
markPoint(perpendicularSize(size, direction) * 0.05, parallelSize(size, direction)* 0.25, direction))); | ||
|
||
//upper half of the left* half | ||
commands.add(new Command(Operators.T, markPoint(perpendicularSize(size, direction) * 0.15, parallelSize(size, direction)* 0.35, direction))); | ||
|
||
//upper half of the right* half | ||
commands.add(new Command(Operators.T, markPoint(perpendicularSize(size, direction) * 0.06, parallelSize(size, direction)* 0.30, direction))); | ||
|
||
// lower half of the right* half | ||
commands.add(new Command(Operators.Q, markPoint(perpendicularSize(size, direction) * 0.025, parallelSize(size, direction)* 0.3, direction), | ||
markPoint(0, parallelSize(size, direction)* 0.40, direction))); | ||
|
||
// the line from end of dent to the end of the piece | ||
commands.add((new Command(Operators.L, markPoint(0, parallelSize(size, direction),direction)))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,4 +71,4 @@ public SVGPath generatePath() { | |
path.setContent(svgPath); | ||
return path; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/puzzlegame/puzzlescreen/puzzletable/puzzlepiece/svgpath/SVGPointProperty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package puzzlegame.puzzlescreen.puzzletable.puzzlepiece.svgpath; | ||
|
||
import javafx.beans.property.DoubleProperty; | ||
import javafx.beans.property.ObjectPropertyBase; | ||
import javafx.beans.property.SimpleDoubleProperty; | ||
|
||
public class SVGPointProperty extends ObjectPropertyBase<SVGPointProperty> { | ||
|
||
private final DoubleProperty x; | ||
private final DoubleProperty y; | ||
|
||
public SVGPointProperty(double x, double y) { | ||
this.x = new SimpleDoubleProperty(x); | ||
this.y = new SimpleDoubleProperty(y); | ||
|
||
this.x.addListener((observable, oldValue, newValue) -> this.fireValueChangedEvent()); | ||
this.y.addListener((observable, oldValue, newValue) -> this.fireValueChangedEvent()); | ||
} | ||
|
||
|
||
/** | ||
* Returns the {@code Object} that contains this property. If this property | ||
* is not contained in an {@code Object}, {@code null} is returned. | ||
* | ||
* @return the containing {@code Object} or {@code null} | ||
*/ | ||
@Override | ||
public Object getBean() { | ||
return null; | ||
} | ||
|
||
/** | ||
* Returns the name of this property. If the property does not have a name, | ||
* this method returns an empty {@code String}. | ||
* | ||
* @return the name or an empty {@code String} | ||
*/ | ||
@Override | ||
public String getName() { | ||
return ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package puzzlegame.settingsdialog; | ||
|
||
import javafx.stage.Modality; | ||
import javafx.stage.Stage; | ||
import puzzlegame.PuzzleMain; | ||
|
||
public class SettingsDialog extends Stage { | ||
private final PuzzleMain puzzleGame; | ||
private final SettingsScene scene; | ||
|
||
|
||
public SettingsDialog(PuzzleMain mainWindow){ | ||
super(); | ||
puzzleGame = mainWindow; | ||
initOwner(mainWindow.getPrimaryStage()); | ||
initModality(Modality.WINDOW_MODAL); | ||
scene = new SettingsScene(this); | ||
setScene(scene); | ||
} | ||
|
||
public void showMe(){ | ||
scene.update(); | ||
show(); | ||
} | ||
} |
Oops, something went wrong.