From f81c349d2039ff0eb358cf1f9a92dc868d19a139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Wed, 9 Apr 2014 22:51:29 +0200 Subject: [PATCH] javadoc --- .../gamecore/audio/DeferredAudio.java | 9 +++ src/mightypork/gamecore/audio/NullAudio.java | 3 + src/mightypork/gamecore/audio/SoundBank.java | 8 ++ .../gamecore/audio/SoundSystem.java | 45 ++++++++++- src/mightypork/gamecore/audio/Volume.java | 8 ++ .../audio/players/BaseAudioPlayer.java | 40 ++++++++-- .../gamecore/audio/players/EffectPlayer.java | 36 ++++++++- .../gamecore/audio/players/LoopPlayer.java | 37 ++++++++- .../gamecore/control/AppAdapter.java | 5 +- .../gamecore/control/AppModule.java | 7 +- .../gamecore/control/AppSubModule.java | 11 ++- src/mightypork/gamecore/control/BaseApp.java | 64 +++++++++++++-- src/mightypork/gamecore/control/GameLoop.java | 9 +++ .../gamecore/control/SlickLogRedirector.java | 3 + .../gamecore/control/bus/BufferedHashSet.java | 19 +++++ .../gamecore/control/bus/EventBus.java | 7 ++ .../gamecore/control/bus/clients/BusNode.java | 3 + .../control/bus/clients/RootBusNode.java | 3 + .../gamecore/control/bus/events/KeyEvent.java | 10 +++ .../bus/events/MainLoopTaskRequest.java | 8 ++ .../control/bus/events/MouseButtonEvent.java | 5 ++ .../control/bus/events/MouseMotionEvent.java | 9 +++ .../bus/events/ResourceLoadRequest.java | 10 ++- .../control/bus/events/ScreenChangeEvent.java | 24 ++++++ .../bus/events/ScreenRequestEvent.java | 11 +++ .../gamecore/control/interf/NoImpl.java | 6 ++ .../gamecore/control/timing/Pauseable.java | 5 ++ .../gamecore/gui/ActionTrigger.java | 5 ++ .../gamecore/gui/renderers/ColumnHolder.java | 17 ++++ .../gamecore/gui/renderers/ElementHolder.java | 7 ++ .../gamecore/gui/renderers/ImagePainter.java | 11 +++ .../gui/renderers/PluggableRenderable.java | 5 ++ .../gamecore/gui/renderers/RowHolder.java | 17 ++++ .../gamecore/gui/renderers/TextPainter.java | 77 ++++++++++++++++++- .../gamecore/gui/screens/LayeredScreen.java | 8 ++ .../gamecore/gui/screens/Screen.java | 3 + .../gamecore/gui/screens/ScreenLayer.java | 6 ++ .../gamecore/gui/screens/ScreenRegistry.java | 3 + .../gamecore/input/InputSystem.java | 8 ++ src/mightypork/gamecore/input/KeyBinder.java | 10 ++- .../gamecore/loading/AsyncResourceLoader.java | 10 ++- .../loading/BaseDeferredResource.java | 4 + .../gamecore/render/DisplaySystem.java | 34 +++++++- src/mightypork/gamecore/render/Render.java | 14 ++++ .../gamecore/render/Screenshot.java | 19 +++++ .../gamecore/render/fonts/FontBank.java | 3 + .../gamecore/render/fonts/GLFont.java | 5 ++ .../gamecore/render/fonts/SlickFont.java | 5 ++ .../render/textures/DeferredTexture.java | 17 +++- .../gamecore/render/textures/FilterMode.java | 5 ++ .../render/textures/FilteredTexture.java | 5 ++ .../gamecore/render/textures/TextureBank.java | 3 + .../gamecore/render/textures/TxQuad.java | 10 +++ .../gamecore/render/textures/WrapMode.java | 5 ++ src/mightypork/rogue/App.java | 6 +- .../utils/math/animation/AnimDouble.java | 7 ++ .../math/constraints/ContextAdapter.java | 7 +- .../math/constraints/NumberConstraint.java | 8 ++ .../math/constraints/PluggableContext.java | 8 ++ 59 files changed, 719 insertions(+), 38 deletions(-) diff --git a/src/mightypork/gamecore/audio/DeferredAudio.java b/src/mightypork/gamecore/audio/DeferredAudio.java index d605b06..00650b2 100644 --- a/src/mightypork/gamecore/audio/DeferredAudio.java +++ b/src/mightypork/gamecore/audio/DeferredAudio.java @@ -108,6 +108,9 @@ public class DeferredAudio extends BaseDeferredResource { } + /** + * Stop playing + */ public void stop() { if (!isLoaded()) return; @@ -117,6 +120,9 @@ public class DeferredAudio extends BaseDeferredResource { } + /** + * @return true if the audio is playing + */ public boolean isPlaying() { if (!isLoaded()) return false; @@ -125,6 +131,9 @@ public class DeferredAudio extends BaseDeferredResource { } + /** + * @return trie if the audio is paused + */ public boolean isPaused() { if (!isLoaded()) return false; diff --git a/src/mightypork/gamecore/audio/NullAudio.java b/src/mightypork/gamecore/audio/NullAudio.java index c21fa77..e8f955f 100644 --- a/src/mightypork/gamecore/audio/NullAudio.java +++ b/src/mightypork/gamecore/audio/NullAudio.java @@ -14,6 +14,9 @@ import mightypork.utils.logging.LoggedName; @LoggedName(name = "NullAudio") public class NullAudio extends DeferredAudio implements NullResource { + /** + * new null audio + */ public NullAudio() { super(null); } diff --git a/src/mightypork/gamecore/audio/SoundBank.java b/src/mightypork/gamecore/audio/SoundBank.java index bfe6111..ed74512 100644 --- a/src/mightypork/gamecore/audio/SoundBank.java +++ b/src/mightypork/gamecore/audio/SoundBank.java @@ -11,6 +11,11 @@ import mightypork.gamecore.control.AppAdapter; import mightypork.utils.logging.Log; +/** + * Audio resource storage + * + * @author MightyPork + */ public class SoundBank extends AppAdapter { private static final DeferredAudio NO_SOUND = new NullAudio(); @@ -21,6 +26,9 @@ public class SoundBank extends AppAdapter { private final Map loops = new HashMap<>(); + /** + * @param app app access + */ public SoundBank(AppAccess app) { super(app); if (getSoundSystem() == null) throw new NullPointerException("SoundSystem cannot be null."); diff --git a/src/mightypork/gamecore/audio/SoundSystem.java b/src/mightypork/gamecore/audio/SoundSystem.java index 9b54626..c9044ba 100644 --- a/src/mightypork/gamecore/audio/SoundSystem.java +++ b/src/mightypork/gamecore/audio/SoundSystem.java @@ -63,6 +63,9 @@ public class SoundSystem extends RootBusNode implements Updateable { } + /** + * @return listener coordinate + */ public static Coord getListener() { return listener; @@ -70,14 +73,17 @@ public class SoundSystem extends RootBusNode implements Updateable { // -- instance -- - public final Volume masterVolume = new Volume(1D); - public final Volume effectsVolume = new JointVolume(masterVolume); - public final Volume loopsVolume = new JointVolume(masterVolume); + private final Volume masterVolume = new Volume(1D); + private final Volume effectsVolume = new JointVolume(masterVolume); + private final Volume loopsVolume = new JointVolume(masterVolume); private final Set loopPlayers = new HashSet<>(); private final Set resources = new HashSet<>(); + /** + * @param app app access + */ public SoundSystem(AppAccess app) { super(app); } @@ -208,4 +214,37 @@ public class SoundSystem extends RootBusNode implements Updateable { { loopsVolume.set(d); } + + + /** + * Get level of master volume + * + * @return level + */ + public double getMasterVolume() + { + return masterVolume.get(); + } + + + /** + * Get level of effects volume + * + * @return level + */ + public double getEffectsVolume() + { + return effectsVolume.get(); + } + + + /** + * Get level of music volume + * + * @return level + */ + public double getMusicVolume() + { + return loopsVolume.get(); + } } diff --git a/src/mightypork/gamecore/audio/Volume.java b/src/mightypork/gamecore/audio/Volume.java index ef9e775..b6c0070 100644 --- a/src/mightypork/gamecore/audio/Volume.java +++ b/src/mightypork/gamecore/audio/Volume.java @@ -5,8 +5,16 @@ import mightypork.utils.math.Calc; import mightypork.utils.objects.Mutable; +/** + * Mutable volume 0-1 + * + * @author MightyPork + */ public class Volume extends Mutable { + /** + * @param d initial value + */ public Volume(Double d) { super(d); } diff --git a/src/mightypork/gamecore/audio/players/BaseAudioPlayer.java b/src/mightypork/gamecore/audio/players/BaseAudioPlayer.java index f95595c..14d3353 100644 --- a/src/mightypork/gamecore/audio/players/BaseAudioPlayer.java +++ b/src/mightypork/gamecore/audio/players/BaseAudioPlayer.java @@ -6,6 +6,11 @@ import mightypork.gamecore.audio.Volume; import mightypork.gamecore.control.interf.Destroyable; +/** + * Basic abstract player + * + * @author MightyPork + */ public abstract class BaseAudioPlayer implements Destroyable { /** the track */ @@ -21,20 +26,21 @@ public abstract class BaseAudioPlayer implements Destroyable { private final Volume gainMultiplier; - public BaseAudioPlayer(DeferredAudio track, double baseGain, Volume gainMultiplier) { - this(track, 1, baseGain, gainMultiplier); - } - - - public BaseAudioPlayer(DeferredAudio track, double basePitch, double baseGain, Volume gainMultiplier) { + /** + * @param track audio resource + * @param basePitch base pitch (pitch multiplier) + * @param baseGain base gain (volume multiplier) + * @param volume colume control + */ + public BaseAudioPlayer(DeferredAudio track, double basePitch, double baseGain, Volume volume) { this.audio = track; this.baseGain = baseGain; this.basePitch = basePitch; - if (gainMultiplier == null) gainMultiplier = new Volume(1D); + if (volume == null) volume = new Volume(1D); - this.gainMultiplier = gainMultiplier; + this.gainMultiplier = volume; } @@ -45,18 +51,33 @@ public abstract class BaseAudioPlayer implements Destroyable { } + /** + * @return audio resource + */ protected DeferredAudio getAudio() { return audio; } + /** + * Get play gain, computed based on volume and given multiplier + * + * @param multiplier extra volume adjustment + * @return computed gain + */ protected double getGain(double multiplier) { return baseGain * gainMultiplier.get() * multiplier; } + /** + * Get pitch + * + * @param multiplier pitch adjustment + * @return computed pitch + */ protected double getPitch(double multiplier) { return basePitch * multiplier; @@ -74,6 +95,9 @@ public abstract class BaseAudioPlayer implements Destroyable { } + /** + * force load the resource + */ public void load() { if (hasAudio()) audio.load(); diff --git a/src/mightypork/gamecore/audio/players/EffectPlayer.java b/src/mightypork/gamecore/audio/players/EffectPlayer.java index 2017c48..0c2f4c0 100644 --- a/src/mightypork/gamecore/audio/players/EffectPlayer.java +++ b/src/mightypork/gamecore/audio/players/EffectPlayer.java @@ -6,13 +6,31 @@ import mightypork.gamecore.audio.Volume; import mightypork.utils.math.coord.Coord; +/** + * Player for one-off effects + * + * @author MightyPork + */ public class EffectPlayer extends BaseAudioPlayer { - public EffectPlayer(DeferredAudio track, double basePitch, double baseGain, Volume gainMultiplier) { - super(track, (float) basePitch, (float) baseGain, gainMultiplier); + /** + * @param track audio resource + * @param basePitch base pitch (pitch multiplier) + * @param baseGain base gain (volume multiplier) + * @param volume volume control + */ + public EffectPlayer(DeferredAudio track, double basePitch, double baseGain, Volume volume) { + super(track, (float) basePitch, (float) baseGain, volume); } + /** + * Play at listener + * + * @param pitch play pitch + * @param gain play gain + * @return source id + */ public int play(double pitch, double gain) { if (!hasAudio()) return -1; @@ -21,12 +39,26 @@ public class EffectPlayer extends BaseAudioPlayer { } + /** + * Play at listener + * + * @param gain play gain + * @return source id + */ public int play(double gain) { return play(1, gain); } + /** + * Play at given position + * + * @param pitch play pitch + * @param gain play gain + * @param pos play position + * @return source id + */ public int play(double pitch, double gain, Coord pos) { if (!hasAudio()) return -1; diff --git a/src/mightypork/gamecore/audio/players/LoopPlayer.java b/src/mightypork/gamecore/audio/players/LoopPlayer.java index 2713a2a..f5442bc 100644 --- a/src/mightypork/gamecore/audio/players/LoopPlayer.java +++ b/src/mightypork/gamecore/audio/players/LoopPlayer.java @@ -10,6 +10,11 @@ import mightypork.utils.math.animation.AnimDouble; import org.lwjgl.openal.AL10; +/** + * Audio loop player (with fading, good for music) + * + * @author MightyPork + */ public class LoopPlayer extends BaseAudioPlayer implements Updateable, Pauseable { private int sourceID = -1; @@ -29,13 +34,25 @@ public class LoopPlayer extends BaseAudioPlayer implements Updateable, Pauseable private double outTime = 1; - public LoopPlayer(DeferredAudio track, double pitch, double baseGain, Volume gainMultiplier) { - super(track, (float) pitch, (float) baseGain, gainMultiplier); + /** + * @param track audio resource + * @param basePitch base pitch (pitch multiplier) + * @param baseGain base gain (volume multiplier) + * @param volume volume control + */ + public LoopPlayer(DeferredAudio track, double basePitch, double baseGain, Volume volume) { + super(track, (float) basePitch, (float) baseGain, volume); paused = true; } + /** + * Set fading duration (seconds) + * + * @param in duration of fade-in + * @param out duration of fade-out + */ public void setFadeTimes(double in, double out) { inTime = in; @@ -102,6 +119,11 @@ public class LoopPlayer extends BaseAudioPlayer implements Updateable, Pauseable } + /** + * Resume if paused, and fade in (pick up from current volume). + * + * @param secs + */ public void fadeIn(double secs) { if (!hasAudio()) return; @@ -111,6 +133,11 @@ public class LoopPlayer extends BaseAudioPlayer implements Updateable, Pauseable } + /** + * Fade out and pause when reached zero volume + * + * @param secs fade duration + */ public void fadeOut(double secs) { if (!hasAudio()) return; @@ -119,12 +146,18 @@ public class LoopPlayer extends BaseAudioPlayer implements Updateable, Pauseable } + /** + * Fade in with default duration + */ public void fadeIn() { fadeIn(inTime); } + /** + * Fade out with default duration + */ public void fadeOut() { fadeOut(outTime); diff --git a/src/mightypork/gamecore/control/AppAdapter.java b/src/mightypork/gamecore/control/AppAdapter.java index 4b00d34..410dbf4 100644 --- a/src/mightypork/gamecore/control/AppAdapter.java +++ b/src/mightypork/gamecore/control/AppAdapter.java @@ -8,7 +8,7 @@ import mightypork.gamecore.render.DisplaySystem; /** - * App access adapter + * App access adapter (defualt {@link AppAccess} implementation) * * @author MightyPork */ @@ -17,6 +17,9 @@ public class AppAdapter implements AppAccess { private final AppAccess app; + /** + * @param app app access + */ public AppAdapter(AppAccess app) { if (app == null) throw new NullPointerException("AppAccess instance cannot be null."); diff --git a/src/mightypork/gamecore/control/AppModule.java b/src/mightypork/gamecore/control/AppModule.java index 5b673dd..f799581 100644 --- a/src/mightypork/gamecore/control/AppModule.java +++ b/src/mightypork/gamecore/control/AppModule.java @@ -9,7 +9,7 @@ import mightypork.gamecore.render.DisplaySystem; /** * App event bus client, to be used for subsystems, screens and anything that - * needs access to the eventbus + * needs access to the eventbus and other systems; Attached directly to bus. * * @author MightyPork */ @@ -18,6 +18,11 @@ public abstract class AppModule extends RootBusNode implements AppAccess { private final AppAccess app; + /** + * Create a module + * + * @param app access to app systems + */ public AppModule(AppAccess app) { super(app); diff --git a/src/mightypork/gamecore/control/AppSubModule.java b/src/mightypork/gamecore/control/AppSubModule.java index 6d233fa..24324f6 100644 --- a/src/mightypork/gamecore/control/AppSubModule.java +++ b/src/mightypork/gamecore/control/AppSubModule.java @@ -3,13 +3,15 @@ package mightypork.gamecore.control; import mightypork.gamecore.audio.SoundSystem; import mightypork.gamecore.control.bus.clients.BusNode; +import mightypork.gamecore.control.bus.clients.DelegatingClient; +import mightypork.gamecore.control.bus.clients.RootBusNode; import mightypork.gamecore.input.InputSystem; import mightypork.gamecore.render.DisplaySystem; /** - * App event bus client, to be used for subsystems, screens and anything that - * needs access to the eventbus + * Delegating bus client, to be attached to any {@link DelegatingClient}, such + * as a {@link RootBusNode}. * * @author MightyPork */ @@ -18,6 +20,11 @@ public abstract class AppSubModule extends BusNode implements AppAccess { private final AppAccess app; + /** + * Create submodule + * + * @param app access to app systems + */ public AppSubModule(AppAccess app) { super(app); diff --git a/src/mightypork/gamecore/control/BaseApp.java b/src/mightypork/gamecore/control/BaseApp.java index 5b5dfc8..623a694 100644 --- a/src/mightypork/gamecore/control/BaseApp.java +++ b/src/mightypork/gamecore/control/BaseApp.java @@ -52,15 +52,20 @@ public abstract class BaseApp implements AppAccess { } + /** + * Init the app + */ protected void initialize() { - preInit(); /* * Lock working directory */ initLock(); + // hook + preInit(); + /* * Setup logging */ @@ -77,7 +82,7 @@ public abstract class BaseApp implements AppAccess { eventBus = new EventBus(); Log.f3("Registering channels..."); - initChannels(eventBus); + initBus(eventBus); /* * Display @@ -98,7 +103,7 @@ public abstract class BaseApp implements AppAccess { */ Log.f2("Initializing Input System..."); inputSystem = new InputSystem(this); - initKeystrokes(inputSystem); + initInputSystem(inputSystem); /* * Prepare main loop @@ -130,40 +135,87 @@ public abstract class BaseApp implements AppAccess { } + /** + * Called at the beginning of the initialization sequence, right after lock + * was obtained. + */ @NoImpl protected void preInit() { } + /** + * + */ @NoImpl protected void postInit() { } + /** + * Create and configure a log (using {@link Log}) + * + * @return new log instance + */ protected abstract LogInstance createLog(); + /** + * Create window and configure display system + * + * @param display + */ protected abstract void initDisplay(DisplaySystem display); + /** + * Configure sound system (ie. adjust volume) + * + * @param audio + */ protected abstract void initSoundSystem(SoundSystem audio); - protected abstract void initKeystrokes(InputSystem input); + /** + * Configure input system (ie. define global keystrokes) + * + * @param input + */ + protected abstract void initInputSystem(InputSystem input); + /** + * Initialize resource banks; {@link AsyncResourceLoader} is already + * started. + */ protected abstract void initResources(); + /** + * Register game screens to the registry. + * + * @param screens + */ protected abstract void initScreens(ScreenRegistry screens); + /** + * Create game loop instance + * + * @return the game loop. + */ protected abstract GameLoop createLoop(); - protected void initChannels(EventBus bus) + /** + * Initialize event bus (ie. add custom channels)
+ * When overriding, must call super! + * + * @param bus + */ + protected void initBus(EventBus bus) { // framework events bus.addChannel(DestroyEvent.class, Destroyable.class); @@ -182,7 +234,7 @@ public abstract class BaseApp implements AppAccess { } - /** + /* * Try to obtain lock. */ private void initLock() diff --git a/src/mightypork/gamecore/control/GameLoop.java b/src/mightypork/gamecore/control/GameLoop.java index 6145f8e..7c467ea 100644 --- a/src/mightypork/gamecore/control/GameLoop.java +++ b/src/mightypork/gamecore/control/GameLoop.java @@ -45,6 +45,9 @@ public abstract class GameLoop extends AppModule implements MainLoopTaskRequest. } + /** + * Start the loop + */ public void start() { timer = new TimerDelta(); @@ -70,6 +73,9 @@ public abstract class GameLoop extends AppModule implements MainLoopTaskRequest. } + /** + * Called before render + */ @NoImpl protected void beforeRender() { @@ -77,6 +83,9 @@ public abstract class GameLoop extends AppModule implements MainLoopTaskRequest. } + /** + * Called after render + */ @NoImpl protected void afterRender() { diff --git a/src/mightypork/gamecore/control/SlickLogRedirector.java b/src/mightypork/gamecore/control/SlickLogRedirector.java index 9c2d066..077e3cc 100644 --- a/src/mightypork/gamecore/control/SlickLogRedirector.java +++ b/src/mightypork/gamecore/control/SlickLogRedirector.java @@ -16,6 +16,9 @@ public class SlickLogRedirector implements LogSystem { LogInstance l; + /** + * @param log log to redirect into + */ public SlickLogRedirector(LogInstance log) { this.l = log; } diff --git a/src/mightypork/gamecore/control/bus/BufferedHashSet.java b/src/mightypork/gamecore/control/bus/BufferedHashSet.java index e0c14b5..daf18d7 100644 --- a/src/mightypork/gamecore/control/bus/BufferedHashSet.java +++ b/src/mightypork/gamecore/control/bus/BufferedHashSet.java @@ -21,21 +21,40 @@ public class BufferedHashSet extends HashSet { private boolean buffering = false; + /** + * make empty + */ public BufferedHashSet() { super(); } + /** + * make from elements of a collection + * + * @param c + */ public BufferedHashSet(Collection c) { super(c); } + /** + * make new + * + * @param initialCapacity + * @param loadFactor + */ public BufferedHashSet(int initialCapacity, float loadFactor) { super(initialCapacity, loadFactor); } + /** + * make new + * + * @param initialCapacity + */ public BufferedHashSet(int initialCapacity) { super(initialCapacity); } diff --git a/src/mightypork/gamecore/control/bus/EventBus.java b/src/mightypork/gamecore/control/bus/EventBus.java index 821bb7e..b388fe6 100644 --- a/src/mightypork/gamecore/control/bus/EventBus.java +++ b/src/mightypork/gamecore/control/bus/EventBus.java @@ -36,6 +36,7 @@ final public class EventBus implements Destroyable { /** Whether the bus was destroyed */ private boolean dead = false; + /** Log detailed messages (debug) */ public boolean detailedLogging = false; @@ -255,6 +256,12 @@ final public class EventBus implements Destroyable { } + /** + * Check if client can be accepted by any channel + * + * @param client tested client + * @return would be accepted + */ public boolean isClientValid(Object client) { assertLive(); diff --git a/src/mightypork/gamecore/control/bus/clients/BusNode.java b/src/mightypork/gamecore/control/bus/clients/BusNode.java index 16e1502..61f99b6 100644 --- a/src/mightypork/gamecore/control/bus/clients/BusNode.java +++ b/src/mightypork/gamecore/control/bus/clients/BusNode.java @@ -24,6 +24,9 @@ public abstract class BusNode implements BusAccess, DelegatingClient, Toggleable private boolean delegating = true; + /** + * @param busAccess access to bus + */ public BusNode(BusAccess busAccess) { this.busAccess = busAccess; } diff --git a/src/mightypork/gamecore/control/bus/clients/RootBusNode.java b/src/mightypork/gamecore/control/bus/clients/RootBusNode.java index 1f4b12b..a399276 100644 --- a/src/mightypork/gamecore/control/bus/clients/RootBusNode.java +++ b/src/mightypork/gamecore/control/bus/clients/RootBusNode.java @@ -12,6 +12,9 @@ import mightypork.gamecore.control.interf.Destroyable; */ public abstract class RootBusNode extends BusNode implements Destroyable { + /** + * @param busAccess access to bus + */ public RootBusNode(BusAccess busAccess) { super(busAccess); diff --git a/src/mightypork/gamecore/control/bus/events/KeyEvent.java b/src/mightypork/gamecore/control/bus/events/KeyEvent.java index 4c6f1f1..c7a49c3 100644 --- a/src/mightypork/gamecore/control/bus/events/KeyEvent.java +++ b/src/mightypork/gamecore/control/bus/events/KeyEvent.java @@ -16,6 +16,11 @@ public class KeyEvent implements Event { private final char c; + /** + * @param key key that triggered the event. Can be KEY_NONE. + * @param c typed char (can be zero char) + * @param down true = pressed, false = released. + */ public KeyEvent(int key, char c, boolean down) { this.key = key; this.c = c; @@ -65,6 +70,11 @@ public class KeyEvent implements Event { keh.receive(this); } + /** + * {@link KeyEvent} listener + * + * @author MightyPork + */ public interface Listener { /** diff --git a/src/mightypork/gamecore/control/bus/events/MainLoopTaskRequest.java b/src/mightypork/gamecore/control/bus/events/MainLoopTaskRequest.java index f93062f..9786541 100644 --- a/src/mightypork/gamecore/control/bus/events/MainLoopTaskRequest.java +++ b/src/mightypork/gamecore/control/bus/events/MainLoopTaskRequest.java @@ -15,6 +15,9 @@ public class MainLoopTaskRequest implements Event private final Runnable task; + /** + * @param task task to run on main thread in rendering context + */ public MainLoopTaskRequest(Runnable task) { this.task = task; } @@ -26,6 +29,11 @@ public class MainLoopTaskRequest implements Event handler.queueTask(task); } + /** + * {@link MainLoopTaskRequest} listener + * + * @author MightyPork + */ public interface Listener { /** diff --git a/src/mightypork/gamecore/control/bus/events/MouseButtonEvent.java b/src/mightypork/gamecore/control/bus/events/MouseButtonEvent.java index e38e02f..c46009d 100644 --- a/src/mightypork/gamecore/control/bus/events/MouseButtonEvent.java +++ b/src/mightypork/gamecore/control/bus/events/MouseButtonEvent.java @@ -119,6 +119,11 @@ public class MouseButtonEvent implements Event { handler.receive(this); } + /** + * {@link MouseButtonEvent} listener + * + * @author MightyPork + */ public interface Listener { /** diff --git a/src/mightypork/gamecore/control/bus/events/MouseMotionEvent.java b/src/mightypork/gamecore/control/bus/events/MouseMotionEvent.java index 9c679b6..a401f45 100644 --- a/src/mightypork/gamecore/control/bus/events/MouseMotionEvent.java +++ b/src/mightypork/gamecore/control/bus/events/MouseMotionEvent.java @@ -17,6 +17,10 @@ public class MouseMotionEvent implements Event { private final Coord pos; + /** + * @param pos end pos + * @param move move vector + */ public MouseMotionEvent(Coord pos, Coord move) { this.move = move; this.pos = pos; @@ -47,6 +51,11 @@ public class MouseMotionEvent implements Event { keh.receive(this); } + /** + * {@link MouseMotionEvent} listener + * + * @author MightyPork + */ public interface Listener { /** diff --git a/src/mightypork/gamecore/control/bus/events/ResourceLoadRequest.java b/src/mightypork/gamecore/control/bus/events/ResourceLoadRequest.java index 5c50987..a2acad6 100644 --- a/src/mightypork/gamecore/control/bus/events/ResourceLoadRequest.java +++ b/src/mightypork/gamecore/control/bus/events/ResourceLoadRequest.java @@ -6,7 +6,7 @@ import mightypork.gamecore.loading.DeferredResource; /** - * Request to schedule loading a deferred resource. + * Request to load a deferred resource. * * @author MightyPork */ @@ -16,6 +16,9 @@ public class ResourceLoadRequest implements Event private final DeferredResource resource; + /** + * @param resource resource to load + */ public ResourceLoadRequest(DeferredResource resource) { this.resource = resource; } @@ -27,6 +30,11 @@ public class ResourceLoadRequest implements Event handler.loadResource(resource); } + /** + * {@link ResourceLoadRequest} listener + * + * @author MightyPork + */ public interface Listener { /** diff --git a/src/mightypork/gamecore/control/bus/events/ScreenChangeEvent.java b/src/mightypork/gamecore/control/bus/events/ScreenChangeEvent.java index c9c8cc0..c550fce 100644 --- a/src/mightypork/gamecore/control/bus/events/ScreenChangeEvent.java +++ b/src/mightypork/gamecore/control/bus/events/ScreenChangeEvent.java @@ -16,6 +16,11 @@ public class ScreenChangeEvent implements Event { private final boolean fsChanged; + /** + * @param fsChanged fullscreen change triggered the event + * @param fullscreen is now fullscreen + * @param size new screen size + */ public ScreenChangeEvent(boolean fsChanged, boolean fullscreen, Coord size) { this.fullscreen = fullscreen; this.screenSize = size; @@ -23,18 +28,27 @@ public class ScreenChangeEvent implements Event { } + /** + * @return true if screen is now fullscreen + */ public boolean isFullscreen() { return fullscreen; } + /** + * @return true if event was triggered by fullscreen toggle + */ public boolean fullscreenChanged() { return fsChanged; } + /** + * @return new screen size + */ public Coord getScreenSize() { return screenSize; @@ -47,8 +61,18 @@ public class ScreenChangeEvent implements Event { handler.receive(this); } + /** + * {@link ScreenChangeEvent} listener + * + * @author MightyPork + */ public interface Listener { + /** + * Handle event + * + * @param event + */ void receive(ScreenChangeEvent event); } } diff --git a/src/mightypork/gamecore/control/bus/events/ScreenRequestEvent.java b/src/mightypork/gamecore/control/bus/events/ScreenRequestEvent.java index 9290edc..ceb7193 100644 --- a/src/mightypork/gamecore/control/bus/events/ScreenRequestEvent.java +++ b/src/mightypork/gamecore/control/bus/events/ScreenRequestEvent.java @@ -15,6 +15,9 @@ public class ScreenRequestEvent implements Event { private final String scrName; + /** + * @param screenKey screen name + */ public ScreenRequestEvent(String screenKey) { scrName = screenKey; } @@ -26,8 +29,16 @@ public class ScreenRequestEvent implements Event { handler.showScreen(scrName); } + /** + * {@link ScreenRequestEvent} listener + * + * @author MightyPork + */ public interface Listener { + /** + * @param key screen to show + */ void showScreen(String key); } diff --git a/src/mightypork/gamecore/control/interf/NoImpl.java b/src/mightypork/gamecore/control/interf/NoImpl.java index 0b6850d..6efd2f7 100644 --- a/src/mightypork/gamecore/control/interf/NoImpl.java +++ b/src/mightypork/gamecore/control/interf/NoImpl.java @@ -8,6 +8,12 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Indicates that the marked method is not implemented and can be safely + * overriden. + * + * @author MightyPork + */ @Documented @Retention(RetentionPolicy.SOURCE) @Target(value = { ElementType.METHOD }) diff --git a/src/mightypork/gamecore/control/timing/Pauseable.java b/src/mightypork/gamecore/control/timing/Pauseable.java index 44dc3d8..41830c3 100644 --- a/src/mightypork/gamecore/control/timing/Pauseable.java +++ b/src/mightypork/gamecore/control/timing/Pauseable.java @@ -1,6 +1,11 @@ package mightypork.gamecore.control.timing; +/** + * Can be paused & resumed + * + * @author MightyPork + */ public interface Pauseable { /** diff --git a/src/mightypork/gamecore/gui/ActionTrigger.java b/src/mightypork/gamecore/gui/ActionTrigger.java index b9a624b..4a6ff27 100644 --- a/src/mightypork/gamecore/gui/ActionTrigger.java +++ b/src/mightypork/gamecore/gui/ActionTrigger.java @@ -8,5 +8,10 @@ package mightypork.gamecore.gui; */ public interface ActionTrigger { + /** + * Assign an action + * + * @param action action + */ void setAction(Action action); } diff --git a/src/mightypork/gamecore/gui/renderers/ColumnHolder.java b/src/mightypork/gamecore/gui/renderers/ColumnHolder.java index 684b8fc..30275dd 100644 --- a/src/mightypork/gamecore/gui/renderers/ColumnHolder.java +++ b/src/mightypork/gamecore/gui/renderers/ColumnHolder.java @@ -6,18 +6,35 @@ import mightypork.gamecore.control.AppAccess; import mightypork.utils.math.constraints.RectConstraint; +/** + * Holder with evenly spaced columns + * + * @author MightyPork + */ public class ColumnHolder extends ElementHolder { private final int cols; private int col = 0; + /** + * @param app app access + * @param context context + * @param rows number of rows + */ public ColumnHolder(AppAccess app, RectConstraint context, int rows) { super(app, context); this.cols = rows; } + /** + * make a new holder.
+ * Context must be assigned before rendering. + * + * @param app app access + * @param rows number of rows + */ public ColumnHolder(AppAccess app, int rows) { super(app); this.cols = rows; diff --git a/src/mightypork/gamecore/gui/renderers/ElementHolder.java b/src/mightypork/gamecore/gui/renderers/ElementHolder.java index 7395e3d..7c67f34 100644 --- a/src/mightypork/gamecore/gui/renderers/ElementHolder.java +++ b/src/mightypork/gamecore/gui/renderers/ElementHolder.java @@ -22,11 +22,18 @@ public abstract class ElementHolder extends BusNode implements PluggableRenderab private RectConstraint context; + /** + * @param app app access + */ public ElementHolder(AppAccess app) { super(app); } + /** + * @param app app access + * @param context boudning context + */ public ElementHolder(AppAccess app, RectConstraint context) { super(app); setContext(context); diff --git a/src/mightypork/gamecore/gui/renderers/ImagePainter.java b/src/mightypork/gamecore/gui/renderers/ImagePainter.java index c31f7eb..9972dee 100644 --- a/src/mightypork/gamecore/gui/renderers/ImagePainter.java +++ b/src/mightypork/gamecore/gui/renderers/ImagePainter.java @@ -5,16 +5,27 @@ import mightypork.gamecore.render.Render; import mightypork.gamecore.render.textures.TxQuad; +/** + * Draws image in given rect + * + * @author MightyPork + */ public class ImagePainter extends PluggableRenderer { private TxQuad texture; + /** + * @param texture drawn image + */ public ImagePainter(TxQuad texture) { this.texture = texture; } + /** + * @param texture texture to use + */ public void setTexture(TxQuad texture) { this.texture = texture; diff --git a/src/mightypork/gamecore/gui/renderers/PluggableRenderable.java b/src/mightypork/gamecore/gui/renderers/PluggableRenderable.java index e5d4938..6306fe0 100644 --- a/src/mightypork/gamecore/gui/renderers/PluggableRenderable.java +++ b/src/mightypork/gamecore/gui/renderers/PluggableRenderable.java @@ -6,6 +6,11 @@ import mightypork.utils.math.constraints.RectConstraint; import mightypork.utils.math.coord.Rect; +/** + * Renderable that can be assigned different context + * + * @author MightyPork + */ public interface PluggableRenderable extends Renderable, PluggableContext { @Override diff --git a/src/mightypork/gamecore/gui/renderers/RowHolder.java b/src/mightypork/gamecore/gui/renderers/RowHolder.java index ab478ac..58e2b4b 100644 --- a/src/mightypork/gamecore/gui/renderers/RowHolder.java +++ b/src/mightypork/gamecore/gui/renderers/RowHolder.java @@ -6,18 +6,35 @@ import mightypork.gamecore.control.AppAccess; import mightypork.utils.math.constraints.RectConstraint; +/** + * Holder with evenly spaced rows + * + * @author MightyPork + */ public class RowHolder extends ElementHolder { private final int rows; private int row = 0; + /** + * @param app app access + * @param context bounding context + * @param rows number of rows + */ public RowHolder(AppAccess app, RectConstraint context, int rows) { super(app, context); this.rows = rows; } + /** + * Make a row holder.
+ * Context must be assigned before rendering. + * + * @param app app access + * @param rows number of rows + */ public RowHolder(AppAccess app, int rows) { super(app); this.rows = rows; diff --git a/src/mightypork/gamecore/gui/renderers/TextPainter.java b/src/mightypork/gamecore/gui/renderers/TextPainter.java index 0d68bd3..d802423 100644 --- a/src/mightypork/gamecore/gui/renderers/TextPainter.java +++ b/src/mightypork/gamecore/gui/renderers/TextPainter.java @@ -9,6 +9,11 @@ import mightypork.utils.string.StringProvider; import mightypork.utils.string.StringProvider.StringWrapper; +/** + * Text painting component + * + * @author MightyPork + */ public class TextPainter extends PluggableRenderer { private final FontRenderer font; @@ -17,16 +22,35 @@ public class TextPainter extends PluggableRenderer { private StringProvider text; + /** + * @param font font to use + */ public TextPainter(GLFont font) { this(font, Align.LEFT, RGB.WHITE); } + /** + * Constructor for fixed text + * + * @param font font to use + * @param align text align + * @param color default color + * @param text drawn text + */ public TextPainter(GLFont font, Align align, RGB color, String text) { this(font, align, color, new StringWrapper(text)); } + /** + * COnstructor for changeable text. + * + * @param font font to use + * @param align text align + * @param color default color + * @param text text provider + */ public TextPainter(GLFont font, Align align, RGB color, StringProvider text) { this.font = new FontRenderer(font); this.color = color; @@ -35,6 +59,11 @@ public class TextPainter extends PluggableRenderer { } + /** + * @param font font to use + * @param align text align + * @param color default color + */ public TextPainter(GLFont font, Align align, RGB color) { this(font, align, color, (StringProvider) null); } @@ -63,43 +92,85 @@ public class TextPainter extends PluggableRenderer { } + /** + * Assign paint color + * + * @param color paint color + */ public void setColor(RGB color) { this.color = color; } + /** + * Set text align + * + * @param align text align + */ public void setAlign(Align align) { this.align = align; } + /** + * Set drawn text + * + * @param text text + */ public void setText(String text) { this.text = new StringWrapper(text); } + /** + * Set drawn text provider + * + * @param text text provider + */ public void setText(StringProvider text) { this.text = text; } - protected RGB getColor() + /** + * Get draw color.
+ * This getter is used for getting drawing color; so if it's overriden, + * the draw color can be adjusted in real time. + * + * @return drawing color + */ + public RGB getColor() { return color; } - protected Align getAlign() + /** + * Get text align.
+ * This getter is used for getting align; so if it's overidden, the align + * can be adjusted in real time. + * + * @return text align + */ + public Align getAlign() { return align; } - protected String getText() + /** + * Get text to draw.
+ * This getter is used for getting text to draw; so if it's overidden, + * the text can be adjusted in real time. (alternative to using + * StringProvider) + * + * @return text align + */ + public String getText() { return text.getString(); } diff --git a/src/mightypork/gamecore/gui/screens/LayeredScreen.java b/src/mightypork/gamecore/gui/screens/LayeredScreen.java index d51713a..f10fd3f 100644 --- a/src/mightypork/gamecore/gui/screens/LayeredScreen.java +++ b/src/mightypork/gamecore/gui/screens/LayeredScreen.java @@ -8,11 +8,19 @@ import mightypork.gamecore.control.AppAccess; import mightypork.gamecore.render.Render; +/** + * Screen with multiple instances of {@link ScreenLayer} + * + * @author MightyPork + */ public abstract class LayeredScreen extends Screen { private final Collection layers = new TreeSet<>(); + /** + * @param app app access + */ public LayeredScreen(AppAccess app) { super(app); } diff --git a/src/mightypork/gamecore/gui/screens/Screen.java b/src/mightypork/gamecore/gui/screens/Screen.java index 925b397..a38e53f 100644 --- a/src/mightypork/gamecore/gui/screens/Screen.java +++ b/src/mightypork/gamecore/gui/screens/Screen.java @@ -28,6 +28,9 @@ public abstract class Screen extends AppSubModule implements Renderable, KeyBind private volatile boolean needSetupViewport = false; + /** + * @param app app access + */ public Screen(AppAccess app) { super(app); diff --git a/src/mightypork/gamecore/gui/screens/ScreenLayer.java b/src/mightypork/gamecore/gui/screens/ScreenLayer.java index deaa8fc..65a559f 100644 --- a/src/mightypork/gamecore/gui/screens/ScreenLayer.java +++ b/src/mightypork/gamecore/gui/screens/ScreenLayer.java @@ -22,6 +22,9 @@ public abstract class ScreenLayer extends AppSubModule implements Comparable + * With vsync enabled, the target fps may not be met. + * + * @param fps requested fps + */ public void setTargetFps(int fps) { this.targetFps = fps; } + /** + * Create a main window + * + * @param width requested width + * @param height requested height + * @param resizable is resizable by the user + * @param fullscreen is in fullscreen + * @param title window title + */ public void createMainWindow(int width, int height, boolean resizable, boolean fullscreen, String title) { try { @@ -158,12 +180,18 @@ public class DisplaySystem extends AppModule implements RectConstraint { } + /** + * @return screen width + */ public static int getWidth() { return Display.getWidth(); } + /** + * @return screen height + */ public static int getHeight() { return Display.getHeight(); @@ -211,6 +239,7 @@ public class DisplaySystem extends AppModule implements RectConstraint { return fpsMeter.getFPS(); } + /** Screen width constraint */ public static final NumberConstraint width = new NumberConstraint() { @Override @@ -220,6 +249,7 @@ public class DisplaySystem extends AppModule implements RectConstraint { } }; + /** Screen height constaint */ public static final NumberConstraint height = new NumberConstraint() { @Override diff --git a/src/mightypork/gamecore/render/Render.java b/src/mightypork/gamecore/render/Render.java index b0a5c0a..d13e8dd 100644 --- a/src/mightypork/gamecore/render/Render.java +++ b/src/mightypork/gamecore/render/Render.java @@ -353,6 +353,13 @@ public class Render { } + /** + * Draw quad with horizontal gradient + * + * @param quad drawn quad bounds + * @param colorLeft left color + * @param colorRight right color + */ public static void quadGradH(Rect quad, RGB colorLeft, RGB colorRight) { final double left = quad.x1(); @@ -377,6 +384,13 @@ public class Render { } + /** + * Draw quad with vertical gradient + * + * @param quad drawn quad bounds + * @param colorTop top color + * @param colorBottom bottom color + */ public static void quadGradV(Rect quad, RGB colorTop, RGB colorBottom) { final double left = quad.x1(); diff --git a/src/mightypork/gamecore/render/Screenshot.java b/src/mightypork/gamecore/render/Screenshot.java index 5f08da0..5604aec 100644 --- a/src/mightypork/gamecore/render/Screenshot.java +++ b/src/mightypork/gamecore/render/Screenshot.java @@ -24,6 +24,12 @@ public class Screenshot { private BufferedImage image; + /** + * @param width image width + * @param height image height + * @param bpp bits per pixel (typically 4) + * @param buffer + */ public Screenshot(int width, int height, int bpp, ByteBuffer buffer) { this.width = width; this.height = height; @@ -32,6 +38,12 @@ public class Screenshot { } + /** + * Extract to an image.
+ * Subsequent calls will use a cached value. + * + * @return image + */ public BufferedImage getImage() { if (image != null) return image; @@ -53,6 +65,13 @@ public class Screenshot { } + /** + * Save to a file.
+ * Cached value is used if any. + * + * @param file target file + * @throws IOException on error writing to file + */ public void save(File file) throws IOException { ImageIO.write(getImage(), "PNG", file); diff --git a/src/mightypork/gamecore/render/fonts/FontBank.java b/src/mightypork/gamecore/render/fonts/FontBank.java index 0f786ce..73094ae 100644 --- a/src/mightypork/gamecore/render/fonts/FontBank.java +++ b/src/mightypork/gamecore/render/fonts/FontBank.java @@ -21,6 +21,9 @@ public class FontBank extends AppAdapter { private static final GLFont NULL_FONT = new NullFont(); + /** + * @param app app access + */ public FontBank(AppAccess app) { super(app); } diff --git a/src/mightypork/gamecore/render/fonts/GLFont.java b/src/mightypork/gamecore/render/fonts/GLFont.java index 04707a0..86e2e7e 100644 --- a/src/mightypork/gamecore/render/fonts/GLFont.java +++ b/src/mightypork/gamecore/render/fonts/GLFont.java @@ -5,6 +5,11 @@ import mightypork.utils.math.color.RGB; import mightypork.utils.math.coord.Coord; +/** + * Interface bor drawable font. + * + * @author MightyPork + */ public interface GLFont { /** diff --git a/src/mightypork/gamecore/render/fonts/SlickFont.java b/src/mightypork/gamecore/render/fonts/SlickFont.java index d3eaaf8..b8505c6 100644 --- a/src/mightypork/gamecore/render/fonts/SlickFont.java +++ b/src/mightypork/gamecore/render/fonts/SlickFont.java @@ -41,6 +41,11 @@ public class SlickFont implements GLFont { } + /** + * Set used filtering + * + * @param filter font filtering mode + */ public void setFiltering(FilterMode filter) { this.filter = filter; diff --git a/src/mightypork/gamecore/render/textures/DeferredTexture.java b/src/mightypork/gamecore/render/textures/DeferredTexture.java index 3342938..801c871 100644 --- a/src/mightypork/gamecore/render/textures/DeferredTexture.java +++ b/src/mightypork/gamecore/render/textures/DeferredTexture.java @@ -26,11 +26,20 @@ public class DeferredTexture extends BaseDeferredResource implements FilteredTex private WrapMode wrap = WrapMode.CLAMP; + /** + * @param resourcePath resource path + */ public DeferredTexture(String resourcePath) { super(resourcePath); } + /** + * Get a quad from this texture of given position/size + * + * @param rect quad rect + * @return the quad + */ public TxQuad getQuad(Rect rect) { return new TxQuad(this, rect); @@ -53,6 +62,9 @@ public class DeferredTexture extends BaseDeferredResource implements FilteredTex } + /** + * Bind without adjusting parameters + */ public void bindRaw() { if (!ensureLoaded()) return; @@ -61,12 +73,15 @@ public class DeferredTexture extends BaseDeferredResource implements FilteredTex } + /** + * Bind and adjust parameters (filter, wrap) + */ @Override public void bind() { if (!ensureLoaded()) return; - backingTexture.bind(); + bindRaw(); GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE); diff --git a/src/mightypork/gamecore/render/textures/FilterMode.java b/src/mightypork/gamecore/render/textures/FilterMode.java index bcab9d4..5e8a893 100644 --- a/src/mightypork/gamecore/render/textures/FilterMode.java +++ b/src/mightypork/gamecore/render/textures/FilterMode.java @@ -4,6 +4,11 @@ package mightypork.gamecore.render.textures; import org.lwjgl.opengl.GL11; +/** + * Texture filtering mode + * + * @author MightyPork + */ public enum FilterMode { LINEAR(GL11.GL_LINEAR), NEAREST(GL11.GL_NEAREST); diff --git a/src/mightypork/gamecore/render/textures/FilteredTexture.java b/src/mightypork/gamecore/render/textures/FilteredTexture.java index 3acfbbc..eef8d32 100644 --- a/src/mightypork/gamecore/render/textures/FilteredTexture.java +++ b/src/mightypork/gamecore/render/textures/FilteredTexture.java @@ -4,6 +4,11 @@ package mightypork.gamecore.render.textures; import org.newdawn.slick.opengl.Texture; +/** + * Texture with filter and wrap mode + * + * @author MightyPork + */ public interface FilteredTexture extends Texture { /** diff --git a/src/mightypork/gamecore/render/textures/TextureBank.java b/src/mightypork/gamecore/render/textures/TextureBank.java index be4abae..0334f3d 100644 --- a/src/mightypork/gamecore/render/textures/TextureBank.java +++ b/src/mightypork/gamecore/render/textures/TextureBank.java @@ -18,6 +18,9 @@ import org.newdawn.slick.opengl.Texture; */ public class TextureBank extends AppAdapter { + /** + * @param app app access + */ public TextureBank(AppAccess app) { super(app); } diff --git a/src/mightypork/gamecore/render/textures/TxQuad.java b/src/mightypork/gamecore/render/textures/TxQuad.java index 8f33540..b3ca54e 100644 --- a/src/mightypork/gamecore/render/textures/TxQuad.java +++ b/src/mightypork/gamecore/render/textures/TxQuad.java @@ -78,12 +78,22 @@ public class TxQuad { } + /** + * Clone another + * + * @param txQuad a copied quad + */ public TxQuad(TxQuad txQuad) { this.tx = txQuad.tx; this.uvs = txQuad.uvs.copy(); } + /** + * Get copy + * + * @return copy of this + */ public TxQuad copy() { return new TxQuad(this); diff --git a/src/mightypork/gamecore/render/textures/WrapMode.java b/src/mightypork/gamecore/render/textures/WrapMode.java index a9b26c5..aafb62b 100644 --- a/src/mightypork/gamecore/render/textures/WrapMode.java +++ b/src/mightypork/gamecore/render/textures/WrapMode.java @@ -4,6 +4,11 @@ package mightypork.gamecore.render.textures; import org.lwjgl.opengl.GL11; +/** + * Texture wrap mode + * + * @author MightyPork + */ public enum WrapMode { CLAMP(GL11.GL_CLAMP), REPEAT(GL11.GL_REPEAT); diff --git a/src/mightypork/rogue/App.java b/src/mightypork/rogue/App.java index 62aee6c..2797945 100644 --- a/src/mightypork/rogue/App.java +++ b/src/mightypork/rogue/App.java @@ -110,7 +110,7 @@ public class App extends BaseApp { @Override - protected void initKeystrokes(InputSystem input) + protected void initInputSystem(InputSystem input) { // Go fullscreen getInput().bindKeyStroke(new KeyStroke(Keys.KEY_F11), new Runnable() { @@ -177,9 +177,9 @@ public class App extends BaseApp { @Override - protected void initChannels(EventBus bus) + protected void initBus(EventBus bus) { - super.initChannels(bus); + super.initBus(bus); // custom channels bus.addChannel(ActionRequest.class, ActionRequest.Listener.class); diff --git a/src/mightypork/utils/math/animation/AnimDouble.java b/src/mightypork/utils/math/animation/AnimDouble.java index 5d08a9e..d6ed424 100644 --- a/src/mightypork/utils/math/animation/AnimDouble.java +++ b/src/mightypork/utils/math/animation/AnimDouble.java @@ -206,6 +206,13 @@ public class AnimDouble implements Updateable, Pauseable, NumberConstraint { } + /** + * Get progress already elapsed based on current value.
+ * Used to resume animation from current point in fading etc. + * + * @param value current value + * @return progress ratio 0-1 + */ protected double getProgressFromValue(double value) { double p = 0; diff --git a/src/mightypork/utils/math/constraints/ContextAdapter.java b/src/mightypork/utils/math/constraints/ContextAdapter.java index 7574295..2e96c29 100644 --- a/src/mightypork/utils/math/constraints/ContextAdapter.java +++ b/src/mightypork/utils/math/constraints/ContextAdapter.java @@ -4,7 +4,12 @@ package mightypork.utils.math.constraints; import mightypork.utils.math.coord.Rect; -public class ContextAdapter implements PluggableContext { +/** + * Basic pluggable context implementation + * + * @author MightyPork + */ +public abstract class ContextAdapter implements PluggableContext { private RectConstraint backing = null; diff --git a/src/mightypork/utils/math/constraints/NumberConstraint.java b/src/mightypork/utils/math/constraints/NumberConstraint.java index 72973ca..d00cfbc 100644 --- a/src/mightypork/utils/math/constraints/NumberConstraint.java +++ b/src/mightypork/utils/math/constraints/NumberConstraint.java @@ -1,8 +1,16 @@ package mightypork.utils.math.constraints; +/** + * Numeric constraint + * + * @author MightyPork + */ public interface NumberConstraint { + /** + * @return current value + */ double getValue(); } diff --git a/src/mightypork/utils/math/constraints/PluggableContext.java b/src/mightypork/utils/math/constraints/PluggableContext.java index 6815050..8671918 100644 --- a/src/mightypork/utils/math/constraints/PluggableContext.java +++ b/src/mightypork/utils/math/constraints/PluggableContext.java @@ -4,8 +4,16 @@ package mightypork.utils.math.constraints; import mightypork.utils.math.coord.Rect; +/** + * Interface for constraints that can be assigned context + * + * @author MightyPork + */ public interface PluggableContext extends RectConstraint { + /** + * @param rect context to set + */ abstract void setContext(RectConstraint rect);