From 48f1efed3c84ddafed733585754b9a69aa63e17c Mon Sep 17 00:00:00 2001 From: Robert Vokac Date: Tue, 1 Oct 2024 21:58:06 +0200 Subject: [PATCH] API improvements III --- .../api/graphics/Animation.java | 60 ++++++++++++++++++- .../api/graphics/AnimationMode.java | 29 +++++++++ .../api/input/InputProcessorMultiplexer.java | 33 ++++++++++ 3 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/pixelgamelibrary/api/graphics/AnimationMode.java create mode 100644 src/main/java/com/pixelgamelibrary/api/input/InputProcessorMultiplexer.java diff --git a/src/main/java/com/pixelgamelibrary/api/graphics/Animation.java b/src/main/java/com/pixelgamelibrary/api/graphics/Animation.java index 84f8cc4..6639b05 100644 --- a/src/main/java/com/pixelgamelibrary/api/graphics/Animation.java +++ b/src/main/java/com/pixelgamelibrary/api/graphics/Animation.java @@ -17,13 +17,67 @@ // or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// - package com.pixelgamelibrary.api.graphics; +import lombok.Getter; +import lombok.Setter; + /** * * @author robertvokac + * @param */ -public interface Animation { - +public class Animation { + + T[] keyFrames; + + private float frameDuration; + @Getter + @Setter + private AnimationMode animationMode = AnimationMode.NORMAL; + + public Animation(int frameDuration, Iterable keyFrames) { + + } + + public Animation(int frameDuration, Iterable keyFrames, AnimationMode animationMode) { + + } + + public Animation(int frameDuration, T... keyFrames) { + + } + + public Animation(int frameDuration, AnimationMode animationMode, T... keyFrames) { + + } + + public T getKeyFrame(long gameTime) { + return null;//todo + } + + public int getKeyFrameIndex(long gameTime) { + + return 0;//todo + } + + public T[] getKeyFrames() { + return null;// + } + + public boolean isAnimationFinished(float gameTime) { + return true;//todo + } + + public void setFrameDuration(float frameDuration) { + } + + public float getFrameDuration() { + return 0;//todo + } + + public float getAnimationDuration() { + return 0;//todo + } + } diff --git a/src/main/java/com/pixelgamelibrary/api/graphics/AnimationMode.java b/src/main/java/com/pixelgamelibrary/api/graphics/AnimationMode.java new file mode 100644 index 0000000..ac3247c --- /dev/null +++ b/src/main/java/com/pixelgamelibrary/api/graphics/AnimationMode.java @@ -0,0 +1,29 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// Pixel: Game library. +// Copyright (C) 2024 the original author or authors. +// +// This program is free software: you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see +// or write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.pixelgamelibrary.api.graphics; + +/** + * + * @author robertvokac + */ +public enum AnimationMode { + NORMAL, REVERSED, LOOP, LOOP_REVERSED, LOOP_PINGPONG, LOOP_RANDOM, +} diff --git a/src/main/java/com/pixelgamelibrary/api/input/InputProcessorMultiplexer.java b/src/main/java/com/pixelgamelibrary/api/input/InputProcessorMultiplexer.java new file mode 100644 index 0000000..3d5d0c8 --- /dev/null +++ b/src/main/java/com/pixelgamelibrary/api/input/InputProcessorMultiplexer.java @@ -0,0 +1,33 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// Pixel: Game library. +// Copyright (C) 2024 the original author or authors. +// +// This program is free software: you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see +// or write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +/////////////////////////////////////////////////////////////////////////////////////////////// +package com.pixelgamelibrary.api.input; + + + +/** A custom input handler that manages multiple input processors in an ordered manner. + * + * @author robertvokac + */ +public class InputProcessorMultiplexer + /*implements InputProcessor*/ +{ +//todo + +}