guicy new way of running the app
This commit is contained in:
parent
3b49792554
commit
ebda622c2c
10
pom.xml
10
pom.xml
|
@ -144,6 +144,16 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.inject</groupId>
|
||||||
|
<artifactId>guice</artifactId>
|
||||||
|
<version>4.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.inject.extensions</groupId>
|
||||||
|
<artifactId>guice-assistedinject</artifactId>
|
||||||
|
<version>4.1.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jcraft</groupId>
|
<groupId>org.jcraft</groupId>
|
||||||
<artifactId>jorbis</artifactId>
|
<artifactId>jorbis</artifactId>
|
||||||
|
|
44
src/yugecin/opsudance/OpsuDance.java
Normal file
44
src/yugecin/opsudance/OpsuDance.java
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2017 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance 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.
|
||||||
|
*
|
||||||
|
* opsu!dance 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 opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import org.newdawn.slick.SlickException;
|
||||||
|
import yugecin.opsudance.core.Container;
|
||||||
|
import yugecin.opsudance.core.Demux;
|
||||||
|
|
||||||
|
public class OpsuDance {
|
||||||
|
|
||||||
|
private final Demux stateDemultiplexer;
|
||||||
|
private final Container container;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public OpsuDance(Demux stateDemultiplexer, Container container) {
|
||||||
|
this.stateDemultiplexer = stateDemultiplexer;
|
||||||
|
this.container = container;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start() {
|
||||||
|
try {
|
||||||
|
container.start();
|
||||||
|
} catch (SlickException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
67
src/yugecin/opsudance/PreStartupInitializer.java
Normal file
67
src/yugecin/opsudance/PreStartupInitializer.java
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2017 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance 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.
|
||||||
|
*
|
||||||
|
* opsu!dance 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 opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import itdelatrisu.opsu.NativeLoader;
|
||||||
|
import itdelatrisu.opsu.Options;
|
||||||
|
import itdelatrisu.opsu.Utils;
|
||||||
|
import org.newdawn.slick.util.FileSystemLocation;
|
||||||
|
import org.newdawn.slick.util.Log;
|
||||||
|
import org.newdawn.slick.util.ResourceLoader;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class PreStartupInitializer {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public PreStartupInitializer() {
|
||||||
|
// load natives
|
||||||
|
File nativeDir;
|
||||||
|
if (!Utils.isJarRunning() && (
|
||||||
|
(nativeDir = new File("./target/natives/")).isDirectory() ||
|
||||||
|
(nativeDir = new File("./build/natives/")).isDirectory()))
|
||||||
|
;
|
||||||
|
else {
|
||||||
|
nativeDir = Options.NATIVE_DIR;
|
||||||
|
try {
|
||||||
|
new NativeLoader(nativeDir).loadNatives();
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.error("Error loading natives.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.setProperty("org.lwjgl.librarypath", nativeDir.getAbsolutePath());
|
||||||
|
System.setProperty("java.library.path", nativeDir.getAbsolutePath());
|
||||||
|
try {
|
||||||
|
// Workaround for "java.library.path" property being read-only.
|
||||||
|
// http://stackoverflow.com/a/24988095
|
||||||
|
Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
|
||||||
|
fieldSysPath.setAccessible(true);
|
||||||
|
fieldSysPath.set(null, null);
|
||||||
|
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
Log.warn("Failed to set 'sys_paths' field.", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the resource paths
|
||||||
|
ResourceLoader.addResourceLocation(new FileSystemLocation(new File("./res/")));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
67
src/yugecin/opsudance/core/Container.java
Normal file
67
src/yugecin/opsudance/core/Container.java
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2017 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance 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.
|
||||||
|
*
|
||||||
|
* opsu!dance 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 opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance.core;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import org.lwjgl.opengl.Display;
|
||||||
|
import org.newdawn.slick.AppGameContainer;
|
||||||
|
import org.newdawn.slick.SlickException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* based on itdelatrisu.opsu.Container
|
||||||
|
*/
|
||||||
|
public class Container extends AppGameContainer {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public Container(Demux demux) throws SlickException {
|
||||||
|
super(demux);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() throws SlickException {
|
||||||
|
try {
|
||||||
|
setup();
|
||||||
|
getDelta();
|
||||||
|
while (running())
|
||||||
|
gameLoop();
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void gameLoop() throws SlickException {
|
||||||
|
int delta = getDelta();
|
||||||
|
if (!Display.isVisible() && updateOnlyOnVisible) {
|
||||||
|
try { Thread.sleep(100); } catch (Exception e) {}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
updateAndRender(delta);
|
||||||
|
} catch (SlickException e) {
|
||||||
|
running = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateFPS();
|
||||||
|
Display.update();
|
||||||
|
if (Display.isCloseRequested()) {
|
||||||
|
if (game.closeRequested())
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
23
src/yugecin/opsudance/core/ContainerWrapper.java
Normal file
23
src/yugecin/opsudance/core/ContainerWrapper.java
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2017 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance 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.
|
||||||
|
*
|
||||||
|
* opsu!dance 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 opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance.core;
|
||||||
|
|
||||||
|
public class ContainerWrapper {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
65
src/yugecin/opsudance/core/Demux.java
Normal file
65
src/yugecin/opsudance/core/Demux.java
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2017 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance 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.
|
||||||
|
*
|
||||||
|
* opsu!dance 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 opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance.core;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import org.newdawn.slick.Game;
|
||||||
|
import org.newdawn.slick.GameContainer;
|
||||||
|
import org.newdawn.slick.Graphics;
|
||||||
|
import org.newdawn.slick.SlickException;
|
||||||
|
import yugecin.opsudance.kernel.InstanceContainer;
|
||||||
|
import yugecin.opsudance.states.EmptyState;
|
||||||
|
import yugecin.opsudance.states.GameState;
|
||||||
|
|
||||||
|
public class Demux implements Game {
|
||||||
|
|
||||||
|
private final InstanceContainer instanceContainer;
|
||||||
|
|
||||||
|
private GameState currentState;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public Demux(InstanceContainer instanceContainer) {
|
||||||
|
this.instanceContainer = instanceContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(GameContainer container) throws SlickException {
|
||||||
|
currentState = instanceContainer.provide(EmptyState.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(GameContainer container, int delta) throws SlickException {
|
||||||
|
currentState.update(delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(GameContainer container, Graphics g) throws SlickException {
|
||||||
|
currentState.render(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean closeRequested() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTitle() {
|
||||||
|
return "opsu!dance";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
28
src/yugecin/opsudance/kernel/Entrypoint.java
Normal file
28
src/yugecin/opsudance/kernel/Entrypoint.java
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2017 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance 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.
|
||||||
|
*
|
||||||
|
* opsu!dance 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 opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance.kernel;
|
||||||
|
|
||||||
|
import yugecin.opsudance.OpsuDance;
|
||||||
|
|
||||||
|
public class Entrypoint {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
InstanceContainerImpl.initialize().provide(OpsuDance.class).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
24
src/yugecin/opsudance/kernel/InstanceContainer.java
Normal file
24
src/yugecin/opsudance/kernel/InstanceContainer.java
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2017 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance 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.
|
||||||
|
*
|
||||||
|
* opsu!dance 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 opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance.kernel;
|
||||||
|
|
||||||
|
public interface InstanceContainer {
|
||||||
|
|
||||||
|
<T> T provide(Class<T> type);
|
||||||
|
|
||||||
|
}
|
47
src/yugecin/opsudance/kernel/InstanceContainerImpl.java
Normal file
47
src/yugecin/opsudance/kernel/InstanceContainerImpl.java
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2017 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance 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.
|
||||||
|
*
|
||||||
|
* opsu!dance 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 opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance.kernel;
|
||||||
|
|
||||||
|
import com.google.inject.Guice;
|
||||||
|
import com.google.inject.Injector;
|
||||||
|
|
||||||
|
public class InstanceContainerImpl implements InstanceContainer {
|
||||||
|
|
||||||
|
private static InstanceContainer instance;
|
||||||
|
|
||||||
|
private Injector injector;
|
||||||
|
|
||||||
|
private InstanceContainerImpl() {
|
||||||
|
injector = Guice.createInjector(new OpsuDanceModule());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static InstanceContainer initialize() {
|
||||||
|
return instance = new InstanceContainerImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public static InstanceContainer get() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T provide(Class<T> type) {
|
||||||
|
return injector.getInstance(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
28
src/yugecin/opsudance/kernel/InstanceResolver.java
Normal file
28
src/yugecin/opsudance/kernel/InstanceResolver.java
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2017 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance 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.
|
||||||
|
*
|
||||||
|
* opsu!dance 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 opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance.kernel;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public class InstanceResolver implements InstanceContainer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T provide(Class<T> type) {
|
||||||
|
return InstanceContainerImpl.get().provide(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
34
src/yugecin/opsudance/kernel/OpsuDanceModule.java
Normal file
34
src/yugecin/opsudance/kernel/OpsuDanceModule.java
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2017 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance 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.
|
||||||
|
*
|
||||||
|
* opsu!dance 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 opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance.kernel;
|
||||||
|
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
|
import yugecin.opsudance.PreStartupInitializer;
|
||||||
|
import yugecin.opsudance.core.Container;
|
||||||
|
import yugecin.opsudance.core.Demux;
|
||||||
|
|
||||||
|
public class OpsuDanceModule extends AbstractModule {
|
||||||
|
|
||||||
|
protected void configure() {
|
||||||
|
bind(InstanceContainer.class).to(InstanceResolver.class);
|
||||||
|
bind(PreStartupInitializer.class).asEagerSingleton();
|
||||||
|
bind(Demux.class).asEagerSingleton();
|
||||||
|
bind(Container.class).asEagerSingleton();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
50
src/yugecin/opsudance/states/EmptyState.java
Normal file
50
src/yugecin/opsudance/states/EmptyState.java
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2017 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance 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.
|
||||||
|
*
|
||||||
|
* opsu!dance 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 opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance.states;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import org.newdawn.slick.Graphics;
|
||||||
|
|
||||||
|
public class EmptyState implements GameState {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public EmptyState() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(int delta) {
|
||||||
|
System.out.println("updatin' " + delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Graphics g) {
|
||||||
|
System.out.println("renderin'");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter() {
|
||||||
|
System.out.println("entered");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void leave() {
|
||||||
|
System.out.println("left");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
29
src/yugecin/opsudance/states/GameState.java
Normal file
29
src/yugecin/opsudance/states/GameState.java
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
|
* Copyright (C) 2017 yugecin
|
||||||
|
*
|
||||||
|
* opsu!dance 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.
|
||||||
|
*
|
||||||
|
* opsu!dance 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 opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package yugecin.opsudance.states;
|
||||||
|
|
||||||
|
import org.newdawn.slick.Graphics;
|
||||||
|
|
||||||
|
public interface GameState {
|
||||||
|
|
||||||
|
void update(int delta);
|
||||||
|
void render(Graphics g);
|
||||||
|
void enter();
|
||||||
|
void leave();
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user