Mis à jour fenêtre d'édition (pas version finale)
This commit is contained in:
parent
24d97922c4
commit
ae6df98832
|
@ -33,7 +33,6 @@ public class SpriteRegister
|
||||||
{
|
{
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(SpriteRegister.class.getResourceAsStream("/assets/unknown/textures/sprites/sprites.json")));
|
BufferedReader br = new BufferedReader(new InputStreamReader(SpriteRegister.class.getResourceAsStream("/assets/unknown/textures/sprites/sprites.json")));
|
||||||
nameToCoords = new Gson().fromJson(br, Map.class);
|
nameToCoords = new Gson().fromJson(br, Map.class);
|
||||||
System.out.println(nameToCoords);
|
|
||||||
br.close();
|
br.close();
|
||||||
|
|
||||||
for (String key : nameToCoords.keySet())
|
for (String key : nameToCoords.keySet())
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package galaxyoyo.unknown.editor;
|
package galaxyoyo.unknown.editor;
|
||||||
|
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.event.ComponentEvent;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.event.ComponentListener;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTabbedPane;
|
import javax.swing.JTabbedPane;
|
||||||
|
|
||||||
public class EditorFrame extends JFrame
|
public class EditorFrame extends JFrame implements ComponentListener
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = -2705122356101556462L;
|
private static final long serialVersionUID = -2705122356101556462L;
|
||||||
|
|
||||||
|
@ -33,26 +33,16 @@ public class EditorFrame extends JFrame
|
||||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||||
this.setLocationRelativeTo(null);
|
this.setLocationRelativeTo(null);
|
||||||
this.setLayout(new GridBagLayout());
|
|
||||||
this.setContentPane(content);
|
this.setContentPane(content);
|
||||||
|
this.addComponentListener(this);
|
||||||
|
|
||||||
GridBagConstraints c = new GridBagConstraints();
|
revalidate();
|
||||||
|
|
||||||
c.gridx = 0;
|
|
||||||
c.gridy = 0;
|
|
||||||
c.gridwidth = 3;
|
|
||||||
c.gridheight = 1;
|
|
||||||
|
|
||||||
tabs.addTab("Carte", new JPanel());
|
tabs.addTab("Carte", new JPanel());
|
||||||
tabs.addTab("\u00c9vennements", tabEvents);
|
tabs.addTab("\u00c9vennements", tabEvents);
|
||||||
tabs.addTab("Collisions", tabColl);
|
tabs.addTab("Collisions", tabColl);
|
||||||
|
|
||||||
content.add(tabs, c);
|
content.add(tabs);
|
||||||
|
|
||||||
c.gridx = 0;
|
|
||||||
c.gridy = 1;
|
|
||||||
c.gridwidth = 2;
|
|
||||||
c.gridheight = 3;
|
|
||||||
|
|
||||||
content.add(mapPanel);
|
content.add(mapPanel);
|
||||||
|
|
||||||
|
@ -60,11 +50,45 @@ public class EditorFrame extends JFrame
|
||||||
resources.addTab("2", couche2);
|
resources.addTab("2", couche2);
|
||||||
resources.addTab("3", couche3);
|
resources.addTab("3", couche3);
|
||||||
|
|
||||||
c.gridx = 2;
|
|
||||||
c.gridy = 1;
|
|
||||||
c.gridwidth = 1;
|
|
||||||
c.gridheight = 3;
|
|
||||||
|
|
||||||
content.add(resources);
|
content.add(resources);
|
||||||
|
|
||||||
|
revalidate();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentHidden(ComponentEvent event)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentMoved(ComponentEvent event)
|
||||||
|
{
|
||||||
|
componentShown(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentResized(ComponentEvent event)
|
||||||
|
{
|
||||||
|
componentShown(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentShown(ComponentEvent event)
|
||||||
|
{
|
||||||
|
revalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void revalidate()
|
||||||
|
{
|
||||||
|
tabs.setBounds(0, 0, getWidth(), getHeight() / 5);
|
||||||
|
mapPanel.setBounds(0, getWidth() / 5, getWidth() / 4 * 3, getHeight() / 5 * 4);
|
||||||
|
resources.setBounds(getWidth() / 4 * 3, getHeight() / 5, getWidth() / 4, getHeight() / 5 * 4);
|
||||||
|
|
||||||
|
tabs.revalidate();
|
||||||
|
mapPanel.revalidate();
|
||||||
|
resources.revalidate();
|
||||||
|
super.revalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue