mirror of
https://github.com/klmp200/sarl-fireworks.git
synced 2024-11-21 14:23:19 +00:00
Complete refactoring of the project and renaming packages
This commit is contained in:
parent
77013351d9
commit
01b4d82989
21
.gitignore
vendored
Normal file
21
.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
# Xtext generated files
|
||||||
|
src/main/generated-sources/
|
||||||
|
|
||||||
|
# NetBean / Eclipse
|
||||||
|
bin/
|
||||||
|
**/*.java._trace
|
||||||
|
**/*.java_trace
|
||||||
|
**/*.smap
|
||||||
|
**/.project
|
||||||
|
**/.classpath
|
||||||
|
**/.settings
|
||||||
|
**/.metadata
|
||||||
|
|
||||||
|
# Subversion and CVS
|
||||||
|
**/.svn/
|
||||||
|
**/.cvs/
|
||||||
|
|
||||||
|
# Maven
|
||||||
|
target/
|
||||||
|
|
@ -1,41 +1,11 @@
|
|||||||
package io.sarl.demos.fireworks
|
package io.sarl.demos.fireworks
|
||||||
|
|
||||||
import io.janusproject.Boot
|
import io.janusproject.Boot
|
||||||
|
import io.sarl.demos.fireworks.agents.LaunchingArea
|
||||||
|
import io.sarl.demos.fireworks.gui.FXMLViewerController
|
||||||
|
|
||||||
import static io.janusproject.Boot.*
|
import static io.janusproject.Boot.*
|
||||||
|
|
||||||
event Launch
|
|
||||||
event CreateArea
|
|
||||||
event Explode
|
|
||||||
event KillRocket
|
|
||||||
event KillFire
|
|
||||||
event RocketReady
|
|
||||||
event UpdateRocketPosition
|
|
||||||
event UpdateFirePosition
|
|
||||||
event FireReady
|
|
||||||
event SprayFire
|
|
||||||
event Exit
|
|
||||||
|
|
||||||
event Freeze {
|
|
||||||
var value: boolean
|
|
||||||
new (value: boolean){
|
|
||||||
this.value = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
event SetupSettings {
|
|
||||||
var rocketsQuantity: Integer
|
|
||||||
var fireQuatity: Integer
|
|
||||||
var gravity: Double
|
|
||||||
var maxWidth: Double
|
|
||||||
new(rq: Integer, fq: Integer, grav: Double, max: Double){
|
|
||||||
rocketsQuantity = rq
|
|
||||||
fireQuatity = fq
|
|
||||||
gravity = grav
|
|
||||||
maxWidth = max
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Firework {
|
class Firework {
|
||||||
static def main(controller: FXMLViewerController) {
|
static def main(controller: FXMLViewerController) {
|
||||||
Boot::offline = true
|
Boot::offline = true
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<?import java.lang.*?>
|
<?import java.lang.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="608.0" prefWidth="933.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="io.sarl.demos.fireworks.FXMLViewerController">
|
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="608.0" prefWidth="933.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="io.sarl.demos.fireworks.gui.FXMLViewerController">
|
||||||
<children>
|
<children>
|
||||||
<Canvas fx:id="draw_zone" height="583.0" layoutX="199.0" layoutY="13.0" rotate="180.0" width="715.0" />
|
<Canvas fx:id="draw_zone" height="583.0" layoutX="199.0" layoutY="13.0" rotate="180.0" width="715.0" />
|
||||||
<Button fx:id="setup_button" layoutX="26.0" layoutY="45.0" mnemonicParsing="false" onAction="#actionSetup" text="Setup" />
|
<Button fx:id="setup_button" layoutX="26.0" layoutY="45.0" mnemonicParsing="false" onAction="#actionSetup" text="Setup" />
|
@ -2,6 +2,7 @@ package io.sarl.demos.fireworks;
|
|||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
import io.sarl.demos.fireworks.gui.FXMLViewerController;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.fxml.JavaFXBuilderFactory;
|
import javafx.fxml.JavaFXBuilderFactory;
|
||||||
@ -9,13 +10,13 @@ import javafx.scene.Parent;
|
|||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public class Viewer extends Application {
|
public class FireworksFXApplication extends Application {
|
||||||
|
|
||||||
private FXMLLoader loader;
|
private FXMLLoader loader;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage stage) throws Exception {
|
public void start(Stage stage) throws Exception {
|
||||||
URL location = getClass().getResource("viewer.fxml");
|
URL location = getClass().getResource("FireworksFXApplication.fxml");
|
||||||
loader = new FXMLLoader();
|
loader = new FXMLLoader();
|
||||||
loader.setLocation(location);
|
loader.setLocation(location);
|
||||||
loader.setBuilderFactory(new JavaFXBuilderFactory());
|
loader.setBuilderFactory(new JavaFXBuilderFactory());
|
@ -1,4 +1,4 @@
|
|||||||
package io.sarl.demos.fireworks
|
package io.sarl.demos.fireworks.agents
|
||||||
|
|
||||||
import java.util.HashMap
|
import java.util.HashMap
|
||||||
import java.util.List
|
import java.util.List
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
package io.sarl.demos.fireworks
|
package io.sarl.demos.fireworks.agents
|
||||||
|
|
||||||
import io.sarl.core.AgentTask
|
import io.sarl.core.AgentTask
|
||||||
import io.sarl.core.Behaviors
|
import io.sarl.core.Behaviors
|
||||||
import io.sarl.core.DefaultContextInteractions
|
import io.sarl.core.DefaultContextInteractions
|
||||||
import io.sarl.core.ExternalContextAccess
|
|
||||||
import io.sarl.core.Initialize
|
import io.sarl.core.Initialize
|
||||||
import io.sarl.core.Lifecycle
|
import io.sarl.core.Lifecycle
|
||||||
import io.sarl.core.Logging
|
import io.sarl.core.Logging
|
||||||
import io.sarl.core.Schedules
|
import io.sarl.core.Schedules
|
||||||
import io.sarl.core.Time
|
import io.sarl.demos.fireworks.events.Exit
|
||||||
|
import io.sarl.demos.fireworks.events.FireReady
|
||||||
|
import io.sarl.demos.fireworks.events.Freeze
|
||||||
|
import io.sarl.demos.fireworks.events.UpdateFirePosition
|
||||||
import io.sarl.util.Scopes
|
import io.sarl.util.Scopes
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import java.util.List
|
import java.util.List
|
||||||
@ -16,7 +18,7 @@ import java.util.UUID
|
|||||||
import java.util.Vector
|
import java.util.Vector
|
||||||
|
|
||||||
agent Fire {
|
agent Fire {
|
||||||
uses Lifecycle, Logging, Behaviors, DefaultContextInteractions, ExternalContextAccess, Schedules, Time
|
uses Lifecycle, Logging, Behaviors, DefaultContextInteractions, Schedules
|
||||||
|
|
||||||
var x: List<Double>
|
var x: List<Double>
|
||||||
var y: List<Double>
|
var y: List<Double>
|
@ -1,19 +1,24 @@
|
|||||||
package io.sarl.demos.fireworks
|
package io.sarl.demos.fireworks.agents
|
||||||
|
|
||||||
import io.sarl.core.Behaviors
|
import io.sarl.core.Behaviors
|
||||||
import io.sarl.core.DefaultContextInteractions
|
import io.sarl.core.DefaultContextInteractions
|
||||||
import io.sarl.core.ExternalContextAccess
|
|
||||||
import io.sarl.core.Initialize
|
import io.sarl.core.Initialize
|
||||||
import io.sarl.core.InnerContextAccess
|
import io.sarl.core.InnerContextAccess
|
||||||
import io.sarl.core.Lifecycle
|
import io.sarl.core.Lifecycle
|
||||||
import io.sarl.core.Logging
|
import io.sarl.core.Logging
|
||||||
import io.sarl.core.MemberJoined
|
import io.sarl.core.MemberJoined
|
||||||
|
import io.sarl.demos.fireworks.events.CreateArea
|
||||||
|
import io.sarl.demos.fireworks.events.Exit
|
||||||
|
import io.sarl.demos.fireworks.events.Freeze
|
||||||
|
import io.sarl.demos.fireworks.events.Launch
|
||||||
|
import io.sarl.demos.fireworks.events.SetupSettings
|
||||||
|
import io.sarl.demos.fireworks.gui.FXMLViewerController
|
||||||
import io.sarl.util.OpenEventSpaceSpecification
|
import io.sarl.util.OpenEventSpaceSpecification
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
agent LaunchingArea {
|
agent LaunchingArea {
|
||||||
uses DefaultContextInteractions, Lifecycle, Behaviors, Logging, InnerContextAccess, ExternalContextAccess
|
uses DefaultContextInteractions, Lifecycle, Behaviors, Logging, InnerContextAccess
|
||||||
|
|
||||||
var rocketsQuantity: Integer
|
var rocketsQuantity: Integer
|
||||||
var fireQuantity: Integer
|
var fireQuantity: Integer
|
@ -1,9 +1,8 @@
|
|||||||
package io.sarl.demos.fireworks
|
package io.sarl.demos.fireworks.agents
|
||||||
|
|
||||||
import io.sarl.core.AgentTask
|
import io.sarl.core.AgentTask
|
||||||
import io.sarl.core.Behaviors
|
import io.sarl.core.Behaviors
|
||||||
import io.sarl.core.DefaultContextInteractions
|
import io.sarl.core.DefaultContextInteractions
|
||||||
import io.sarl.core.ExternalContextAccess
|
|
||||||
import io.sarl.core.Initialize
|
import io.sarl.core.Initialize
|
||||||
import io.sarl.core.InnerContextAccess
|
import io.sarl.core.InnerContextAccess
|
||||||
import io.sarl.core.Lifecycle
|
import io.sarl.core.Lifecycle
|
||||||
@ -11,13 +10,18 @@ import io.sarl.core.Logging
|
|||||||
import io.sarl.core.MemberJoined
|
import io.sarl.core.MemberJoined
|
||||||
import io.sarl.core.MemberLeft
|
import io.sarl.core.MemberLeft
|
||||||
import io.sarl.core.Schedules
|
import io.sarl.core.Schedules
|
||||||
|
import io.sarl.demos.fireworks.events.Exit
|
||||||
|
import io.sarl.demos.fireworks.events.Explode
|
||||||
|
import io.sarl.demos.fireworks.events.FireReady
|
||||||
|
import io.sarl.demos.fireworks.events.Freeze
|
||||||
|
import io.sarl.demos.fireworks.events.UpdateRocketPosition
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
import java.util.Vector
|
import java.util.Vector
|
||||||
|
|
||||||
agent Rocket {
|
agent Rocket {
|
||||||
|
|
||||||
uses Lifecycle, Logging, Schedules, Behaviors, DefaultContextInteractions, InnerContextAccess, ExternalContextAccess
|
uses Lifecycle, Logging, Schedules, Behaviors, DefaultContextInteractions, InnerContextAccess
|
||||||
var x : Double
|
var x : Double
|
||||||
var y : Double
|
var y : Double
|
||||||
var gravity : Double
|
var gravity : Double
|
@ -1,23 +1,20 @@
|
|||||||
package io.sarl.demos.fireworks
|
package io.sarl.demos.fireworks.agents
|
||||||
|
|
||||||
import io.sarl.core.Behaviors
|
import io.sarl.core.Behaviors
|
||||||
import io.sarl.core.DefaultContextInteractions
|
import io.sarl.core.DefaultContextInteractions
|
||||||
import io.sarl.core.ExternalContextAccess
|
|
||||||
import io.sarl.core.Initialize
|
import io.sarl.core.Initialize
|
||||||
import io.sarl.core.InnerContextAccess
|
import io.sarl.core.InnerContextAccess
|
||||||
import io.sarl.core.Lifecycle
|
import io.sarl.core.Lifecycle
|
||||||
import io.sarl.core.Logging
|
import io.sarl.core.Logging
|
||||||
import io.sarl.core.MemberLeft
|
import io.sarl.core.MemberLeft
|
||||||
import io.sarl.demos.fireworks.Exit
|
import io.sarl.demos.fireworks.events.Exit
|
||||||
import io.sarl.demos.fireworks.Freeze
|
import io.sarl.demos.fireworks.events.Freeze
|
||||||
import io.sarl.demos.fireworks.Launch
|
import io.sarl.demos.fireworks.events.Launch
|
||||||
import io.sarl.demos.fireworks.Positions
|
import io.sarl.demos.fireworks.events.RocketReady
|
||||||
import io.sarl.demos.fireworks.Rocket
|
|
||||||
import io.sarl.demos.fireworks.RocketReady
|
|
||||||
|
|
||||||
agent RocketLauncher {
|
agent RocketLauncher {
|
||||||
|
|
||||||
uses Logging, Behaviors, DefaultContextInteractions, InnerContextAccess, Lifecycle, ExternalContextAccess
|
uses Logging, Behaviors, DefaultContextInteractions, InnerContextAccess, Lifecycle
|
||||||
|
|
||||||
var x: Double
|
var x: Double
|
||||||
var y: Double
|
var y: Double
|
49
src/main/sarl/io/sarl/demos/fireworks/events/events.sarl
Normal file
49
src/main/sarl/io/sarl/demos/fireworks/events/events.sarl
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package io.sarl.demos.fireworks.events
|
||||||
|
|
||||||
|
event Launch
|
||||||
|
|
||||||
|
event CreateArea
|
||||||
|
|
||||||
|
event Explode
|
||||||
|
|
||||||
|
event KillRocket
|
||||||
|
|
||||||
|
event KillFire
|
||||||
|
|
||||||
|
event RocketReady
|
||||||
|
|
||||||
|
event UpdateRocketPosition
|
||||||
|
|
||||||
|
event UpdateFirePosition
|
||||||
|
|
||||||
|
event FireReady
|
||||||
|
|
||||||
|
event SprayFire
|
||||||
|
|
||||||
|
event Exit
|
||||||
|
|
||||||
|
event SetupSettings {
|
||||||
|
var rocketsQuantity : Integer
|
||||||
|
var fireQuatity : Integer
|
||||||
|
var gravity : Double
|
||||||
|
var maxWidth : Double
|
||||||
|
|
||||||
|
new(rq : Integer, fq : Integer, grav : Double, max : Double) {
|
||||||
|
rocketsQuantity = rq
|
||||||
|
fireQuatity = fq
|
||||||
|
gravity = grav
|
||||||
|
maxWidth = max
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
event Freeze {
|
||||||
|
var value : boolean
|
||||||
|
|
||||||
|
new (value : boolean) {
|
||||||
|
this.value = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
|||||||
package io.sarl.demos.fireworks;
|
package io.sarl.demos.fireworks.gui;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import io.sarl.demos.fireworks.Firework;
|
||||||
|
import io.sarl.demos.fireworks.agents.Positions;
|
||||||
|
import io.sarl.demos.fireworks.events.CreateArea;
|
||||||
|
import io.sarl.demos.fireworks.events.Exit;
|
||||||
|
import io.sarl.demos.fireworks.events.Freeze;
|
||||||
|
import io.sarl.demos.fireworks.events.SetupSettings;
|
||||||
import io.sarl.lang.core.Event;
|
import io.sarl.lang.core.Event;
|
||||||
import io.sarl.lang.core.EventListener;
|
import io.sarl.lang.core.EventListener;
|
||||||
import io.sarl.util.OpenEventSpace;
|
import io.sarl.util.OpenEventSpace;
|
Loading…
Reference in New Issue
Block a user