API improvements III

This commit is contained in:
Robert Vokac 2024-10-01 21:58:06 +02:00
parent 78cfe4fa33
commit 48f1efed3c
Signed by: robertvokac
GPG Key ID: FB9CE8E20AADA55F
3 changed files with 119 additions and 3 deletions

View File

@ -17,13 +17,67 @@
// <https://www.gnu.org/licenses/> 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 <T>
*/
public interface Animation {
public class Animation<T> {
T[] keyFrames;
private float frameDuration;
@Getter
@Setter
private AnimationMode animationMode = AnimationMode.NORMAL;
public Animation(int frameDuration, Iterable<T> keyFrames) {
}
public Animation(int frameDuration, Iterable<T> 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
}
}

View File

@ -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
// <https://www.gnu.org/licenses/> 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,
}

View File

@ -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
// <https://www.gnu.org/licenses/> 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
}