parent
8e8e15355e
commit
251475557f
@ -1,10 +1,10 @@ |
||||
package mightypork.rogue; |
||||
package mightypork.gamecore; |
||||
|
||||
|
||||
import mightypork.rogue.input.InputSystem; |
||||
import mightypork.rogue.render.DisplaySystem; |
||||
import mightypork.rogue.sounds.SoundSystem; |
||||
import mightypork.utils.control.bus.EventBus; |
||||
import mightypork.gamecore.control.bus.EventBus; |
||||
import mightypork.gamecore.input.InputSystem; |
||||
import mightypork.gamecore.render.DisplaySystem; |
||||
import mightypork.gamecore.resources.sounds.SoundSystem; |
||||
|
||||
|
||||
/** |
@ -0,0 +1,14 @@ |
||||
package mightypork.gamecore; |
||||
|
||||
|
||||
import mightypork.gamecore.control.bus.EventBus; |
||||
|
||||
|
||||
public interface BusAccess { |
||||
|
||||
/** |
||||
* @return event bus |
||||
*/ |
||||
public abstract EventBus bus(); |
||||
|
||||
} |
@ -0,0 +1,66 @@ |
||||
package mightypork.gamecore; |
||||
|
||||
|
||||
import java.util.Queue; |
||||
import java.util.concurrent.ConcurrentLinkedQueue; |
||||
|
||||
import mightypork.gamecore.control.Subsystem; |
||||
import mightypork.gamecore.control.bus.events.MainLoopTaskRequest; |
||||
import mightypork.gamecore.control.bus.events.UpdateEvent; |
||||
import mightypork.gamecore.control.timing.TimerDelta; |
||||
|
||||
|
||||
public abstract class GameLoop extends Subsystem implements MainLoopTaskRequest.Listener { |
||||
|
||||
private final Queue<Runnable> taskQueue = new ConcurrentLinkedQueue<Runnable>(); |
||||
/** timer */ |
||||
private TimerDelta timer; |
||||
private boolean running = true; |
||||
|
||||
|
||||
public GameLoop(AppAccess app) { |
||||
super(app); |
||||
} |
||||
|
||||
|
||||
public void start() |
||||
{ |
||||
timer = new TimerDelta(); |
||||
|
||||
while (running) { |
||||
disp().beginFrame(); |
||||
|
||||
bus().send(new UpdateEvent(timer.getDelta())); |
||||
|
||||
Runnable r; |
||||
while ((r = taskQueue.poll()) != null) { |
||||
r.run(); |
||||
} |
||||
|
||||
tick(); |
||||
|
||||
disp().endFrame(); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Called each frame, in rendering context. |
||||
*/ |
||||
protected abstract void tick(); |
||||
|
||||
|
||||
@Override |
||||
protected final void deinit() |
||||
{ |
||||
running = false; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public final synchronized void queueTask(Runnable request) |
||||
{ |
||||
taskQueue.add(request); |
||||
} |
||||
|
||||
} |
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.util; |
||||
package mightypork.gamecore; |
||||
|
||||
|
||||
import mightypork.utils.logging.LogInstance; |
@ -0,0 +1,55 @@ |
||||
package mightypork.gamecore.control; |
||||
|
||||
|
||||
import mightypork.gamecore.AppAccess; |
||||
import mightypork.gamecore.input.InputSystem; |
||||
import mightypork.gamecore.render.DisplaySystem; |
||||
import mightypork.gamecore.resources.sounds.SoundSystem; |
||||
|
||||
|
||||
/** |
||||
* App event bus client, to be used for subsystems, screens and anything that |
||||
* needs access to the eventbus |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public abstract class Subsystem extends ChildClient implements AppAccess { |
||||
|
||||
private final AppAccess app; |
||||
|
||||
|
||||
public Subsystem(AppAccess app) { |
||||
super(app); |
||||
|
||||
this.app = app; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public final SoundSystem snd() |
||||
{ |
||||
return app.snd(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public final InputSystem input() |
||||
{ |
||||
return app.input(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public final DisplaySystem disp() |
||||
{ |
||||
return app.disp(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void shutdown() |
||||
{ |
||||
app.shutdown(); |
||||
} |
||||
|
||||
} |
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.bus; |
||||
package mightypork.gamecore.control.bus; |
||||
|
||||
|
||||
import java.util.Collection; |
@ -1,16 +1,16 @@ |
||||
package mightypork.utils.control.bus; |
||||
package mightypork.gamecore.control.bus; |
||||
|
||||
|
||||
import java.util.concurrent.DelayQueue; |
||||
import java.util.concurrent.Delayed; |
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
import mightypork.utils.control.bus.events.Event; |
||||
import mightypork.utils.control.bus.events.types.DelayedEvent; |
||||
import mightypork.utils.control.bus.events.types.ImmediateEvent; |
||||
import mightypork.utils.control.bus.events.types.SingleReceiverEvent; |
||||
import mightypork.utils.control.bus.events.types.UnloggedEvent; |
||||
import mightypork.utils.control.interf.Destroyable; |
||||
import mightypork.gamecore.control.bus.events.Event; |
||||
import mightypork.gamecore.control.bus.events.types.DelayedEvent; |
||||
import mightypork.gamecore.control.bus.events.types.ImmediateEvent; |
||||
import mightypork.gamecore.control.bus.events.types.SingleReceiverEvent; |
||||
import mightypork.gamecore.control.bus.events.types.UnloggedEvent; |
||||
import mightypork.gamecore.control.interf.Destroyable; |
||||
import mightypork.utils.logging.Log; |
||||
|
||||
|
@ -1,13 +1,13 @@ |
||||
package mightypork.utils.control.bus; |
||||
package mightypork.gamecore.control.bus; |
||||
|
||||
|
||||
import java.util.Collection; |
||||
import java.util.HashSet; |
||||
|
||||
import mightypork.utils.control.bus.clients.DelegatingClient; |
||||
import mightypork.utils.control.bus.clients.ToggleableClient; |
||||
import mightypork.utils.control.bus.events.Event; |
||||
import mightypork.utils.control.bus.events.types.SingleReceiverEvent; |
||||
import mightypork.gamecore.control.bus.clients.DelegatingClient; |
||||
import mightypork.gamecore.control.bus.clients.ToggleableClient; |
||||
import mightypork.gamecore.control.bus.events.Event; |
||||
import mightypork.gamecore.control.bus.events.types.SingleReceiverEvent; |
||||
import mightypork.utils.logging.Log; |
||||
|
||||
|
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.bus.clients; |
||||
package mightypork.gamecore.control.bus.clients; |
||||
|
||||
|
||||
import java.util.Collection; |
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.bus.clients; |
||||
package mightypork.gamecore.control.bus.clients; |
||||
|
||||
|
||||
/** |
@ -1,9 +1,8 @@ |
||||
package mightypork.rogue.bus.events; |
||||
package mightypork.gamecore.control.bus.events; |
||||
|
||||
|
||||
import mightypork.utils.control.bus.events.Event; |
||||
import mightypork.utils.control.bus.events.types.ImmediateEvent; |
||||
import mightypork.utils.control.interf.Destroyable; |
||||
import mightypork.gamecore.control.bus.events.types.ImmediateEvent; |
||||
import mightypork.gamecore.control.interf.Destroyable; |
||||
|
||||
|
||||
/** |
@ -1,9 +1,9 @@ |
||||
package mightypork.utils.control.bus.events; |
||||
package mightypork.gamecore.control.bus.events; |
||||
|
||||
|
||||
import mightypork.utils.control.bus.events.types.DelayedEvent; |
||||
import mightypork.utils.control.bus.events.types.ImmediateEvent; |
||||
import mightypork.utils.control.bus.events.types.SingleReceiverEvent; |
||||
import mightypork.gamecore.control.bus.events.types.DelayedEvent; |
||||
import mightypork.gamecore.control.bus.events.types.ImmediateEvent; |
||||
import mightypork.gamecore.control.bus.events.types.SingleReceiverEvent; |
||||
|
||||
|
||||
/** |
@ -1,8 +1,6 @@ |
||||
package mightypork.rogue.bus.events; |
||||
package mightypork.gamecore.control.bus.events; |
||||
|
||||
|
||||
import mightypork.utils.control.bus.events.Event; |
||||
|
||||
import org.lwjgl.input.Keyboard; |
||||
|
||||
|
@ -1,8 +1,7 @@ |
||||
package mightypork.rogue.bus.events; |
||||
package mightypork.gamecore.control.bus.events; |
||||
|
||||
|
||||
import mightypork.utils.control.bus.events.Event; |
||||
import mightypork.utils.control.bus.events.types.SingleReceiverEvent; |
||||
import mightypork.gamecore.control.bus.events.types.SingleReceiverEvent; |
||||
|
||||
|
||||
/** |
@ -1,8 +1,7 @@ |
||||
package mightypork.rogue.bus.events; |
||||
package mightypork.gamecore.control.bus.events; |
||||
|
||||
|
||||
import mightypork.utils.control.bus.events.Event; |
||||
import mightypork.utils.control.bus.events.types.UnloggedEvent; |
||||
import mightypork.gamecore.control.bus.events.types.UnloggedEvent; |
||||
import mightypork.utils.math.coord.Coord; |
||||
|
||||
|
@ -1,9 +1,8 @@ |
||||
package mightypork.rogue.bus.events; |
||||
package mightypork.gamecore.control.bus.events; |
||||
|
||||
|
||||
import mightypork.rogue.loading.DeferredResource; |
||||
import mightypork.utils.control.bus.events.Event; |
||||
import mightypork.utils.control.bus.events.types.SingleReceiverEvent; |
||||
import mightypork.gamecore.control.bus.events.types.SingleReceiverEvent; |
||||
import mightypork.gamecore.loading.DeferredResource; |
||||
|
||||
|
||||
/** |
@ -1,7 +1,6 @@ |
||||
package mightypork.rogue.bus.events; |
||||
package mightypork.gamecore.control.bus.events; |
||||
|
||||
|
||||
import mightypork.utils.control.bus.events.Event; |
||||
import mightypork.utils.math.coord.Coord; |
||||
|
||||
|
@ -1,8 +1,7 @@ |
||||
package mightypork.rogue.bus.events; |
||||
package mightypork.gamecore.control.bus.events; |
||||
|
||||
|
||||
import mightypork.utils.control.bus.events.Event; |
||||
import mightypork.utils.control.bus.events.types.SingleReceiverEvent; |
||||
import mightypork.gamecore.control.bus.events.types.SingleReceiverEvent; |
||||
|
||||
|
||||
/** |
@ -1,10 +1,9 @@ |
||||
package mightypork.rogue.bus.events; |
||||
package mightypork.gamecore.control.bus.events; |
||||
|
||||
|
||||
import mightypork.utils.control.bus.events.Event; |
||||
import mightypork.utils.control.bus.events.types.ImmediateEvent; |
||||
import mightypork.utils.control.bus.events.types.UnloggedEvent; |
||||
import mightypork.utils.control.interf.Updateable; |
||||
import mightypork.gamecore.control.bus.events.types.ImmediateEvent; |
||||
import mightypork.gamecore.control.bus.events.types.UnloggedEvent; |
||||
import mightypork.gamecore.control.interf.Updateable; |
||||
|
||||
|
||||
/** |
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.bus.events.types; |
||||
package mightypork.gamecore.control.bus.events.types; |
||||
|
||||
|
||||
import java.lang.annotation.*; |
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.bus.events.types; |
||||
package mightypork.gamecore.control.bus.events.types; |
||||
|
||||
|
||||
import java.lang.annotation.*; |
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.bus.events.types; |
||||
package mightypork.gamecore.control.bus.events.types; |
||||
|
||||
|
||||
import java.lang.annotation.*; |
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.bus.events.types; |
||||
package mightypork.gamecore.control.bus.events.types; |
||||
|
||||
|
||||
import java.lang.annotation.*; |
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.interf; |
||||
package mightypork.gamecore.control.interf; |
||||
|
||||
|
||||
/** |
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.interf; |
||||
package mightypork.gamecore.control.interf; |
||||
|
||||
|
||||
/** |
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.timing; |
||||
package mightypork.gamecore.control.timing; |
||||
|
||||
|
||||
/** |
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.timing; |
||||
package mightypork.gamecore.control.timing; |
||||
|
||||
|
||||
public interface Pauseable { |
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.timing; |
||||
package mightypork.gamecore.control.timing; |
||||
|
||||
|
||||
/** |
@ -1,4 +1,4 @@ |
||||
package mightypork.utils.control.timing; |
||||
package mightypork.gamecore.control.timing; |
||||
|
||||
|
||||
/** |
@ -1,8 +1,8 @@ |
||||
package mightypork.rogue.gui.renderers; |
||||
package mightypork.gamecore.gui.renderers; |
||||
|
||||
|
||||
import mightypork.rogue.render.Render; |
||||
import mightypork.rogue.textures.TxQuad; |
||||
import mightypork.gamecore.render.Render; |
||||
import mightypork.gamecore.resources.textures.TxQuad; |
||||
|
||||
|
||||
public class ImageRenderer extends PluggableRenderer { |
@ -1,8 +1,8 @@ |
||||
package mightypork.rogue.gui.renderers; |
||||
package mightypork.gamecore.gui.renderers; |
||||
|
||||
|
||||
import mightypork.rogue.fonts.FontRenderer; |
||||
import mightypork.rogue.fonts.GLFont; |
||||
import mightypork.gamecore.resources.fonts.FontRenderer; |
||||
import mightypork.gamecore.resources.fonts.GLFont; |
||||
import mightypork.utils.math.color.RGB; |
||||
import mightypork.utils.math.coord.Coord; |
||||
|
@ -1,10 +1,10 @@ |
||||
package mightypork.rogue.gui.screens; |
||||
package mightypork.gamecore.gui.screens; |
||||
|
||||
|
||||
import java.util.Collection; |
||||
import java.util.LinkedList; |
||||
|
||||
import mightypork.rogue.AppAccess; |
||||
import mightypork.gamecore.AppAccess; |
||||
|
||||
|
||||
public abstract class LayeredScreen extends Screen { |
@ -1,12 +1,12 @@ |
||||
package mightypork.rogue.gui.screens; |
||||
package mightypork.gamecore.gui.screens; |
||||
|
||||
|
||||
import java.util.HashMap; |
||||
|
||||
import mightypork.rogue.AppAccess; |
||||
import mightypork.rogue.bus.Subsystem; |
||||
import mightypork.rogue.bus.events.ScreenRequestEvent; |
||||
import mightypork.rogue.render.Renderable; |
||||
import mightypork.gamecore.AppAccess; |
||||
import mightypork.gamecore.control.Subsystem; |
||||
import mightypork.gamecore.control.bus.events.ScreenRequestEvent; |
||||
import mightypork.gamecore.render.Renderable; |
||||
import mightypork.utils.logging.Log; |
||||
|
||||
|
@ -0,0 +1,37 @@ |
||||
package mightypork.gamecore.input; |
||||
|
||||
|
||||
/** |
||||
* Triggered action |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public abstract class Action implements Runnable { |
||||
|
||||
private boolean enabled = true; |
||||
|
||||
|
||||
/** |
||||
* Enable the action |
||||
* |
||||
* @param enable true to enable |
||||
*/ |
||||
public final void enable(boolean enable) |
||||
{ |
||||
this.enabled = enable; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public final void run() |
||||
{ |
||||
if (enabled) execute(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Do the work. |
||||
*/ |
||||
public abstract void execute(); |
||||
|
||||
} |
@ -0,0 +1,7 @@ |
||||
package mightypork.gamecore.input; |
||||
|
||||
|
||||
public interface ActionTrigger { |
||||
|
||||
void setAction(Action action); |
||||
} |
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.input; |
||||
package mightypork.gamecore.input; |
||||
|
||||
|
||||
public interface KeyBinder { |
@ -1,7 +1,7 @@ |
||||
package mightypork.rogue.input; |
||||
package mightypork.gamecore.input; |
||||
|
||||
|
||||
import mightypork.rogue.bus.events.KeyboardEvent; |
||||
import mightypork.gamecore.control.bus.events.KeyboardEvent; |
||||
|
||||
|
||||
/** |
@ -1,11 +1,11 @@ |
||||
package mightypork.rogue.input; |
||||
package mightypork.gamecore.input; |
||||
|
||||
|
||||
import java.util.HashSet; |
||||
import java.util.Iterator; |
||||
import java.util.Set; |
||||
|
||||
import mightypork.rogue.bus.events.KeyboardEvent; |
||||
import mightypork.gamecore.control.bus.events.KeyboardEvent; |
||||
import mightypork.utils.logging.Log; |
||||
|
||||
|
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.input; |
||||
package mightypork.gamecore.input; |
||||
|
||||
|
||||
import java.util.Iterator; |
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.input; |
||||
package mightypork.gamecore.input; |
||||
|
||||
|
||||
import org.lwjgl.input.Keyboard; |
@ -1,7 +1,7 @@ |
||||
package mightypork.rogue.loading; |
||||
package mightypork.gamecore.loading; |
||||
|
||||
|
||||
import mightypork.utils.control.interf.Destroyable; |
||||
import mightypork.gamecore.control.interf.Destroyable; |
||||
import mightypork.utils.logging.Log; |
||||
import mightypork.utils.logging.LoggedName; |
||||
|
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.loading; |
||||
package mightypork.gamecore.loading; |
||||
|
||||
|
||||
/** |
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.loading; |
||||
package mightypork.gamecore.loading; |
||||
|
||||
|
||||
import java.lang.annotation.*; |
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.loading; |
||||
package mightypork.gamecore.loading; |
||||
|
||||
|
||||
/** |
@ -1,11 +1,11 @@ |
||||
package mightypork.rogue.render; |
||||
package mightypork.gamecore.render; |
||||
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*; |
||||
|
||||
import java.io.IOException; |
||||
|
||||
import mightypork.rogue.textures.TxQuad; |
||||
import mightypork.gamecore.resources.textures.TxQuad; |
||||
import mightypork.utils.files.FileUtils; |
||||
import mightypork.utils.logging.Log; |
||||
import mightypork.utils.math.color.RGB; |
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.render; |
||||
package mightypork.gamecore.render; |
||||
|
||||
|
||||
/** |
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.fonts; |
||||
package mightypork.gamecore.resources.fonts; |
||||
|
||||
|
||||
import java.awt.Font; |
@ -1,11 +1,11 @@ |
||||
package mightypork.rogue.fonts; |
||||
package mightypork.gamecore.resources.fonts; |
||||
|
||||
|
||||
import java.util.HashMap; |
||||
|
||||
import mightypork.rogue.AppAccess; |
||||
import mightypork.rogue.AppAdapter; |
||||
import mightypork.rogue.bus.events.ResourceLoadRequest; |
||||
import mightypork.gamecore.AppAccess; |
||||
import mightypork.gamecore.AppAdapter; |
||||
import mightypork.gamecore.control.bus.events.ResourceLoadRequest; |
||||
import mightypork.utils.logging.Log; |
||||
|
||||
import org.newdawn.slick.opengl.Texture; |
@ -1,7 +1,7 @@ |
||||
package mightypork.rogue.fonts; |
||||
package mightypork.gamecore.resources.fonts; |
||||
|
||||
|
||||
import mightypork.rogue.render.Render; |
||||
import mightypork.gamecore.render.Render; |
||||
import mightypork.utils.math.color.RGB; |
||||
import mightypork.utils.math.coord.Coord; |
||||
import mightypork.utils.math.coord.Rect; |
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.fonts; |
||||
package mightypork.gamecore.resources.fonts; |
||||
|
||||
|
||||
import mightypork.utils.math.color.RGB; |
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.fonts; |
||||
package mightypork.gamecore.resources.fonts; |
||||
|
||||
|
||||
/** |
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.fonts; |
||||
package mightypork.gamecore.resources.fonts; |
||||
|
||||
|
||||
import mightypork.utils.math.color.RGB; |
@ -1,11 +1,11 @@ |
||||
package mightypork.rogue.fonts; |
||||
package mightypork.gamecore.resources.fonts; |
||||
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*; |
||||
|
||||
import java.awt.Font; |
||||
|
||||
import mightypork.rogue.render.Render; |
||||
import mightypork.gamecore.render.Render; |
||||
import mightypork.utils.math.color.RGB; |
||||
import mightypork.utils.math.coord.Coord; |
||||
|
@ -1,9 +1,9 @@ |
||||
package mightypork.rogue.sounds; |
||||
package mightypork.gamecore.resources.sounds; |
||||
|
||||
|
||||
import java.io.IOException; |
||||
|
||||
import mightypork.rogue.loading.BaseDeferredResource; |
||||
import mightypork.gamecore.loading.BaseDeferredResource; |
||||
import mightypork.utils.files.FileUtils; |
||||
import mightypork.utils.logging.LoggedName; |
||||
import mightypork.utils.math.coord.Coord; |
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.sounds; |
||||
package mightypork.gamecore.resources.sounds; |
||||
|
||||
|
||||
import mightypork.utils.math.Calc; |
@ -1,7 +1,7 @@ |
||||
package mightypork.rogue.sounds; |
||||
package mightypork.gamecore.resources.sounds; |
||||
|
||||
|
||||
import mightypork.rogue.loading.NullResource; |
||||
import mightypork.gamecore.loading.NullResource; |
||||
import mightypork.utils.logging.LoggedName; |
||||
|
||||
|
@ -1,13 +1,13 @@ |
||||
package mightypork.rogue.sounds; |
||||
package mightypork.gamecore.resources.sounds; |
||||
|
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
import mightypork.rogue.AppAccess; |
||||
import mightypork.rogue.AppAdapter; |
||||
import mightypork.rogue.sounds.players.EffectPlayer; |
||||
import mightypork.rogue.sounds.players.LoopPlayer; |
||||
import mightypork.gamecore.AppAccess; |
||||
import mightypork.gamecore.AppAdapter; |
||||
import mightypork.gamecore.resources.sounds.players.EffectPlayer; |
||||
import mightypork.gamecore.resources.sounds.players.LoopPlayer; |
||||
import mightypork.utils.logging.Log; |
||||
|
||||
|
@ -1,16 +1,16 @@ |
||||
package mightypork.rogue.sounds; |
||||
package mightypork.gamecore.resources.sounds; |
||||
|
||||
|
||||
import java.nio.FloatBuffer; |
||||
import java.util.HashSet; |
||||
import java.util.Set; |
||||
|
||||
import mightypork.rogue.AppAccess; |
||||
import mightypork.rogue.bus.Subsystem; |
||||
import mightypork.rogue.bus.events.ResourceLoadRequest; |
||||
import mightypork.rogue.sounds.players.EffectPlayer; |
||||
import mightypork.rogue.sounds.players.LoopPlayer; |
||||
import mightypork.utils.control.interf.Updateable; |
||||
import mightypork.gamecore.AppAccess; |
||||
import mightypork.gamecore.control.Subsystem; |
||||
import mightypork.gamecore.control.bus.events.ResourceLoadRequest; |
||||
import mightypork.gamecore.control.interf.Updateable; |
||||
import mightypork.gamecore.resources.sounds.players.EffectPlayer; |
||||
import mightypork.gamecore.resources.sounds.players.LoopPlayer; |
||||
import mightypork.utils.math.Calc.Buffers; |
||||
import mightypork.utils.math.coord.Coord; |
||||
import mightypork.utils.objects.Mutable; |
@ -1,8 +1,8 @@ |
||||
package mightypork.rogue.sounds.players; |
||||
package mightypork.gamecore.resources.sounds.players; |
||||
|
||||
|
||||
import mightypork.rogue.sounds.DeferredAudio; |
||||
import mightypork.utils.control.interf.Destroyable; |
||||
import mightypork.gamecore.control.interf.Destroyable; |
||||
import mightypork.gamecore.resources.sounds.DeferredAudio; |
||||
import mightypork.utils.objects.Mutable; |
||||
|
||||
|
@ -1,7 +1,7 @@ |
||||
package mightypork.rogue.sounds.players; |
||||
package mightypork.gamecore.resources.sounds.players; |
||||
|
||||
|
||||
import mightypork.rogue.sounds.DeferredAudio; |
||||
import mightypork.gamecore.resources.sounds.DeferredAudio; |
||||
import mightypork.utils.math.coord.Coord; |
||||
import mightypork.utils.objects.Mutable; |
||||
|
@ -1,9 +1,9 @@ |
||||
package mightypork.rogue.sounds.players; |
||||
package mightypork.gamecore.resources.sounds.players; |
||||
|
||||
|
||||
import mightypork.rogue.sounds.DeferredAudio; |
||||
import mightypork.utils.control.interf.Updateable; |
||||
import mightypork.utils.control.timing.Pauseable; |
||||
import mightypork.gamecore.control.interf.Updateable; |
||||
import mightypork.gamecore.control.timing.Pauseable; |
||||
import mightypork.gamecore.resources.sounds.DeferredAudio; |
||||
import mightypork.utils.math.animation.AnimDouble; |
||||
import mightypork.utils.objects.Mutable; |
||||
|
@ -1,9 +1,9 @@ |
||||
package mightypork.rogue.textures; |
||||
package mightypork.gamecore.resources.textures; |
||||
|
||||
|
||||
import mightypork.rogue.loading.BaseDeferredResource; |
||||
import mightypork.rogue.loading.MustLoadInMainThread; |
||||
import mightypork.rogue.render.Render; |
||||
import mightypork.gamecore.loading.BaseDeferredResource; |
||||
import mightypork.gamecore.loading.MustLoadInMainThread; |
||||
import mightypork.gamecore.render.Render; |
||||
import mightypork.utils.logging.LoggedName; |
||||
import mightypork.utils.math.coord.Rect; |
||||
|
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.textures; |
||||
package mightypork.gamecore.resources.textures; |
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11; |
@ -1,13 +1,13 @@ |
||||
package mightypork.rogue.textures; |
||||
package mightypork.gamecore.resources.textures; |
||||
|
||||
|
||||
import java.util.HashMap; |
||||
|
||||
import mightypork.rogue.AppAccess; |
||||
import mightypork.rogue.AppAdapter; |
||||
import mightypork.rogue.bus.events.ResourceLoadRequest; |
||||
import mightypork.rogue.textures.FilteredTexture.Filter; |
||||
import mightypork.rogue.textures.FilteredTexture.Wrap; |
||||
import mightypork.gamecore.AppAccess; |
||||
import mightypork.gamecore.AppAdapter; |
||||
import mightypork.gamecore.control.bus.events.ResourceLoadRequest; |
||||
import mightypork.gamecore.resources.textures.FilteredTexture.Filter; |
||||
import mightypork.gamecore.resources.textures.FilteredTexture.Wrap; |
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
import org.newdawn.slick.opengl.Texture; |
@ -1,4 +1,4 @@ |
||||
package mightypork.rogue.textures; |
||||
package mightypork.gamecore.resources.textures; |
||||
|
||||
|
||||
import mightypork.utils.math.coord.Rect; |
@ -1,38 +0,0 @@ |
||||
package mightypork.rogue.bus; |
||||
|
||||
|
||||
import mightypork.rogue.AppAccess; |
||||
import mightypork.utils.control.interf.Destroyable; |
||||
|
||||
|
||||
/** |
||||
* App event bus client, to be used for subsystems, screens and anything that |
||||
* needs access to the eventbus |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public abstract class Subsystem extends ChildClient implements Destroyable { |
||||
|
||||
public Subsystem(AppAccess app) { |
||||
super(app); |
||||
|
||||
bus().subscribe(this); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public final void destroy() |
||||
{ |
||||
deinit(); |
||||
|
||||
bus().unsubscribe(this); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Deinitialize the subsystem<br> |
||||
* (called during destruction) |
||||
*/ |
||||
protected abstract void deinit(); |
||||
|
||||
} |
@ -1,8 +1,8 @@ |
||||
package mightypork.rogue.bus.events; |
||||
package mightypork.rogue.events; |
||||
|
||||
|
||||
import mightypork.utils.control.bus.events.Event; |
||||
import mightypork.utils.control.bus.events.types.SingleReceiverEvent; |
||||
import mightypork.gamecore.control.bus.events.Event; |
||||
import mightypork.gamecore.control.bus.events.types.SingleReceiverEvent; |
||||
|
||||
|
||||
/** |
@ -1,37 +1,37 @@ |
||||
package mightypork.rogue.gui.screens.test_bouncyboxes; |
||||
package mightypork.rogue.screens.test_bouncyboxes; |
||||
|
||||
|
||||
import static mightypork.utils.math.constraints.ConstraintFactory.*; |
||||
|
||||
import java.util.Random; |
||||
|
||||
import mightypork.rogue.gui.renderers.PluggableRenderer; |
||||
import mightypork.rogue.render.Render; |
||||
import mightypork.utils.control.interf.Updateable; |
||||
import mightypork.gamecore.control.interf.Updateable; |
||||
import mightypork.gamecore.gui.renderers.PluggableRenderer; |
||||
import mightypork.gamecore.render.Render; |
||||
import mightypork.utils.math.animation.AnimDouble; |
||||
import mightypork.utils.math.animation.Easing; |
||||
import mightypork.utils.math.color.RGB; |
||||
import mightypork.utils.math.constraints.NumEvaluable; |
||||
import mightypork.utils.math.constraints.RectEvaluable; |
||||
import mightypork.utils.math.constraints.NumberConstraint; |
||||
import mightypork.utils.math.constraints.RectConstraint; |
||||
|
||||
|
||||
public class BouncyBox extends PluggableRenderer implements Updateable { |
||||
|
||||
private final Random rand = new Random(); |
||||
|
||||
private final RectEvaluable box; |
||||
private final RectConstraint box; |
||||
|
||||
private final AnimDouble pos = new AnimDouble(0, Easing.BOUNCE_OUT); |
||||
|
||||
|
||||
public BouncyBox() { |
||||
// create box
|
||||
final NumEvaluable side = c_height(this); |
||||
RectEvaluable abox = c_box(this, side, side); |
||||
final NumberConstraint side = c_height(this); |
||||
RectConstraint abox = c_box(this, side, side); |
||||
|
||||
// move
|
||||
final NumEvaluable move_length = c_sub(c_width(this), side); |
||||
final NumEvaluable offset = c_mul(move_length, c_n(pos)); |
||||
final NumberConstraint move_length = c_sub(c_width(this), side); |
||||
final NumberConstraint offset = c_mul(move_length, c_n(pos)); |
||||
abox = c_move(abox, offset, c_n(0)); |
||||
|
||||
// add padding
|
@ -1,11 +1,11 @@ |
||||
package mightypork.rogue.gui.screens.test_bouncyboxes; |
||||
package mightypork.rogue.screens.test_bouncyboxes; |
||||
|
||||
|
||||
import mightypork.rogue.AppAccess; |
||||
import mightypork.rogue.bus.events.ScreenRequestEvent; |
||||
import mightypork.rogue.gui.screens.LayeredScreen; |
||||
import mightypork.rogue.input.KeyStroke; |
||||
import mightypork.rogue.input.Keys; |
||||
import mightypork.gamecore.AppAccess; |
||||
import mightypork.gamecore.control.bus.events.ScreenRequestEvent; |
||||
import mightypork.gamecore.gui.screens.LayeredScreen; |
||||
import mightypork.gamecore.input.KeyStroke; |
||||
import mightypork.gamecore.input.Keys; |
||||
|
||||
|
||||
public class ScreenTestBouncy extends LayeredScreen { |
@ -1,14 +1,14 @@ |
||||
package mightypork.rogue.gui.screens.test_cat_sound; |
||||
package mightypork.rogue.screens.test_cat_sound; |
||||
|
||||
|
||||
import mightypork.rogue.AppAccess; |
||||
import mightypork.gamecore.AppAccess; |
||||
import mightypork.gamecore.control.bus.events.ScreenRequestEvent; |
||||
import mightypork.gamecore.gui.screens.LayeredScreen; |
||||
import mightypork.gamecore.input.KeyStroke; |
||||
import mightypork.gamecore.input.Keys; |
||||
import mightypork.rogue.Res; |
||||
import mightypork.rogue.bus.events.ActionRequest; |
||||
import mightypork.rogue.bus.events.ActionRequest.RequestType; |
||||
import mightypork.rogue.bus.events.ScreenRequestEvent; |
||||
import mightypork.rogue.gui.screens.LayeredScreen; |
||||
import mightypork.rogue.input.KeyStroke; |
||||
import mightypork.rogue.input.Keys; |
||||
import mightypork.rogue.events.ActionRequest; |
||||
import mightypork.rogue.events.ActionRequest.RequestType; |
||||
|
||||
|
||||
public class ScreenTestCat extends LayeredScreen { |
@ -1,10 +1,10 @@ |
||||
package mightypork.rogue.gui.screens.test_font; |
||||
package mightypork.rogue.screens.test_font; |
||||
|
||||
|
||||
import mightypork.rogue.AppAccess; |
||||
import mightypork.gamecore.AppAccess; |
||||
import mightypork.gamecore.gui.screens.Screen; |
||||
import mightypork.gamecore.resources.fonts.FontRenderer; |
||||
import mightypork.rogue.Res; |
||||
import mightypork.rogue.fonts.FontRenderer; |
||||
import mightypork.rogue.gui.screens.Screen; |
||||
import mightypork.utils.math.color.RGB; |
||||
import mightypork.utils.math.coord.Coord; |
||||
|
@ -1,7 +1,7 @@ |
||||
package mightypork.utils.math.constraints; |
||||
|
||||
|
||||
public interface NumEvaluable { |
||||
public interface NumberConstraint { |
||||
|
||||
double getValue(); |
||||
|
@ -0,0 +1,18 @@ |
||||
package mightypork.utils.math.constraints; |
||||
|
||||
|
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
|
||||
/** |
||||
* Rect constraint (ie. region) |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public interface RectConstraint { |
||||
|
||||
/** |
||||
* @return rect region |
||||
*/ |
||||
Rect getRect(); |
||||
} |
@ -1,10 +0,0 @@ |
||||
package mightypork.utils.math.constraints; |
||||
|
||||
|
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
|
||||
public interface RectEvaluable { |
||||
|
||||
Rect getRect(); |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue