Changes
This commit is contained in:
parent
882d5466f8
commit
3d390ddf43
@ -23,13 +23,13 @@ package com.pixelgamelibrary.api;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface GameI extends ApplicationListener {
|
public interface Game extends ApplicationListener {
|
||||||
|
|
||||||
void create();
|
void create();
|
||||||
|
|
||||||
void setScreen(ScreenI screen);
|
void setScreen(Screen screen);
|
||||||
|
|
||||||
ScreenI getScreen();
|
Screen getScreen();
|
||||||
|
|
||||||
void render();
|
void render();
|
||||||
|
|
@ -24,9 +24,9 @@ package com.pixelgamelibrary.api;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public class GameAdapter implements GameI {
|
public class GameAdapter implements Game {
|
||||||
|
|
||||||
private ScreenI screen;
|
private Screen screen;
|
||||||
private OnSetScreenListener setOnSetScreenListener;
|
private OnSetScreenListener setOnSetScreenListener;
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
@ -34,7 +34,7 @@ public class GameAdapter implements GameI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setScreen(ScreenI screen) {
|
public void setScreen(Screen screen) {
|
||||||
this.screen = screen;
|
this.screen = screen;
|
||||||
System.out.println("setOnSetScreenListener=" + setOnSetScreenListener);
|
System.out.println("setOnSetScreenListener=" + setOnSetScreenListener);
|
||||||
if(setOnSetScreenListener != null) {
|
if(setOnSetScreenListener != null) {
|
||||||
@ -44,7 +44,7 @@ public class GameAdapter implements GameI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScreenI getScreen() {
|
public Screen getScreen() {
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,11 +25,11 @@ package com.pixelgamelibrary.api;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public class GameWrapper implements GameI {
|
public class GameWrapper implements Game {
|
||||||
|
|
||||||
private final GameI game;
|
private final Game game;
|
||||||
|
|
||||||
public GameWrapper(GameI gameI) {
|
public GameWrapper(Game gameI) {
|
||||||
this.game = gameI;
|
this.game = gameI;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,12 +39,12 @@ public class GameWrapper implements GameI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setScreen(ScreenI screen) {
|
public void setScreen(Screen screen) {
|
||||||
game.setScreen(screen);
|
game.setScreen(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScreenI getScreen() {
|
public Screen getScreen() {
|
||||||
return game.getScreen();
|
return game.getScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,6 @@ package com.pixelgamelibrary.api;
|
|||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface OnSetScreenListener {
|
public interface OnSetScreenListener {
|
||||||
void onSetScreen(ScreenI screen);
|
void onSetScreen(Screen screen);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,16 +19,15 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.pixelgamelibrary.api;
|
package com.pixelgamelibrary.api;
|
||||||
|
|
||||||
import com.pixelgamelibrary.api.interfaces.AppI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.AssetI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.AudioI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.GraphicsI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.InputI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.InternalI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.NetI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.PixelBackend;
|
import com.pixelgamelibrary.api.interfaces.PixelBackend;
|
||||||
import com.pixelgamelibrary.api.interfaces.StorageI;
|
import com.pixelgamelibrary.api.interfaces.Files;
|
||||||
import com.pixelgamelibrary.api.interfaces.UtilsI;
|
import com.pixelgamelibrary.api.interfaces.Audio;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.Graphics;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.Input;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.Internal;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.Net;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.Utils;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.App;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -47,39 +46,35 @@ public class Pixel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////
|
////
|
||||||
public static AppI app() {
|
public static App app() {
|
||||||
return get().app();
|
return get().app();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GraphicsI graphics() {
|
public static Graphics graphics() {
|
||||||
return get().graphics();
|
return get().graphics();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AudioI audio() {
|
public static Audio audio() {
|
||||||
return get().audio();
|
return get().audio();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InputI input() {
|
public static Input input() {
|
||||||
return get().input();
|
return get().input();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NetI net() {
|
public static Net net() {
|
||||||
return get().net();
|
return get().net();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AssetI asset() {
|
public static Files files() {
|
||||||
return get().asset();
|
return get().files();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StorageI storage() {
|
public static Utils utils() {
|
||||||
return get().storage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UtilsI utils() {
|
|
||||||
return get().utils();
|
return get().utils();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InternalI internal() {
|
public static Internal internal() {
|
||||||
return get().internal();
|
return get().internal();
|
||||||
}
|
}
|
||||||
////
|
////
|
||||||
|
@ -27,12 +27,12 @@ import java.util.Map;
|
|||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public abstract class PixelApplication {
|
public abstract class PixelApplication {
|
||||||
abstract public GameI createGameViaMap(Map<String, Object> objects);
|
abstract public Game createGameViaMap(Map<String, Object> objects);
|
||||||
|
|
||||||
public GameI createGame() {
|
public Game createGame() {
|
||||||
return createGame(new HashMap<>());
|
return createGame(new HashMap<>());
|
||||||
}
|
}
|
||||||
public GameI createGame(Object... objects) {
|
public Game createGame(Object... objects) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int maxI = objects.length - 1;
|
int maxI = objects.length - 1;
|
||||||
|
@ -17,14 +17,20 @@
|
|||||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.pixelgamelibrary.api.interfaces;
|
package com.pixelgamelibrary.api;
|
||||||
|
|
||||||
import com.pixelgamelibrary.api.storage.Storage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface AssetI {
|
public enum PixelFeature {
|
||||||
Storage getAssets();
|
SOCKETS,
|
||||||
|
WEBSOCKETS,
|
||||||
|
AUDIO,
|
||||||
|
TOUCHSCREEN,
|
||||||
|
ACCELERATOR,
|
||||||
|
GYROSCOP,
|
||||||
|
VIBRATION,
|
||||||
|
MOUSE,
|
||||||
|
KEYBOARD;
|
||||||
}
|
}
|
@ -23,7 +23,7 @@ package com.pixelgamelibrary.api;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface ScreenI extends ApplicationListener {
|
public interface Screen extends ApplicationListener {
|
||||||
|
|
||||||
void render(float delta);
|
void render(float delta);
|
||||||
}
|
}
|
@ -23,8 +23,8 @@ package com.pixelgamelibrary.api;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public class ScreenAdapter implements ScreenI{
|
public class ScreenAdapter implements Screen{
|
||||||
private GameI game = null;
|
private Game game = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resize(int width, int height) {
|
public void resize(int width, int height) {
|
||||||
|
@ -25,11 +25,11 @@ package com.pixelgamelibrary.api;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public class ScreenWrapper implements ScreenI {
|
public class ScreenWrapper implements Screen {
|
||||||
|
|
||||||
private final ScreenI screen;
|
private final Screen screen;
|
||||||
|
|
||||||
public ScreenWrapper(ScreenI screenIn) {
|
public ScreenWrapper(Screen screenIn) {
|
||||||
this.screen = screenIn;
|
this.screen = screenIn;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
29
src/main/java/com/pixelgamelibrary/api/View.java
Normal file
29
src/main/java/com/pixelgamelibrary/api/View.java
Normal 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public enum View {
|
||||||
|
STRETCH, FIT, SCREEN, EXTEND;
|
||||||
|
}
|
@ -19,14 +19,18 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.pixelgamelibrary.api.interfaces;
|
package com.pixelgamelibrary.api.interfaces;
|
||||||
|
|
||||||
import com.pixelgamelibrary.api.GameI;
|
import com.pixelgamelibrary.api.PixelFeature;
|
||||||
import com.pixelgamelibrary.api.Platform;
|
import com.pixelgamelibrary.api.Platform;
|
||||||
|
import com.pixelgamelibrary.api.Game;
|
||||||
|
import com.pixelgamelibrary.api.utils.ClipBoard;
|
||||||
|
import com.pixelgamelibrary.api.utils.LogLevel;
|
||||||
|
import com.pixelgamelibrary.api.utils.Preferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface AppI {
|
public interface App {
|
||||||
Platform getPlatform();
|
Platform getPlatform();
|
||||||
|
|
||||||
default boolean isOneOfPlatforms(Platform ... platforms) {
|
default boolean isOneOfPlatforms(Platform ... platforms) {
|
||||||
@ -42,12 +46,17 @@ public interface AppI {
|
|||||||
void warn(String msg);
|
void warn(String msg);
|
||||||
void error(String msg);
|
void error(String msg);
|
||||||
void debug(String msg);
|
void debug(String msg);
|
||||||
|
void setLogLevel(LogLevel logLevel);
|
||||||
|
Preferences getPreferences(String preferencesName);
|
||||||
void setAppName(String appName);
|
void setAppName(String appName);
|
||||||
String getAppName();
|
String getAppName();
|
||||||
boolean isAppNameSet();
|
boolean isAppNameSet();
|
||||||
|
|
||||||
void setGame(GameI game);
|
void setGame(Game game);
|
||||||
|
|
||||||
GameI getGame();
|
|
||||||
|
|
||||||
|
Game getGame();
|
||||||
|
boolean isFeatureEnabled(PixelFeature feature);
|
||||||
|
boolean isMobileDevice();
|
||||||
|
void postRunnable(Runnable runnable);
|
||||||
|
ClipBoard getClipBoard();
|
||||||
}
|
}
|
@ -23,6 +23,7 @@ package com.pixelgamelibrary.api.interfaces;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface AudioI {
|
public interface Audio {
|
||||||
|
//Add MIDI support - todo
|
||||||
|
|
||||||
}
|
}
|
@ -19,12 +19,50 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.pixelgamelibrary.api.interfaces;
|
package com.pixelgamelibrary.api.interfaces;
|
||||||
|
|
||||||
|
import com.pixelgamelibrary.api.storage.FileHandle;
|
||||||
import com.pixelgamelibrary.api.storage.Storage;
|
import com.pixelgamelibrary.api.storage.Storage;
|
||||||
|
import com.pixelgamelibrary.api.storage.StorageException;
|
||||||
|
import com.pixelgamelibrary.api.storage.StorageType;
|
||||||
|
import static com.pixelgamelibrary.api.storage.StorageType.ASSETS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface StorageI {
|
public interface Files {
|
||||||
Storage getStorage();
|
|
||||||
|
Storage local();
|
||||||
|
|
||||||
|
Storage assets();
|
||||||
|
|
||||||
|
Storage external();
|
||||||
|
|
||||||
|
Storage relative(String absolutePath);
|
||||||
|
|
||||||
|
Storage absolute();
|
||||||
|
|
||||||
|
Storage tmp();
|
||||||
|
|
||||||
|
default FileHandle file(java.lang.String path, StorageType type) {
|
||||||
|
switch (type) {
|
||||||
|
case ASSETS:
|
||||||
|
return assets().file(path);
|
||||||
|
case LOCAL:
|
||||||
|
return local().file(path);
|
||||||
|
case EXTERNAL:
|
||||||
|
return external().file(path);
|
||||||
|
case ABSOLUTE:
|
||||||
|
return absolute().file(path);
|
||||||
|
case TMP:
|
||||||
|
return tmp().file(path);
|
||||||
|
default:
|
||||||
|
throw new StorageException("Unsupported StorageType: " + type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isExternalStorageAvailable();
|
||||||
|
|
||||||
|
String getLocalStoragePath();
|
||||||
|
|
||||||
|
String getExternalStoragePath();
|
||||||
}
|
}
|
@ -20,13 +20,16 @@
|
|||||||
package com.pixelgamelibrary.api.interfaces;
|
package com.pixelgamelibrary.api.interfaces;
|
||||||
|
|
||||||
import com.pixelgamelibrary.api.WindowMode;
|
import com.pixelgamelibrary.api.WindowMode;
|
||||||
|
import com.pixelgamelibrary.api.utils.Monitor;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface GraphicsI {
|
public interface Graphics {
|
||||||
boolean setToOriginalDisplayMode();
|
boolean setToOriginalDisplayMode();
|
||||||
WindowMode setDisplayMode(boolean fullscreen, boolean window);
|
WindowMode setDisplayMode(boolean fullscreen, boolean window);
|
||||||
|
List<Monitor> getMonitors();
|
||||||
|
|
||||||
}
|
}
|
@ -23,6 +23,6 @@ package com.pixelgamelibrary.api.interfaces;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface InputI {
|
public interface Input {
|
||||||
|
|
||||||
}
|
}
|
@ -24,5 +24,5 @@ package com.pixelgamelibrary.api.interfaces;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface InternalI {
|
public interface Internal {
|
||||||
}
|
}
|
@ -23,6 +23,6 @@ package com.pixelgamelibrary.api.interfaces;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface NetI {
|
public interface Net {
|
||||||
|
|
||||||
}
|
}
|
@ -25,14 +25,13 @@ package com.pixelgamelibrary.api.interfaces;
|
|||||||
*/
|
*/
|
||||||
public interface PixelBackend {
|
public interface PixelBackend {
|
||||||
|
|
||||||
AppI app();
|
App app();
|
||||||
GraphicsI graphics();
|
Graphics graphics();
|
||||||
AudioI audio();
|
Audio audio();
|
||||||
InputI input();
|
Input input();
|
||||||
NetI net();
|
Net net();
|
||||||
AssetI asset();
|
Files files();
|
||||||
StorageI storage();
|
Utils utils();
|
||||||
UtilsI utils();
|
Internal internal();
|
||||||
InternalI internal();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.pixelgamelibrary.api.interfaces;
|
package com.pixelgamelibrary.api.interfaces;
|
||||||
|
|
||||||
|
import com.pixelgamelibrary.api.utils.CollectionUtils;
|
||||||
|
import com.pixelgamelibrary.api.utils.ReflectionUtils;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -29,12 +31,14 @@ import java.util.stream.Stream;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface UtilsI {
|
public interface Utils {
|
||||||
XmlElement parseXml(String xmlString);
|
XmlElement parseXml(String xmlString);
|
||||||
default String decodeBase64AsString(String string) {
|
default String decodeBase64AsString(String string) {
|
||||||
return new String(decodeBase64AsByteArray(string));
|
return new String(decodeBase64AsByteArray(string));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//json support - todo
|
||||||
|
|
||||||
byte[] decodeBase64AsByteArray(String string);
|
byte[] decodeBase64AsByteArray(String string);
|
||||||
|
|
||||||
default String encodeToBase64(String string) {
|
default String encodeToBase64(String string) {
|
||||||
@ -51,5 +55,7 @@ public interface UtilsI {
|
|||||||
default Stream<String> splitStringToLinesAsStream(String string) {
|
default Stream<String> splitStringToLinesAsStream(String string) {
|
||||||
return Arrays.asList(string.split("\\r?\\n")).stream();
|
return Arrays.asList(string.split("\\r?\\n")).stream();
|
||||||
}
|
}
|
||||||
|
ReflectionUtils reflection();
|
||||||
|
CollectionUtils collections();
|
||||||
|
|
||||||
}
|
}
|
@ -17,7 +17,6 @@
|
|||||||
// <https://www.gnu.org/licenses/> or write to the Free Software
|
// <https://www.gnu.org/licenses/> or write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
package com.pixelgamelibrary.api.storage;
|
package com.pixelgamelibrary.api.storage;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -27,12 +26,19 @@ import java.util.List;
|
|||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface FileHandle {
|
public interface FileHandle {
|
||||||
|
|
||||||
FileType type();
|
FileType type();
|
||||||
|
|
||||||
String path();
|
String path();
|
||||||
|
|
||||||
String name();
|
String name();
|
||||||
|
|
||||||
String extension();
|
String extension();
|
||||||
|
|
||||||
String nameWithoutExtension();
|
String nameWithoutExtension();
|
||||||
|
|
||||||
List<FileHandle> list();
|
List<FileHandle> list();
|
||||||
|
|
||||||
default boolean isDirectory() {
|
default boolean isDirectory() {
|
||||||
return type() == FileType.DIRECTORY;
|
return type() == FileType.DIRECTORY;
|
||||||
}
|
}
|
||||||
@ -40,26 +46,48 @@ public interface FileHandle {
|
|||||||
default boolean isRegularFile() {
|
default boolean isRegularFile() {
|
||||||
return type() == FileType.FILE;
|
return type() == FileType.FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileHandle child(String name);
|
FileHandle child(String name);
|
||||||
|
|
||||||
FileHandle sibling(String name);
|
FileHandle sibling(String name);
|
||||||
|
|
||||||
FileHandle parent();
|
FileHandle parent();
|
||||||
|
|
||||||
boolean mkdir();
|
boolean mkdir();
|
||||||
|
|
||||||
boolean mkdirs();
|
boolean mkdirs();
|
||||||
|
|
||||||
boolean exists();
|
boolean exists();
|
||||||
|
|
||||||
boolean delete();
|
boolean delete();
|
||||||
|
|
||||||
boolean deleteDirectory();
|
boolean deleteDirectory();
|
||||||
|
|
||||||
boolean emptyDirectory();
|
boolean emptyDirectory();
|
||||||
|
|
||||||
boolean copyTo(FileHandle destination);
|
boolean copyTo(FileHandle destination);
|
||||||
|
|
||||||
boolean moveTo(FileHandle destination);
|
boolean moveTo(FileHandle destination);
|
||||||
|
|
||||||
long length();
|
long length();
|
||||||
|
|
||||||
FileHandle tempFile(String prefix);
|
FileHandle tempFile(String prefix);
|
||||||
|
|
||||||
FileHandle tempDirectory(String prefix);
|
FileHandle tempDirectory(String prefix);
|
||||||
|
|
||||||
int depth();
|
int depth();
|
||||||
|
|
||||||
boolean writeString(String text);
|
boolean writeString(String text);
|
||||||
|
|
||||||
boolean appendString(String text);
|
boolean appendString(String text);
|
||||||
|
|
||||||
String readString();
|
String readString();
|
||||||
|
|
||||||
boolean writeBytes(byte[] data);
|
boolean writeBytes(byte[] data);
|
||||||
|
|
||||||
byte[] readBytes();
|
byte[] readBytes();
|
||||||
|
|
||||||
|
void flush();
|
||||||
|
|
||||||
|
Storage getStorage();
|
||||||
}
|
}
|
||||||
|
@ -221,4 +221,14 @@ public class FileHandleImpl implements FileHandle {
|
|||||||
return storage.readBytes(path);
|
return storage.readBytes(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void flush() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Storage getStorage() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,9 @@ import com.pixelgamelibrary.api.Platform;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface provides the methods to interact with the underlying storage system.
|
* This interface provides the methods to interact with the underlying storage
|
||||||
* It supports basic file system operations such as navigating directories, creating files
|
* system. It supports basic file system operations such as navigating
|
||||||
* and directories, and reading/writing data.
|
* directories, creating files and directories, and reading/writing data.
|
||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
@ -49,8 +49,8 @@ public interface Storage {
|
|||||||
public String changeDirectory(String path);
|
public String changeDirectory(String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the directory to the default "home/user" directory, creating the necessary
|
* Changes the directory to the default "home/user" directory, creating the
|
||||||
* directories if they do not exist.
|
* necessary directories if they do not exist.
|
||||||
*
|
*
|
||||||
* @return a result message or an empty string if successful.
|
* @return a result message or an empty string if successful.
|
||||||
*/
|
*/
|
||||||
@ -108,7 +108,8 @@ public interface Storage {
|
|||||||
/**
|
/**
|
||||||
* Lists the contents of the current working directory.
|
* Lists the contents of the current working directory.
|
||||||
*
|
*
|
||||||
* @return a list of file and directory names in the current working directory.
|
* @return a list of file and directory names in the current working
|
||||||
|
* directory.
|
||||||
*/
|
*/
|
||||||
default List<String> list() {
|
default List<String> list() {
|
||||||
return list(printWorkingDirectory());
|
return list(printWorkingDirectory());
|
||||||
@ -240,7 +241,8 @@ public interface Storage {
|
|||||||
public boolean isDirectory(String name);
|
public boolean isDirectory(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a debug string with information about the current state of the storage.
|
* Returns a debug string with information about the current state of the
|
||||||
|
* storage.
|
||||||
*
|
*
|
||||||
* @return a debug string.
|
* @return a debug string.
|
||||||
*/
|
*/
|
||||||
@ -261,8 +263,8 @@ public interface Storage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the size of this storage is limited, returns the number of bytes it is limited to.
|
* If the size of this storage is limited, returns the number of bytes it is
|
||||||
* Otherwise, returns 0.
|
* limited to. Otherwise, returns 0.
|
||||||
*
|
*
|
||||||
* @return the size limit in bytes, or 0 if there is no limit.
|
* @return the size limit in bytes, or 0 if there is no limit.
|
||||||
*/
|
*/
|
||||||
@ -279,6 +281,7 @@ public interface Storage {
|
|||||||
path = convertToAbsolutePathIfNeeded(path);
|
path = convertToAbsolutePathIfNeeded(path);
|
||||||
return new FileHandleImpl(this, path);
|
return new FileHandleImpl(this, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
default FileHandle file() {
|
default FileHandle file() {
|
||||||
return file(printWorkingDirectory());
|
return file(printWorkingDirectory());
|
||||||
}
|
}
|
||||||
@ -287,7 +290,6 @@ public interface Storage {
|
|||||||
|
|
||||||
RegularFileType getRegularFileType(String path);
|
RegularFileType getRegularFileType(String path);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a path to an absolute path if it is not already absolute.
|
* Converts a path to an absolute path if it is not already absolute.
|
||||||
*
|
*
|
||||||
@ -300,6 +302,7 @@ public interface Storage {
|
|||||||
}
|
}
|
||||||
return printWorkingDirectory() + (printWorkingDirectory().equals("/") ? "" : SLASH) + path;
|
return printWorkingDirectory() + (printWorkingDirectory().equals("/") ? "" : SLASH) + path;
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean isTextFile(String content) {
|
default boolean isTextFile(String content) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@ -317,4 +320,37 @@ public interface Storage {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves and returns the current state of the storage.
|
||||||
|
*
|
||||||
|
* @param methodName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
byte[] backup(String methodName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces the current content of the storage.
|
||||||
|
* @param methodName
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
void restore(String methodName, byte[] data);
|
||||||
|
|
||||||
|
boolean isReadonly();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the maximum size in count of bytes of the storage. If the maximum
|
||||||
|
* size is not defined for this storage, then 0 is returned. default long
|
||||||
|
* getMaxSize() { return 0; }
|
||||||
|
*
|
||||||
|
* /**
|
||||||
|
* Deletes all the content in the storage.
|
||||||
|
*/
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
boolean isEmpty();
|
||||||
|
|
||||||
|
long size();
|
||||||
|
|
||||||
|
StorageType getStorageType();
|
||||||
}
|
}
|
||||||
|
@ -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.storage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public enum StorageType {
|
||||||
|
ASSETS,
|
||||||
|
LOCAL,
|
||||||
|
EXTERNAL,
|
||||||
|
ABSOLUTE,
|
||||||
|
TMP,
|
||||||
|
UNDEFINED;
|
||||||
|
}
|
@ -25,6 +25,7 @@ import com.pixelgamelibrary.api.storage.FileType;
|
|||||||
import com.pixelgamelibrary.api.storage.RegularFileType;
|
import com.pixelgamelibrary.api.storage.RegularFileType;
|
||||||
import com.pixelgamelibrary.api.storage.StorageException;
|
import com.pixelgamelibrary.api.storage.StorageException;
|
||||||
import com.pixelgamelibrary.api.storage.Storage;
|
import com.pixelgamelibrary.api.storage.Storage;
|
||||||
|
import com.pixelgamelibrary.api.storage.StorageType;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -407,4 +408,39 @@ public class MapStorage implements Storage {
|
|||||||
|
|
||||||
return text.startsWith(BINARYFILE) ? RegularFileType.BINARY : RegularFileType.TEXT;
|
return text.startsWith(BINARYFILE) ? RegularFileType.BINARY : RegularFileType.TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] backup(String methodName) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void restore(String methodName, byte[] data) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isReadonly() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEmpty() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long size() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StorageType getStorageType() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
29
src/main/java/com/pixelgamelibrary/api/utils/Animation.java
Normal file
29
src/main/java/com/pixelgamelibrary/api/utils/Animation.java
Normal 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface Animation {
|
||||||
|
|
||||||
|
}
|
@ -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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface AudioDevice {
|
||||||
|
|
||||||
|
}
|
@ -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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface AudioRecorder {
|
||||||
|
|
||||||
|
}
|
29
src/main/java/com/pixelgamelibrary/api/utils/Camera.java
Normal file
29
src/main/java/com/pixelgamelibrary/api/utils/Camera.java
Normal 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface Camera {
|
||||||
|
|
||||||
|
}
|
32
src/main/java/com/pixelgamelibrary/api/utils/ClipBoard.java
Normal file
32
src/main/java/com/pixelgamelibrary/api/utils/ClipBoard.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public class ClipBoard {
|
||||||
|
public ClipBoard() {
|
||||||
|
//todo
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface CollectionUtils {
|
||||||
|
|
||||||
|
}
|
29
src/main/java/com/pixelgamelibrary/api/utils/Color.java
Normal file
29
src/main/java/com/pixelgamelibrary/api/utils/Color.java
Normal 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface Color {
|
||||||
|
|
||||||
|
}
|
32
src/main/java/com/pixelgamelibrary/api/utils/Cursor.java
Normal file
32
src/main/java/com/pixelgamelibrary/api/utils/Cursor.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public class Cursor {
|
||||||
|
public Cursor() {
|
||||||
|
//todo
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public enum CursorViewWithoutMouse {
|
||||||
|
NONE, NORMAL, MOVE;
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public class DisplayMode {
|
||||||
|
private int width, height, refreshRate, bitsPerPixel;
|
||||||
|
|
||||||
|
public DisplayMode() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
29
src/main/java/com/pixelgamelibrary/api/utils/Disposable.java
Normal file
29
src/main/java/com/pixelgamelibrary/api/utils/Disposable.java
Normal 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface Disposable {
|
||||||
|
|
||||||
|
}
|
@ -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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface LifecycleListener {
|
||||||
|
|
||||||
|
}
|
29
src/main/java/com/pixelgamelibrary/api/utils/LogLevel.java
Normal file
29
src/main/java/com/pixelgamelibrary/api/utils/LogLevel.java
Normal 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public enum LogLevel {
|
||||||
|
NONE, ERROR, INFO, WARN, DEBUG;
|
||||||
|
}
|
32
src/main/java/com/pixelgamelibrary/api/utils/Monitor.java
Normal file
32
src/main/java/com/pixelgamelibrary/api/utils/Monitor.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public class Monitor {
|
||||||
|
public Monitor() {
|
||||||
|
//todo
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
29
src/main/java/com/pixelgamelibrary/api/utils/PixMap.java
Normal file
29
src/main/java/com/pixelgamelibrary/api/utils/PixMap.java
Normal 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface PixMap {
|
||||||
|
|
||||||
|
}
|
@ -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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface Preferences {
|
||||||
|
|
||||||
|
}
|
@ -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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface ReflectionUtils {
|
||||||
|
|
||||||
|
}
|
@ -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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface ShapeRenderer {
|
||||||
|
|
||||||
|
}
|
29
src/main/java/com/pixelgamelibrary/api/utils/Sprite.java
Normal file
29
src/main/java/com/pixelgamelibrary/api/utils/Sprite.java
Normal 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface Sprite {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface SpriteBatch {
|
||||||
|
|
||||||
|
//https://libgdx.com/wiki/graphics/2d/spritebatch-textureregions-and-sprites
|
||||||
|
//draw (Texture texture, float x, float y) Draws the texture using the texture's width and height.
|
||||||
|
//draw (Texture texture, float x, float y, int srcX, int srcY, int srcWidth, int srcHeight) Draws a portion of the texture.
|
||||||
|
//draw (Texture texture, float x, float y, float width, float height, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY) Draws a portion of a texture, stretched to the width and height, and optionally flipped.
|
||||||
|
//draw (Texture texture, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY) This monster method draws a portion of a texture, stretched to the width and height, scaled and rotated around an origin, and optionally flipped.
|
||||||
|
//draw (Texture texture, float x, float y, float width, float height, float u, float v, float u2, float v2) This draws a portion of a texture, stretched to the width and height. This is a somewhat advanced method as it uses texture coordinates from 0-1 rather than pixel coordinates.
|
||||||
|
//draw (Texture texture, float[] spriteVertices, int offset, int length) This is an advanced method for passing in the raw geometry, texture coordinates, and color information. This can be used to draw any quadrilateral, not just rectangles.
|
||||||
|
|
||||||
|
}
|
30
src/main/java/com/pixelgamelibrary/api/utils/Texture.java
Normal file
30
src/main/java/com/pixelgamelibrary/api/utils/Texture.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface Texture {
|
||||||
|
void makeColorTransparent(int r, int g, int b);
|
||||||
|
void scale(double d);
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public class TextureAtlas {
|
||||||
|
public TextureAtlas() {
|
||||||
|
//todo
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public class TextureRegion {
|
||||||
|
public TextureRegion() {
|
||||||
|
//todo
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public class TmpDirectoryRegistry {
|
||||||
|
public TmpDirectoryRegistry() {
|
||||||
|
//todo
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public enum VibrationType {
|
||||||
|
NONE, ERROR, INFO, WARN, DEBUG;
|
||||||
|
}
|
@ -1,18 +1,8 @@
|
|||||||
package com.pixelgamelibrary.api.storage.map;
|
package com.pixelgamelibrary.api.storage.map;
|
||||||
|
|
||||||
import com.pixelgamelibrary.api.GameI;
|
|
||||||
import com.pixelgamelibrary.api.Pixel;
|
import com.pixelgamelibrary.api.Pixel;
|
||||||
import com.pixelgamelibrary.api.Platform;
|
import com.pixelgamelibrary.api.Platform;
|
||||||
import com.pixelgamelibrary.api.interfaces.AppI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.AssetI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.AudioI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.GraphicsI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.InputI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.InternalI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.NetI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.PixelBackend;
|
import com.pixelgamelibrary.api.interfaces.PixelBackend;
|
||||||
import com.pixelgamelibrary.api.interfaces.StorageI;
|
|
||||||
import com.pixelgamelibrary.api.interfaces.UtilsI;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
@ -21,6 +11,19 @@ import java.util.List;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.Files;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.Audio;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.Graphics;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.Input;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.Internal;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.Net;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.Utils;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.App;
|
||||||
|
import com.pixelgamelibrary.api.Game;
|
||||||
|
import com.pixelgamelibrary.api.PixelFeature;
|
||||||
|
import com.pixelgamelibrary.api.utils.ClipBoard;
|
||||||
|
import com.pixelgamelibrary.api.utils.LogLevel;
|
||||||
|
import com.pixelgamelibrary.api.utils.Preferences;
|
||||||
|
|
||||||
// Tests for MapStorage class
|
// Tests for MapStorage class
|
||||||
public class MapStorageTest {
|
public class MapStorageTest {
|
||||||
@ -32,8 +35,8 @@ public class MapStorageTest {
|
|||||||
|
|
||||||
PixelBackend dummyPixelBackend = new PixelBackend() {
|
PixelBackend dummyPixelBackend = new PixelBackend() {
|
||||||
@Override
|
@Override
|
||||||
public AppI app() {
|
public App app() {
|
||||||
return new AppI() {
|
return new App() {
|
||||||
@Override
|
@Override
|
||||||
public Platform getPlatform() {
|
public Platform getPlatform() {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
@ -79,12 +82,42 @@ public class MapStorageTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGame(GameI game) {
|
public void setGame(Game game) {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameI getGame() {
|
public Game getGame() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLogLevel(LogLevel logLevel) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Preferences getPreferences(String preferencesName) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFeatureEnabled(PixelFeature feature) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isMobileDevice() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postRunnable(Runnable runnable) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClipBoard getClipBoard() {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,42 +125,37 @@ public class MapStorageTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GraphicsI graphics() {
|
public Graphics graphics() {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AudioI audio() {
|
public Audio audio() {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputI input() {
|
public Input input() {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NetI net() {
|
public Net net() {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AssetI asset() {
|
public Files files() {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StorageI storage() {
|
public Utils utils() {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UtilsI utils() {
|
public Internal internal() {
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public InternalI internal() {
|
|
||||||
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user