Fixé problème de scroll dans l'éditeur
This commit is contained in:
parent
168e4408d0
commit
6d8082cafe
|
@ -9,10 +9,16 @@ import galaxyoyo.unknown.api.editor.sprites.SpriteRegister;
|
||||||
import galaxyoyo.unknown.frame.MainFrame;
|
import galaxyoyo.unknown.frame.MainFrame;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Desktop;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.GraphicsEnvironment;
|
||||||
|
import java.awt.HeadlessException;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
|
@ -24,7 +30,6 @@ import org.apache.logging.log4j.Level;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.core.Logger;
|
import org.apache.logging.log4j.core.Logger;
|
||||||
import org.apache.logging.log4j.core.appender.ConsoleAppender;
|
import org.apache.logging.log4j.core.appender.ConsoleAppender;
|
||||||
import org.apache.logging.log4j.core.appender.FileAppender;
|
|
||||||
import org.apache.logging.log4j.core.layout.PatternLayout;
|
import org.apache.logging.log4j.core.layout.PatternLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,17 +64,16 @@ public class Main
|
||||||
{
|
{
|
||||||
Locale.setDefault(Locale.FRANCE);
|
Locale.setDefault(Locale.FRANCE);
|
||||||
|
|
||||||
DEV = Main.class.getResource("/META-INF/MANIFEST.MF") == null;
|
DEV = Main.class.getClassLoader().getResource("/META-INF/MANIFEST.MF") == null;
|
||||||
|
|
||||||
Logger LOGGER = (Logger) LogManager.getRootLogger();
|
Logger LOGGER = (Logger) LogManager.getRootLogger();
|
||||||
ConsoleAppender console = ConsoleAppender.newBuilder().setLayout(PatternLayout.newBuilder().withPattern("[%d{dd/MM/yyyy}] [%d{HH:mm:ss}] [%t] [%c] [%p] %m%n").build()).setName("Console").build();
|
ConsoleAppender console = ConsoleAppender.newBuilder().setLayout(PatternLayout.newBuilder().withPattern("[%d{dd/MM/yyyy}] [%d{HH:mm:ss}] [%t] [%c] [%p] %m%n").build()).setName("Console").build();
|
||||||
FileAppender file = FileAppender.createAppender("Console.log", "false", "false", "File", "true", "true", "true", "8192", PatternLayout.newBuilder().withPattern("[%d{dd/MM/yyyy}] [%d{HH:mm:ss}] [%t] [%c] [%p] %m%n").build(), null, "false", "false", null);
|
|
||||||
console.start();
|
console.start();
|
||||||
file.start();
|
|
||||||
LOGGER.addAppender(console);
|
LOGGER.addAppender(console);
|
||||||
LOGGER.addAppender(file);
|
|
||||||
LOGGER.setLevel(Level.INFO);
|
LOGGER.setLevel(Level.INFO);
|
||||||
|
|
||||||
|
checkJava();
|
||||||
|
|
||||||
OptionParser parser = new OptionParser();
|
OptionParser parser = new OptionParser();
|
||||||
|
|
||||||
OptionSpec<String> edit = parser.accepts("edit", "Lancer l'\u00e9diteur de monde").withOptionalArg();
|
OptionSpec<String> edit = parser.accepts("edit", "Lancer l'\u00e9diteur de monde").withOptionalArg();
|
||||||
|
@ -115,6 +119,40 @@ public class Main
|
||||||
launchFrame();
|
launchFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void checkJava()
|
||||||
|
{
|
||||||
|
if (GraphicsEnvironment.isHeadless())
|
||||||
|
{
|
||||||
|
HeadlessException ex = new HeadlessException("Impossible de lancer un jeu sans \u00e9cran !");
|
||||||
|
LogManager.getLogger("JAVAX-SWING").fatal("Cette application est un jeu, sans écran, elle aura du mal \u00e0 tourner ...");
|
||||||
|
LogManager.getLogger("JAVAX-SWING").catching(Level.FATAL, ex);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Map.class.getDeclaredMethod("getOrDefault", Object.class, Object.class);
|
||||||
|
}
|
||||||
|
catch (NoSuchMethodException ex)
|
||||||
|
{
|
||||||
|
ex.printStackTrace();
|
||||||
|
JOptionPane.showMessageDialog(null, "<html>Cette application requiert <strong>Java 8</strong>.<br />La page de t\u00e9l\u00e9chargement va maintenant s'ouvrir.</html>");
|
||||||
|
JOptionPane.showMessageDialog(null, "<html>Si vous êtes certain que Java 8 est installé sur votre machine, assurez-vous qu'il n'y a pas de versions obsolètes de Java,<br />ou si vous êtes plus expérimentés si le path vers Java est bien défini vers la bonne version.</html>");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Desktop.isDesktopSupported())
|
||||||
|
Desktop.getDesktop().browse(new URL("http://java.com/download").toURI());
|
||||||
|
else
|
||||||
|
JOptionPane.showMessageDialog(null, "<html>Votre machine ne supporte pas la classe Desktop, impossible d'ouvrir la page.<br />Rendez-vous y manuellement sur <a href=\"http://java.com/download\">http://java.com/download</a> pour installer Java.</html>");
|
||||||
|
}
|
||||||
|
catch (IOException | URISyntaxException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lance la fenêtre principale
|
* Lance la fenêtre principale
|
||||||
* @see #main(String...)
|
* @see #main(String...)
|
||||||
|
@ -195,8 +233,6 @@ public class Main
|
||||||
RawMap rm = EditorAPI.toRawMap(baseWidth, baseHeight);
|
RawMap rm = EditorAPI.toRawMap(baseWidth, baseHeight);
|
||||||
rm.setFont(image);
|
rm.setFont(image);
|
||||||
|
|
||||||
EditorAPI.saveAs(rm);
|
|
||||||
|
|
||||||
EditorAPI.open(rm);
|
EditorAPI.open(rm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import java.awt.event.ActionListener;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.awt.event.WindowListener;
|
import java.awt.event.WindowListener;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
|
@ -29,6 +30,7 @@ import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTabbedPane;
|
import javax.swing.JTabbedPane;
|
||||||
|
import javax.swing.KeyStroke;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
|
@ -40,17 +42,19 @@ public class EditorFrame extends JFrame implements ChangeListener, ActionListene
|
||||||
|
|
||||||
private final JPanel content = new JPanel();
|
private final JPanel content = new JPanel();
|
||||||
|
|
||||||
private JMenuBar menuBar = new JMenuBar();
|
private final JMenuBar menuBar = new JMenuBar();
|
||||||
private JMenu fichier = new JMenu("Fichier");
|
private final JMenu fichier = new JMenu("Fichier");
|
||||||
private JMenuItem nouveau = new JMenuItem("Nouveau");
|
private final JMenu tools = new JMenu("Outils");
|
||||||
private JMenuItem open = new JMenuItem("Ouvrir");
|
private final JMenuItem nouveau = new JMenuItem("Nouveau");
|
||||||
private JMenuItem save = new JMenuItem("Sauvegarder");
|
private final JMenuItem open = new JMenuItem("Ouvrir");
|
||||||
private JMenuItem saveAs = new JMenuItem("Sauvegarder sous ...");
|
private final JMenuItem save = new JMenuItem("Sauvegarder");
|
||||||
private JMenuItem exit = new JMenuItem("Quitter");
|
private final JMenuItem saveAs = new JMenuItem("Sauvegarder sous ...");
|
||||||
|
private final JMenuItem exit = new JMenuItem("Quitter");
|
||||||
|
private final JMenu selectionMode = new JMenu("Mode de s\u00e9lection");
|
||||||
private final JTabbedPane tabs = new JTabbedPane();
|
private final JTabbedPane tabs = new JTabbedPane();
|
||||||
private final JPanel tabEvents = new JPanel();
|
private final JPanel tabEvents = new JPanel();
|
||||||
private final CollidPanel tabColl = new CollidPanel(this);
|
private final CollidPanel tabColl;
|
||||||
private final MapPanel mapPanel = new MapPanel(this);
|
private final MapPanel mapPanel;
|
||||||
private final JTabbedPane resources = new JTabbedPane();
|
private final JTabbedPane resources = new JTabbedPane();
|
||||||
private final JPanel couche1 = new JPanel();
|
private final JPanel couche1 = new JPanel();
|
||||||
private final JPanel couche2 = new JPanel();
|
private final JPanel couche2 = new JPanel();
|
||||||
|
@ -71,43 +75,60 @@ public class EditorFrame extends JFrame implements ChangeListener, ActionListene
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
this.setVisible(false);
|
this.setVisible(false);
|
||||||
|
|
||||||
nouveau.setMnemonic(KeyEvent.CTRL_DOWN_MASK + KeyEvent.VK_N);
|
fichier.setMnemonic(KeyEvent.VK_F + KeyEvent.ALT_DOWN_MASK);
|
||||||
|
|
||||||
|
nouveau.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK, true));
|
||||||
nouveau.addActionListener(new CreateMapListener());
|
nouveau.addActionListener(new CreateMapListener());
|
||||||
fichier.add(nouveau);
|
fichier.add(nouveau);
|
||||||
|
|
||||||
open.setMnemonic(KeyEvent.CTRL_DOWN_MASK + KeyEvent.VK_O);
|
open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_DOWN_MASK, true));
|
||||||
open.addActionListener(new OpenMapListener());
|
open.addActionListener(new OpenMapListener());
|
||||||
fichier.add(open);
|
fichier.add(open);
|
||||||
|
|
||||||
fichier.addSeparator();
|
fichier.addSeparator();
|
||||||
|
|
||||||
save.setMnemonic(KeyEvent.CTRL_DOWN_MASK + KeyEvent.VK_S);
|
save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_DOWN_MASK, true));
|
||||||
save.addActionListener(this);
|
save.addActionListener(this);
|
||||||
fichier.add(save);
|
fichier.add(save);
|
||||||
|
|
||||||
saveAs.setMnemonic(KeyEvent.CTRL_DOWN_MASK + KeyEvent.SHIFT_MASK + KeyEvent.VK_S);
|
saveAs.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_DOWN_MASK + KeyEvent.SHIFT_DOWN_MASK, true));
|
||||||
saveAs.addActionListener(this);
|
saveAs.addActionListener(this);
|
||||||
fichier.add(saveAs);
|
fichier.add(saveAs);
|
||||||
|
|
||||||
fichier.addSeparator();
|
fichier.addSeparator();
|
||||||
|
|
||||||
exit.setMnemonic(KeyEvent.CTRL_DOWN_MASK + KeyEvent.VK_Q);
|
exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.CTRL_DOWN_MASK, true));
|
||||||
exit.addActionListener(this);
|
exit.addActionListener(this);
|
||||||
fichier.add(exit);
|
fichier.add(exit);
|
||||||
|
|
||||||
menuBar.add(fichier);
|
menuBar.add(fichier);
|
||||||
|
|
||||||
|
tools.setMnemonic(KeyEvent.VK_O + KeyEvent.ALT_DOWN_MASK);
|
||||||
|
|
||||||
|
tools.add(selectionMode);
|
||||||
|
|
||||||
|
menuBar.add(tools);
|
||||||
|
|
||||||
this.setJMenuBar(menuBar);
|
this.setJMenuBar(menuBar);
|
||||||
|
|
||||||
|
mapPanel = new MapPanel(this);
|
||||||
mapPanel.addMouseListener(new MapMouseListener(mapPanel, this));
|
mapPanel.addMouseListener(new MapMouseListener(mapPanel, this));
|
||||||
mapPanel.addMouseMotionListener(new MapMouseListener(mapPanel, this));
|
mapPanel.addMouseMotionListener(new MapMouseListener(mapPanel, this));
|
||||||
|
|
||||||
|
tabColl = new CollidPanel(this);
|
||||||
tabColl.addMouseListener(new CollidMapMouseListener(tabColl, this));
|
tabColl.addMouseListener(new CollidMapMouseListener(tabColl, this));
|
||||||
tabColl.addMouseMotionListener(new CollidMapMouseListener(tabColl, this));
|
tabColl.addMouseMotionListener(new CollidMapMouseListener(tabColl, this));
|
||||||
|
|
||||||
tabs.addTab("Carte", new JScrollPane(mapPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED));
|
JScrollPane scrollMap = new JScrollPane(mapPanel);
|
||||||
|
scrollMap.getHorizontalScrollBar().setUnitIncrement(34);
|
||||||
|
scrollMap.getVerticalScrollBar().setUnitIncrement(34);
|
||||||
|
JScrollPane scrollCollidMap = new JScrollPane(tabColl);
|
||||||
|
scrollCollidMap.getHorizontalScrollBar().setUnitIncrement(34);
|
||||||
|
scrollCollidMap.getVerticalScrollBar().setUnitIncrement(34);
|
||||||
|
|
||||||
|
tabs.addTab("Carte", scrollMap);
|
||||||
tabs.addTab("\u00c9vennments", new JScrollPane(tabEvents));
|
tabs.addTab("\u00c9vennments", new JScrollPane(tabEvents));
|
||||||
tabs.addTab("Collisions", new JScrollPane(tabColl));
|
tabs.addTab("Collisions", scrollCollidMap);
|
||||||
tabs.addChangeListener(this);
|
tabs.addChangeListener(this);
|
||||||
|
|
||||||
content.add(tabs, BorderLayout.CENTER);
|
content.add(tabs, BorderLayout.CENTER);
|
||||||
|
@ -189,8 +210,13 @@ public class EditorFrame extends JFrame implements ChangeListener, ActionListene
|
||||||
int cursorPos = ((JScrollPane) resources.getSelectedComponent()).getVerticalScrollBar().getValue();
|
int cursorPos = ((JScrollPane) resources.getSelectedComponent()).getVerticalScrollBar().getValue();
|
||||||
tabs.setPreferredSize(new Dimension(getWidth(), getHeight() / 5));
|
tabs.setPreferredSize(new Dimension(getWidth(), getHeight() / 5));
|
||||||
tabs.setLocation(0, 0);
|
tabs.setLocation(0, 0);
|
||||||
mapPanel.setPreferredSize(new Dimension(getWidth() / 4 * 3, getHeight() / 5 * 4));
|
BufferedImage img = getMap().getFont();
|
||||||
|
int width = img.getWidth() * 2;
|
||||||
|
int height = img.getHeight() * 2;
|
||||||
|
mapPanel.setPreferredSize(new Dimension(width, height));
|
||||||
mapPanel.setLocation(0, getHeight() / 5);
|
mapPanel.setLocation(0, getHeight() / 5);
|
||||||
|
tabColl.setPreferredSize(new Dimension(width, height));
|
||||||
|
tabColl.setLocation(0, getHeight() / 5);
|
||||||
resources.setPreferredSize(new Dimension(getWidth() / 4 - 15, getHeight() / 5 * 4 - 40));
|
resources.setPreferredSize(new Dimension(getWidth() / 4 - 15, getHeight() / 5 * 4 - 40));
|
||||||
resources.setLocation(getWidth() / 4 * 3, getHeight() / 5);
|
resources.setLocation(getWidth() / 4 * 3, getHeight() / 5);
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ public class SpriteComp extends JComponent
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = -6512257366877053285L;
|
private static final long serialVersionUID = -6512257366877053285L;
|
||||||
|
|
||||||
private final Sprite sprite;
|
private Sprite sprite;
|
||||||
private final int couche;
|
private int couche;
|
||||||
private boolean selected;
|
private boolean selected;
|
||||||
|
|
||||||
public SpriteComp(Sprite sprite, int couche)
|
public SpriteComp(Sprite sprite, int couche)
|
||||||
|
@ -34,11 +34,21 @@ public class SpriteComp extends JComponent
|
||||||
return sprite;
|
return sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSprite(Sprite s)
|
||||||
|
{
|
||||||
|
this.sprite = s;
|
||||||
|
}
|
||||||
|
|
||||||
public int getCouche()
|
public int getCouche()
|
||||||
{
|
{
|
||||||
return couche;
|
return couche;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCouche(int couche)
|
||||||
|
{
|
||||||
|
this.couche = couche;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSelected()
|
public boolean isSelected()
|
||||||
{
|
{
|
||||||
return selected;
|
return selected;
|
||||||
|
|
|
@ -7,6 +7,7 @@ import galaxyoyo.unknown.frame.listeners.CreateMapListener;
|
||||||
import galaxyoyo.unknown.frame.listeners.OpenMapListener;
|
import galaxyoyo.unknown.frame.listeners.OpenMapListener;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JMenu;
|
import javax.swing.JMenu;
|
||||||
|
@ -43,7 +44,6 @@ public class MainFrame extends JFrame
|
||||||
|
|
||||||
private JMenuBar menuBar = new JMenuBar();
|
private JMenuBar menuBar = new JMenuBar();
|
||||||
private JMenu fichier = new JMenu("Fichier");
|
private JMenu fichier = new JMenu("Fichier");
|
||||||
private JMenu editer = new JMenu("\u00c9diter");
|
|
||||||
private JMenu editMaps = new JMenu("Cartes");
|
private JMenu editMaps = new JMenu("Cartes");
|
||||||
private JMenuItem createMap = new JMenuItem("Cr\u00e9er");
|
private JMenuItem createMap = new JMenuItem("Cr\u00e9er");
|
||||||
private JMenuItem openMap = new JMenuItem("Ouvrir");
|
private JMenuItem openMap = new JMenuItem("Ouvrir");
|
||||||
|
@ -63,15 +63,16 @@ public class MainFrame extends JFrame
|
||||||
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
menuBar.add(fichier);
|
fichier.setMnemonic(KeyEvent.VK_F + KeyEvent.ALT_DOWN_MASK);
|
||||||
|
|
||||||
createMap.addActionListener(new CreateMapListener());
|
createMap.addActionListener(new CreateMapListener());
|
||||||
editMaps.add(createMap);
|
editMaps.add(createMap);
|
||||||
openMap.addActionListener(new OpenMapListener());
|
openMap.addActionListener(new OpenMapListener());
|
||||||
editMaps.add(openMap);
|
editMaps.add(openMap);
|
||||||
editer.add(editMaps);
|
|
||||||
|
|
||||||
menuBar.add(editer);
|
fichier.add(editMaps);
|
||||||
|
|
||||||
|
menuBar.add(fichier);
|
||||||
|
|
||||||
this.setJMenuBar(menuBar);
|
this.setJMenuBar(menuBar);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import galaxyoyo.unknown.editor.CollidPanel;
|
||||||
import galaxyoyo.unknown.editor.EditorFrame;
|
import galaxyoyo.unknown.editor.EditorFrame;
|
||||||
import galaxyoyo.unknown.editor.Map;
|
import galaxyoyo.unknown.editor.Map;
|
||||||
|
|
||||||
import java.awt.Cursor;
|
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
|
||||||
|
@ -26,24 +25,6 @@ public class CollidMapMouseListener extends MouseAdapter
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mouseMoved(MouseEvent event)
|
|
||||||
{
|
|
||||||
Map map = getFrame().getMap();
|
|
||||||
|
|
||||||
int x = panel.getWidth() / 2 - map.getFont().getWidth();
|
|
||||||
int y = panel.getHeight() / 2 - map.getFont().getHeight();
|
|
||||||
|
|
||||||
if (map.getCase((event.getX() - x - 2) / 34, (event.getY() - y - 2) / 34) != null && event.getX() - x >= 2 && event.getY() - y >= 2)
|
|
||||||
{
|
|
||||||
getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getFrame().setCursor(Cursor.getDefaultCursor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(MouseEvent event)
|
public void mouseReleased(MouseEvent event)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
package galaxyoyo.unknown.frame.listeners;
|
package galaxyoyo.unknown.frame.listeners;
|
||||||
|
|
||||||
import galaxyoyo.unknown.client.main.Main;
|
import galaxyoyo.unknown.client.main.Main;
|
||||||
|
import galaxyoyo.unknown.frame.MainFrame;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
@ -20,5 +21,6 @@ public class CreateMapListener implements ActionListener
|
||||||
public void actionPerformed(ActionEvent event)
|
public void actionPerformed(ActionEvent event)
|
||||||
{
|
{
|
||||||
Main.main("--edit", Main.isInDebugMode() ? " --debug true" : "");
|
Main.main("--edit", Main.isInDebugMode() ? " --debug true" : "");
|
||||||
|
MainFrame.getInstance().dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import galaxyoyo.unknown.editor.EditorFrame;
|
||||||
import galaxyoyo.unknown.editor.Map;
|
import galaxyoyo.unknown.editor.Map;
|
||||||
import galaxyoyo.unknown.editor.MapPanel;
|
import galaxyoyo.unknown.editor.MapPanel;
|
||||||
|
|
||||||
import java.awt.Cursor;
|
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
|
||||||
|
@ -25,24 +24,6 @@ public class MapMouseListener extends MouseAdapter
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mouseMoved(MouseEvent event)
|
|
||||||
{
|
|
||||||
Map map = getFrame().getMap();
|
|
||||||
|
|
||||||
int x = panel.getWidth() / 2 - map.getFont().getWidth();
|
|
||||||
int y = panel.getHeight() / 2 - map.getFont().getHeight();
|
|
||||||
|
|
||||||
if (map.getCase((event.getX() - x - 2) / 34, (event.getY() - y - 2) / 34) != null && event.getX() - x >= 2 && event.getY() - y >= 2)
|
|
||||||
{
|
|
||||||
getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getFrame().setCursor(Cursor.getDefaultCursor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(MouseEvent event)
|
public void mouseReleased(MouseEvent event)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package galaxyoyo.unknown.frame.listeners;
|
package galaxyoyo.unknown.frame.listeners;
|
||||||
|
|
||||||
import galaxyoyo.unknown.api.editor.EditorAPI;
|
import galaxyoyo.unknown.api.editor.EditorAPI;
|
||||||
|
import galaxyoyo.unknown.frame.MainFrame;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
@ -13,6 +14,7 @@ public class OpenMapListener implements ActionListener
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent event)
|
public void actionPerformed(ActionEvent event)
|
||||||
{
|
{
|
||||||
EditorAPI.open();
|
if (EditorAPI.open() != null)
|
||||||
|
MainFrame.getInstance().dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue