diff --git a/OutlawEditor/src/main/deploy/package/macosx/OutlawEditor.icns b/OutlawEditor/src/main/deploy/package/macosx/OutlawEditor.icns index 0b67b26d..46b713c6 100644 Binary files a/OutlawEditor/src/main/deploy/package/macosx/OutlawEditor.icns and b/OutlawEditor/src/main/deploy/package/macosx/OutlawEditor.icns differ diff --git a/OutlawEditor/src/main/java/org/badvision/outlaweditor/MapEditor.java b/OutlawEditor/src/main/java/org/badvision/outlaweditor/MapEditor.java index 3ed7aed8..479c1177 100644 --- a/OutlawEditor/src/main/java/org/badvision/outlaweditor/MapEditor.java +++ b/OutlawEditor/src/main/java/org/badvision/outlaweditor/MapEditor.java @@ -16,6 +16,7 @@ import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.effect.DropShadow; +import javafx.scene.effect.Glow; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.image.WritableImage; @@ -128,10 +129,15 @@ public class MapEditor extends Editor implements EventH }); drawCanvas.addEventFilter(ScrollEvent.ANY, scrollHandler); drawCanvas.setOnMousePressed(this); + drawCanvas.setOnMouseMoved(this); drawCanvas.setOnMouseDragged(this); drawCanvas.setOnMouseDragReleased(this); drawCanvas.setOnMouseReleased(this); anchorPane.getChildren().add(0, drawCanvas); + cursorAssistant = new Rectangle(tileWidth, tileHeight, new Color(0.2,0.2,1.0,0.4)); + cursorAssistant.setMouseTransparent(true); + cursorAssistant.setEffect(new Glow(1.0)); + anchorPane.getChildren().add(cursorAssistant); } @Override @@ -215,14 +221,9 @@ public class MapEditor extends Editor implements EventH @Override public void redraw() { redrawRequested = System.nanoTime(); - if (redrawThread == null || redrawThread.isAlive()) { + if (redrawThread == null || !redrawThread.isAlive()) { redrawThread = new Thread(() -> { - long test = redrawRequested; - try { - Thread.sleep(10); - } catch (InterruptedException ex) { - Logger.getLogger(MapEditor.class.getName()).log(Level.SEVERE, null, ex); - } + long test = 0; while (test != redrawRequested) { test = redrawRequested; try { @@ -447,6 +448,17 @@ public class MapEditor extends Editor implements EventH setSelectionArea(0, 0, 0, 0); } + Rectangle cursorAssistant; + private void updateCursorAssistant(MouseEvent t) { + if (t.getEventType() == MouseEvent.MOUSE_EXITED) { + cursorAssistant.setVisible(false); + } else { + cursorAssistant.setVisible(true); + cursorAssistant.setTranslateX(t.getX() - (t.getX() % tileWidth)); + cursorAssistant.setTranslateY(t.getY() - (t.getY() % tileHeight)); + } + } + public static enum DrawMode { Pencil1px, Pencil3px, Pencil5px, FilledRect, Eraser @@ -531,8 +543,9 @@ public class MapEditor extends Editor implements EventH @Override public void handle(MouseEvent t) { + updateCursorAssistant(t); + if (!t.isPrimaryButtonDown() && drawMode != DrawMode.FilledRect && t.getEventType() != MouseEvent.MOUSE_RELEASED) return; if (getCurrentTile() == null && drawMode != DrawMode.Eraser) { - System.out.println("No tile selected, ignoring"); return; } t.consume(); @@ -576,7 +589,7 @@ public class MapEditor extends Editor implements EventH case FilledRect: if (t.getEventType().equals(MouseEvent.MOUSE_RELEASED)) { fillSelection(t.getX(), t.getY()); - } else { + } else if (t.isPrimaryButtonDown()) { updateSelection(t.getX(), t.getY()); } } diff --git a/OutlawEditor/src/main/java/org/badvision/outlaweditor/data/TileMap.java b/OutlawEditor/src/main/java/org/badvision/outlaweditor/data/TileMap.java index bbe2a744..1cfc3c63 100644 --- a/OutlawEditor/src/main/java/org/badvision/outlaweditor/data/TileMap.java +++ b/OutlawEditor/src/main/java/org/badvision/outlaweditor/data/TileMap.java @@ -11,7 +11,6 @@ import java.util.Set; import javafx.scene.control.Alert; import javafx.scene.image.WritableImage; import javafx.scene.paint.Color; -import javax.swing.JOptionPane; import javax.xml.bind.JAXBElement; import org.badvision.outlaweditor.Application; import org.badvision.outlaweditor.Platform; @@ -85,7 +84,7 @@ public class TileMap extends ArrayList> implements Serializable private void registerLocationScript(int x, int y, Script s) { if (!scriptColors.containsKey(s)) { - scriptColors.put(s, Color.hsb(HUE, SATURATION, VALUE)); + scriptColors.put(s, Color.hsb(HUE, SATURATION, 0.75 + Math.cos(HUE / Math.PI / 2.0)/8.0)); HUE = (HUE + 27) % 360; } int loc = getMortonNumber(x, y); diff --git a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/ApplicationUIController.java b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/ApplicationUIController.java index ddf73402..7486b88b 100644 --- a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/ApplicationUIController.java +++ b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/ApplicationUIController.java @@ -46,6 +46,9 @@ public abstract class ApplicationUIController { @FXML abstract public void imageTabActivated(Event event); + @FXML + abstract public void scriptTabActivated(Event event); + @FXML // This method is called by the FXMLLoader when initialization is complete public void initialize() { } diff --git a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/ApplicationUIControllerImpl.java b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/ApplicationUIControllerImpl.java index 0c6c1d9c..3f073db7 100644 --- a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/ApplicationUIControllerImpl.java +++ b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/ApplicationUIControllerImpl.java @@ -84,8 +84,7 @@ public class ApplicationUIControllerImpl extends ApplicationUIController { } public static enum TABS { - - image, map, tile + image, map, tile, scripting }; TABS currentTab; @@ -103,6 +102,11 @@ public class ApplicationUIControllerImpl extends ApplicationUIController { public void tileTabActivated(Event event) { currentTab = TABS.tile; } + + @Override + public void scriptTabActivated(Event event) { + currentTab = TABS.scripting; + } @Override public Editor getVisibleEditor() { @@ -113,8 +117,9 @@ public class ApplicationUIControllerImpl extends ApplicationUIController { return mapController.getCurrentEditor(); case tile: return tileController.getCurrentTileEditor(); + default: + return null; } - return null; } public static final DataFormat SCRIPT_DATA_FORMAT = new DataFormat("MythosScript"); diff --git a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/GlobalScriptTabControllerImpl.java b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/GlobalScriptTabControllerImpl.java new file mode 100644 index 00000000..9b9e47dc --- /dev/null +++ b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/GlobalScriptTabControllerImpl.java @@ -0,0 +1,67 @@ +package org.badvision.outlaweditor.ui.impl; + +import java.net.URL; +import java.util.ResourceBundle; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.ListView; + +/** + * FXML Controller class + * + * @author blurry + */ +public class GlobalScriptTabControllerImpl implements Initializable { + @FXML + private ListView globalScriptList; + @FXML + private ListView dataTypeList; + @FXML + private ListView variableList; + + /** + * Initializes the controller class. + */ + @Override + public void initialize(URL url, ResourceBundle rb) { + // TODO + } + + @FXML + private void onScriptAddPressed(ActionEvent event) { + } + + @FXML + private void onScriptDeletePressed(ActionEvent event) { + } + + @FXML + private void onScriptClonePressed(ActionEvent event) { + } + + @FXML + private void onDataTypeAddPressed(ActionEvent event) { + } + + @FXML + private void onDataTypeDeletePressed(ActionEvent event) { + } + + @FXML + private void onDeleteClonePressed(ActionEvent event) { + } + + @FXML + private void onVariableAddPressed(ActionEvent event) { + } + + @FXML + private void onVariableDeletePressed(ActionEvent event) { + } + + @FXML + private void onVariableClonePressed(ActionEvent event) { + } + +} diff --git a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/MapEditorTabControllerImpl.java b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/MapEditorTabControllerImpl.java index 5447553c..c2d1a494 100644 --- a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/MapEditorTabControllerImpl.java +++ b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/MapEditorTabControllerImpl.java @@ -13,6 +13,8 @@ import javafx.scene.control.cell.ComboBoxListCell; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.image.WritableImage; +import javafx.scene.text.Font; +import javafx.scene.text.FontWeight; import javafx.util.Callback; import javax.xml.bind.JAXBException; import org.badvision.outlaweditor.Application; @@ -26,7 +28,6 @@ import org.badvision.outlaweditor.data.TileUtils; import org.badvision.outlaweditor.data.xml.Map; import org.badvision.outlaweditor.data.xml.Script; import org.badvision.outlaweditor.data.xml.Tile; -import org.badvision.outlaweditor.ui.ApplicationUIController; import org.badvision.outlaweditor.ui.EntitySelectorCell; import org.badvision.outlaweditor.ui.MapEditorTabController; import org.badvision.outlaweditor.ui.ToolType; @@ -383,6 +384,7 @@ public class MapEditorTabControllerImpl extends MapEditorTabController { @Override public ListCell