Bug 20: Rework and refactor the Screen class
This commit is contained in:
parent
e7ef3decd3
commit
882d5466f8
@ -0,0 +1,40 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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 interface ApplicationListener {
|
||||||
|
|
||||||
|
void resize(int width, int height);
|
||||||
|
|
||||||
|
void show();
|
||||||
|
|
||||||
|
void hide();
|
||||||
|
|
||||||
|
void pause();
|
||||||
|
|
||||||
|
void resume();
|
||||||
|
|
||||||
|
void dispose();
|
||||||
|
|
||||||
|
}
|
91
src/main/java/com/pixelgamelibrary/api/GameAdapter.java
Normal file
91
src/main/java/com/pixelgamelibrary/api/GameAdapter.java
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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 class GameAdapter implements GameI {
|
||||||
|
|
||||||
|
private ScreenI screen;
|
||||||
|
private OnSetScreenListener setOnSetScreenListener;
|
||||||
|
@Override
|
||||||
|
public void create() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setScreen(ScreenI screen) {
|
||||||
|
this.screen = screen;
|
||||||
|
System.out.println("setOnSetScreenListener=" + setOnSetScreenListener);
|
||||||
|
if(setOnSetScreenListener != null) {
|
||||||
|
setOnSetScreenListener.onSetScreen(screen);
|
||||||
|
}
|
||||||
|
System.out.println("GameAdapter:setScreen");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScreenI getScreen() {
|
||||||
|
return screen;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resize(int width, int height) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pause() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resume() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOnSetScreenListener(OnSetScreenListener setScreenListener) {
|
||||||
|
this.setOnSetScreenListener = setScreenListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
37
src/main/java/com/pixelgamelibrary/api/GameI.java
Normal file
37
src/main/java/com/pixelgamelibrary/api/GameI.java
Normal file
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface GameI extends ApplicationListener {
|
||||||
|
|
||||||
|
void create();
|
||||||
|
|
||||||
|
void setScreen(ScreenI screen);
|
||||||
|
|
||||||
|
ScreenI getScreen();
|
||||||
|
|
||||||
|
void render();
|
||||||
|
|
||||||
|
void setOnSetScreenListener(OnSetScreenListener setScreenListener);
|
||||||
|
}
|
90
src/main/java/com/pixelgamelibrary/api/GameWrapper.java
Normal file
90
src/main/java/com/pixelgamelibrary/api/GameWrapper.java
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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 class GameWrapper implements GameI {
|
||||||
|
|
||||||
|
private final GameI game;
|
||||||
|
|
||||||
|
public GameWrapper(GameI gameI) {
|
||||||
|
this.game = gameI;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create() {
|
||||||
|
game.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setScreen(ScreenI screen) {
|
||||||
|
game.setScreen(screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScreenI getScreen() {
|
||||||
|
return game.getScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render() {
|
||||||
|
game.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resize(int width, int height) {
|
||||||
|
game.resize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
game.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide() {
|
||||||
|
game.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pause() {
|
||||||
|
game.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resume() {
|
||||||
|
game.resume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
game.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOnSetScreenListener(OnSetScreenListener setScreenListener) {
|
||||||
|
game.setOnSetScreenListener(setScreenListener);
|
||||||
|
}
|
||||||
|
}
|
@ -17,13 +17,14 @@
|
|||||||
// <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;
|
package com.pixelgamelibrary.api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public abstract class Game extends com.badlogic.gdx.Game {
|
public interface OnSetScreenListener {
|
||||||
|
void onSetScreen(ScreenI screen);
|
||||||
|
|
||||||
}
|
}
|
@ -24,6 +24,7 @@ import com.pixelgamelibrary.api.interfaces.AssetI;
|
|||||||
import com.pixelgamelibrary.api.interfaces.AudioI;
|
import com.pixelgamelibrary.api.interfaces.AudioI;
|
||||||
import com.pixelgamelibrary.api.interfaces.GraphicsI;
|
import com.pixelgamelibrary.api.interfaces.GraphicsI;
|
||||||
import com.pixelgamelibrary.api.interfaces.InputI;
|
import com.pixelgamelibrary.api.interfaces.InputI;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.InternalI;
|
||||||
import com.pixelgamelibrary.api.interfaces.NetI;
|
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.StorageI;
|
||||||
@ -77,6 +78,10 @@ public class Pixel {
|
|||||||
public static UtilsI utils() {
|
public static UtilsI utils() {
|
||||||
return get().utils();
|
return get().utils();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static InternalI internal() {
|
||||||
|
return get().internal();
|
||||||
|
}
|
||||||
////
|
////
|
||||||
|
|
||||||
public static void initBackend(PixelBackend pixelBackend) {
|
public static void initBackend(PixelBackend pixelBackend) {
|
||||||
|
50
src/main/java/com/pixelgamelibrary/api/PixelApplication.java
Normal file
50
src/main/java/com/pixelgamelibrary/api/PixelApplication.java
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public abstract class PixelApplication {
|
||||||
|
abstract public GameI createGameViaMap(Map<String, Object> objects);
|
||||||
|
|
||||||
|
public GameI createGame() {
|
||||||
|
return createGame(new HashMap<>());
|
||||||
|
}
|
||||||
|
public GameI createGame(Object... objects) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
int i = 0;
|
||||||
|
int maxI = objects.length - 1;
|
||||||
|
while(i<objects.length) {
|
||||||
|
|
||||||
|
String key = (String)objects[i];
|
||||||
|
i++;
|
||||||
|
Object value = i > maxI ? null : objects[i];
|
||||||
|
map.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return createGameViaMap(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -24,9 +24,10 @@ package com.pixelgamelibrary.api;
|
|||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public enum Platform {
|
public enum Platform {
|
||||||
DESKTOP, ANDROID, WEB;
|
DESKTOP, ANDROID, WEB, IOS;
|
||||||
public boolean isDesktop() {return this == DESKTOP;}
|
public boolean isDesktop() {return this == DESKTOP;}
|
||||||
public boolean isAndroid() {return this == ANDROID;}
|
public boolean isAndroid() {return this == ANDROID;}
|
||||||
public boolean isWeb() {return this == WEB;}
|
public boolean isWeb() {return this == WEB;}
|
||||||
|
public boolean isIOS() {return this == IOS;}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
64
src/main/java/com/pixelgamelibrary/api/ScreenAdapter.java
Normal file
64
src/main/java/com/pixelgamelibrary/api/ScreenAdapter.java
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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 class ScreenAdapter implements ScreenI{
|
||||||
|
private GameI game = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resize(int width, int height) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(float delta) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pause() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resume() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -23,6 +23,7 @@ package com.pixelgamelibrary.api;
|
|||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public abstract class Screen extends com.badlogic.gdx.ScreenAdapter {
|
public interface ScreenI extends ApplicationListener {
|
||||||
|
|
||||||
|
void render(float delta);
|
||||||
}
|
}
|
70
src/main/java/com/pixelgamelibrary/api/ScreenWrapper.java
Normal file
70
src/main/java/com/pixelgamelibrary/api/ScreenWrapper.java
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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 class ScreenWrapper implements ScreenI {
|
||||||
|
|
||||||
|
private final ScreenI screen;
|
||||||
|
|
||||||
|
public ScreenWrapper(ScreenI screenIn) {
|
||||||
|
this.screen = screenIn;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void render(float delta) {
|
||||||
|
screen.render(delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resize(int width, int height) {
|
||||||
|
screen.resize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
screen.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide() {
|
||||||
|
screen.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pause() {
|
||||||
|
screen.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resume() {
|
||||||
|
screen.resume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
screen.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -17,18 +17,14 @@
|
|||||||
// <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;
|
package com.pixelgamelibrary.api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public class WindowMode {
|
public enum WindowMode {
|
||||||
|
|
||||||
private WindowMode() {
|
WINDOW, FULLSCREEN;
|
||||||
//Not meant to be instantiated.
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String WINDOW = "WINDOW";
|
|
||||||
public static final String FULLSCREEN = "FULLSCREEN";
|
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.pixelgamelibrary.api.interfaces;
|
package com.pixelgamelibrary.api.interfaces;
|
||||||
|
|
||||||
|
import com.pixelgamelibrary.api.GameI;
|
||||||
import com.pixelgamelibrary.api.Platform;
|
import com.pixelgamelibrary.api.Platform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,4 +46,8 @@ public interface AppI {
|
|||||||
String getAppName();
|
String getAppName();
|
||||||
boolean isAppNameSet();
|
boolean isAppNameSet();
|
||||||
|
|
||||||
|
void setGame(GameI game);
|
||||||
|
|
||||||
|
GameI getGame();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,14 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.pixelgamelibrary.api.interfaces;
|
package com.pixelgamelibrary.api.interfaces;
|
||||||
|
|
||||||
|
import com.pixelgamelibrary.api.WindowMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public interface GraphicsI {
|
public interface GraphicsI {
|
||||||
boolean setToOriginalDisplayMode();
|
boolean setToOriginalDisplayMode();
|
||||||
String setDisplayMode(boolean fullscreen, boolean window);
|
WindowMode setDisplayMode(boolean fullscreen, boolean window);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author robertvokac
|
||||||
|
*/
|
||||||
|
public interface InternalI {
|
||||||
|
}
|
@ -25,8 +25,6 @@ package com.pixelgamelibrary.api.interfaces;
|
|||||||
*/
|
*/
|
||||||
public interface PixelBackend {
|
public interface PixelBackend {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AppI app();
|
AppI app();
|
||||||
GraphicsI graphics();
|
GraphicsI graphics();
|
||||||
AudioI audio();
|
AudioI audio();
|
||||||
@ -35,5 +33,6 @@ public interface PixelBackend {
|
|||||||
AssetI asset();
|
AssetI asset();
|
||||||
StorageI storage();
|
StorageI storage();
|
||||||
UtilsI utils();
|
UtilsI utils();
|
||||||
|
InternalI internal();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
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.AppI;
|
||||||
@ -7,6 +8,7 @@ import com.pixelgamelibrary.api.interfaces.AssetI;
|
|||||||
import com.pixelgamelibrary.api.interfaces.AudioI;
|
import com.pixelgamelibrary.api.interfaces.AudioI;
|
||||||
import com.pixelgamelibrary.api.interfaces.GraphicsI;
|
import com.pixelgamelibrary.api.interfaces.GraphicsI;
|
||||||
import com.pixelgamelibrary.api.interfaces.InputI;
|
import com.pixelgamelibrary.api.interfaces.InputI;
|
||||||
|
import com.pixelgamelibrary.api.interfaces.InternalI;
|
||||||
import com.pixelgamelibrary.api.interfaces.NetI;
|
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.StorageI;
|
||||||
@ -75,6 +77,16 @@ public class MapStorageTest {
|
|||||||
public boolean isAppNameSet() {
|
public boolean isAppNameSet() {
|
||||||
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
|
||||||
|
public void setGame(GameI game) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GameI getGame() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -113,6 +125,11 @@ public class MapStorageTest {
|
|||||||
public UtilsI utils() {
|
public UtilsI 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
|
||||||
|
public InternalI internal() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Pixel.initBackend(dummyPixelBackend);
|
Pixel.initBackend(dummyPixelBackend);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user