mirror of
https://github.com/ynerant/Level-Editor.git
synced 2025-06-21 09:58:24 +02:00
Ajouté fonctions pour ouverture/sauvegarde d'une carte
This commit is contained in:
@ -1,25 +1,28 @@
|
||||
package galaxyoyo.unknown.editor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Editor
|
||||
{
|
||||
public static Byte[] toBytes(int width, int height)
|
||||
private final EditorFrame frame;
|
||||
private byte[] bytes;
|
||||
|
||||
public Editor(byte[] bytes)
|
||||
{
|
||||
List<Byte> bytes = new ArrayList<Byte>();
|
||||
|
||||
for (int x = 1; x < width; x += 16)
|
||||
{
|
||||
for (int y = 1; y < height; y += 16)
|
||||
{
|
||||
bytes.add((byte) 0);
|
||||
}
|
||||
bytes.add(Byte.MIN_VALUE);
|
||||
}
|
||||
|
||||
bytes.remove(bytes.lastIndexOf(Byte.MIN_VALUE));
|
||||
|
||||
return bytes.toArray(new Byte[0]);
|
||||
frame = new EditorFrame();
|
||||
this.bytes = bytes;
|
||||
}
|
||||
|
||||
public EditorFrame getFrame()
|
||||
{
|
||||
return frame;
|
||||
}
|
||||
|
||||
public byte[] getBytes()
|
||||
{
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public void setBytes(byte[] bytes)
|
||||
{
|
||||
this.bytes = bytes;
|
||||
}
|
||||
}
|
||||
|
12
src/main/java/galaxyoyo/unknown/editor/EditorFrame.java
Normal file
12
src/main/java/galaxyoyo/unknown/editor/EditorFrame.java
Normal file
@ -0,0 +1,12 @@
|
||||
package galaxyoyo.unknown.editor;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class EditorFrame extends JFrame
|
||||
{
|
||||
private static final long serialVersionUID = -2705122356101556462L;
|
||||
|
||||
public EditorFrame()
|
||||
{
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user