Small Progress on the Gui Animation System
This commit is contained in:
parent
099eec4fe4
commit
36ce0209fb
|
@ -45,6 +45,7 @@ public class GuiAnimation {
|
||||||
|
|
||||||
public GuiAnimation build() {
|
public GuiAnimation build() {
|
||||||
float duration = 0F;
|
float duration = 0F;
|
||||||
|
actions.values().mapToFloat(IAction::duration).reduce(Math::max);
|
||||||
for(IAction action : actions.values()) {
|
for(IAction action : actions.values()) {
|
||||||
duration = Math.max(duration, action.duration());
|
duration = Math.max(duration, action.duration());
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package speiger.src.coreengine.rendering.gui.animation;
|
||||||
|
|
||||||
|
public class GuiAnimator {
|
||||||
|
|
||||||
|
}
|
|
@ -1,28 +1,33 @@
|
||||||
package speiger.src.coreengine.rendering.input.events;
|
package speiger.src.coreengine.rendering.input.events;
|
||||||
|
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import speiger.src.collections.objects.utils.ObjectIterators;
|
||||||
|
|
||||||
public class FileEvents {
|
public class FileEvents {
|
||||||
public static class Drop extends MouseEvent {
|
public static class Drop extends MouseEvent implements Iterable<DroppedFile> {
|
||||||
Path[] files;
|
DroppedFile[] files;
|
||||||
String[] extension;
|
|
||||||
String[] name;
|
|
||||||
|
|
||||||
public Drop(long window, int x, int y, Path[] files) {
|
public Drop(long window, int x, int y, Path[] files) {
|
||||||
super(window, x, y);
|
super(window, x, y);
|
||||||
this.files = files;
|
this.files = new DroppedFile[files.length];
|
||||||
this.extension = new String[files.length];
|
|
||||||
this.name = new String[files.length];
|
|
||||||
for(int i = 0,m=files.length;i<m;i++) {
|
for(int i = 0,m=files.length;i<m;i++) {
|
||||||
String name = files[i].getFileName().toString();
|
String name = files[i].getFileName().toString();
|
||||||
this.name[i] = name;
|
this.files[i] = new DroppedFile(files[i], name, name.substring(name.lastIndexOf(".")+1));
|
||||||
this.extension[i] = name.substring(name.lastIndexOf(".")+1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<DroppedFile> iterator() { return ObjectIterators.wrap(files); }
|
||||||
public int size() { return files.length; }
|
public int size() { return files.length; }
|
||||||
public Path file(int index) { return files[index]; }
|
public DroppedFile get() { return files[0]; }
|
||||||
public String extension(int index) { return extension[index]; }
|
public DroppedFile get(int index) { return files[index]; }
|
||||||
public String name(int index) { return name[index]; }
|
}
|
||||||
|
|
||||||
|
public record DroppedFile(Path path, String name, String extension) {
|
||||||
|
public boolean isFolder() { return Files.isDirectory(path); }
|
||||||
|
public boolean isFile() { return Files.isRegularFile(path); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue