cleanup and refactoring, package reorganization

master
Ondřej Hruška 11 years ago
parent 50cbc9479b
commit a4108f2caf
  1. 8
      src/junk/AppInitOptions.java
  2. 4
      src/junk/BaseApp.java
  3. 10
      src/mightypork/gamecore/audio/AudioModule.java
  4. 2
      src/mightypork/gamecore/audio/DeferredAudio.java
  5. 2
      src/mightypork/gamecore/audio/IAudio.java
  6. 2
      src/mightypork/gamecore/audio/JointVolume.java
  7. 6
      src/mightypork/gamecore/audio/SoundRegistry.java
  8. 2
      src/mightypork/gamecore/audio/Volume.java
  9. 6
      src/mightypork/gamecore/audio/players/BaseAudioPlayer.java
  10. 6
      src/mightypork/gamecore/audio/players/EffectPlayer.java
  11. 6
      src/mightypork/gamecore/audio/players/LoopPlayer.java
  12. 2
      src/mightypork/gamecore/backends/lwjgl/BufferHelper.java
  13. 6
      src/mightypork/gamecore/backends/lwjgl/InitTaskRedirectSlickLog.java
  14. 14
      src/mightypork/gamecore/backends/lwjgl/LwjglBackend.java
  15. 4
      src/mightypork/gamecore/backends/lwjgl/SlickLogRedirector.java
  16. 4
      src/mightypork/gamecore/backends/lwjgl/audio/SlickAudio.java
  17. 8
      src/mightypork/gamecore/backends/lwjgl/audio/SlickAudioModule.java
  18. 4
      src/mightypork/gamecore/backends/lwjgl/graphics/AwtScreenshot.java
  19. 10
      src/mightypork/gamecore/backends/lwjgl/graphics/LwjglGraphicsModule.java
  20. 6
      src/mightypork/gamecore/backends/lwjgl/graphics/SlickTexture.java
  21. 104
      src/mightypork/gamecore/backends/lwjgl/graphics/font/DeferredLwjglFont.java
  22. 37
      src/mightypork/gamecore/backends/lwjgl/graphics/font/DeferredLwjglFontFromSystem.java
  23. 12
      src/mightypork/gamecore/backends/lwjgl/graphics/font/LwjglTextureBackedFont.java
  24. 22
      src/mightypork/gamecore/core/App.java
  25. 25
      src/mightypork/gamecore/core/AppBackend.java
  26. 16
      src/mightypork/gamecore/core/AppPlugin.java
  27. 2
      src/mightypork/gamecore/core/BackendModule.java
  28. 22
      src/mightypork/gamecore/core/InitTask.java
  29. 2
      src/mightypork/gamecore/core/MainLoop.java
  30. 19
      src/mightypork/gamecore/core/OptionalInitTask.java
  31. 2
      src/mightypork/gamecore/core/config/InitTaskConfig.java
  32. 4
      src/mightypork/gamecore/core/init/InitTaskCrashHandler.java
  33. 6
      src/mightypork/gamecore/core/init/InitTaskDisplay.java
  34. 4
      src/mightypork/gamecore/core/init/InitTaskIonizables.java
  35. 4
      src/mightypork/gamecore/core/init/InitTaskLog.java
  36. 6
      src/mightypork/gamecore/core/init/InitTaskLogHeader.java
  37. 4
      src/mightypork/gamecore/core/init/InitTaskWorkdir.java
  38. 2
      src/mightypork/gamecore/core/plugins/screenshot/InitTaskPluginScreenshot.java
  39. 2
      src/mightypork/gamecore/core/plugins/screenshot/ScreenshotPlugin.java
  40. 2
      src/mightypork/gamecore/core/plugins/screenshot/TaskTakeScreenshot.java
  41. 2
      src/mightypork/gamecore/graphics/FullscreenToggleRequest.java
  42. 8
      src/mightypork/gamecore/graphics/GraphicsModule.java
  43. 2
      src/mightypork/gamecore/graphics/Renderable.java
  44. 2
      src/mightypork/gamecore/graphics/Screenshot.java
  45. 98
      src/mightypork/gamecore/graphics/fonts/DeferredFont.java
  46. 10
      src/mightypork/gamecore/graphics/fonts/FontRegistry.java
  47. 2
      src/mightypork/gamecore/graphics/fonts/FontRenderer.java
  48. 2
      src/mightypork/gamecore/graphics/fonts/Glyphs.java
  49. 2
      src/mightypork/gamecore/graphics/fonts/IFont.java
  50. 4
      src/mightypork/gamecore/graphics/textures/DeferredTexture.java
  51. 2
      src/mightypork/gamecore/graphics/textures/FilterMode.java
  52. 2
      src/mightypork/gamecore/graphics/textures/ITexture.java
  53. 2
      src/mightypork/gamecore/graphics/textures/QuadGrid.java
  54. 4
      src/mightypork/gamecore/graphics/textures/TextureRegistry.java
  55. 2
      src/mightypork/gamecore/graphics/textures/TxQuad.java
  56. 2
      src/mightypork/gamecore/graphics/textures/TxSheet.java
  57. 2
      src/mightypork/gamecore/graphics/textures/WrapMode.java
  58. 2
      src/mightypork/gamecore/gui/components/BaseComponent.java
  59. 2
      src/mightypork/gamecore/gui/components/PluggableRenderable.java
  60. 2
      src/mightypork/gamecore/gui/components/input/TextButton.java
  61. 2
      src/mightypork/gamecore/gui/components/painters/ImagePainter.java
  62. 4
      src/mightypork/gamecore/gui/components/painters/TextPainter.java
  63. 2
      src/mightypork/gamecore/gui/screens/Overlay.java
  64. 2
      src/mightypork/gamecore/gui/screens/Screen.java
  65. 2
      src/mightypork/gamecore/gui/screens/ScreenRegistry.java
  66. 18
      src/mightypork/gamecore/resources/Res.java
  67. 6
      src/mightypork/gamecore/resources/ResourceSetup.java
  68. 40
      src/mightypork/gamecore/resources/fonts/impl/LazyFontNative.java
  69. 3
      src/mightypork/gamecore/resources/loading/AsyncResourceLoader.java
  70. 2
      src/mightypork/gamecore/resources/loading/MustLoadInRenderingContext.java
  71. 3
      src/mightypork/gamecore/resources/loading/ResourceLoadRequest.java
  72. 4
      src/mightypork/gamecore/resources/loading/ResourceLoader.java
  73. 6
      src/mightypork/rogue/RogueApp.java
  74. 27
      src/mightypork/rogue/RogueResources.java
  75. 2
      src/mightypork/rogue/screens/FpsOverlay.java
  76. 2
      src/mightypork/rogue/screens/game/HeartBar.java
  77. 2
      src/mightypork/rogue/screens/game/IngameNav.java
  78. 2
      src/mightypork/rogue/screens/game/InvSlot.java
  79. 2
      src/mightypork/rogue/screens/game/LayerAskSave.java
  80. 2
      src/mightypork/rogue/screens/game/LayerDeath.java
  81. 2
      src/mightypork/rogue/screens/game/LayerWin.java
  82. 2
      src/mightypork/rogue/screens/game/NavButton.java
  83. 2
      src/mightypork/rogue/screens/menu/ScreenMainMenu.java
  84. 2
      src/mightypork/rogue/screens/select_world/WorldSlot.java
  85. 2
      src/mightypork/rogue/world/WorldRenderer.java
  86. 4
      src/mightypork/rogue/world/entity/render/EntityRendererMobLR.java
  87. 2
      src/mightypork/rogue/world/gui/WorldConsoleRenderer.java
  88. 2
      src/mightypork/rogue/world/item/render/QuadItemRenderer.java
  89. 4
      src/mightypork/rogue/world/tile/TileRenderer.java
  90. 2
      src/mightypork/rogue/world/tile/impl/TileBaseDoor.java
  91. 2
      src/mightypork/rogue/world/tile/impl/TileBaseFloor.java
  92. 2
      src/mightypork/rogue/world/tile/impl/TileBasePassage.java
  93. 2
      src/mightypork/rogue/world/tile/impl/TileBaseSecretDoor.java
  94. 2
      src/mightypork/rogue/world/tile/impl/TileBaseWall.java
  95. 2
      src/mightypork/rogue/world/tile/render/BasicTileRenderer.java
  96. 2
      src/mightypork/rogue/world/tile/render/ChestRenderer.java
  97. 2
      src/mightypork/rogue/world/tile/render/DoorTileRenderer.java
  98. 2
      src/mightypork/rogue/world/tile/render/OneFrameTileRenderer.java
  99. 2
      src/mightypork/rogue/world/tile/render/TwoHighTileRenderer.java

@ -6,10 +6,10 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import mightypork.gamecore.backend.Backend;
import mightypork.gamecore.resources.AsyncResourceLoader;
import mightypork.gamecore.resources.ResourceLoader;
import mightypork.gamecore.core.AppBackend;
import mightypork.gamecore.resources.ResourceSetup;
import mightypork.gamecore.resources.loading.AsyncResourceLoader;
import mightypork.gamecore.resources.loading.ResourceLoader;
/**
@ -62,7 +62,7 @@ public class AppInitOptions {
}
public void setBackend(Backend backend)
public void setBackend(AppBackend backend)
{
this.backend = backend;
}

@ -3,8 +3,8 @@ package junk;
import java.lang.Thread.UncaughtExceptionHandler;
import mightypork.gamecore.backend.Backend;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.AppBackend;
import mightypork.gamecore.core.MainLoop;
import mightypork.gamecore.core.WorkDir;
import mightypork.gamecore.core.config.Config;
@ -50,7 +50,7 @@ public abstract class BaseApp extends App implements UncaughtExceptionHandler {
}
public BaseApp(Backend backend) {
public BaseApp(AppBackend backend) {
super(backend);
}

@ -1,14 +1,14 @@
package mightypork.gamecore.resources.audio;
package mightypork.gamecore.audio;
import java.util.ArrayList;
import java.util.List;
import mightypork.gamecore.backend.BackendModule;
import mightypork.gamecore.audio.players.EffectPlayer;
import mightypork.gamecore.audio.players.LoopPlayer;
import mightypork.gamecore.core.App;
import mightypork.gamecore.resources.ResourceLoadRequest;
import mightypork.gamecore.resources.audio.players.EffectPlayer;
import mightypork.gamecore.resources.audio.players.LoopPlayer;
import mightypork.gamecore.core.BackendModule;
import mightypork.gamecore.resources.loading.ResourceLoadRequest;
import mightypork.utils.interfaces.Updateable;
import mightypork.utils.math.constraints.vect.Vect;

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.audio;
package mightypork.gamecore.audio;
import mightypork.gamecore.core.App;

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.audio;
package mightypork.gamecore.audio;
import mightypork.utils.interfaces.Destroyable;

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.audio;
package mightypork.gamecore.audio;
import mightypork.utils.math.Calc;

@ -1,12 +1,12 @@
package mightypork.gamecore.resources.audio;
package mightypork.gamecore.audio;
import java.util.HashMap;
import java.util.Map;
import mightypork.gamecore.audio.players.EffectPlayer;
import mightypork.gamecore.audio.players.LoopPlayer;
import mightypork.gamecore.core.App;
import mightypork.gamecore.resources.audio.players.EffectPlayer;
import mightypork.gamecore.resources.audio.players.LoopPlayer;
/**

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.audio;
package mightypork.gamecore.audio;
import mightypork.utils.math.Calc;

@ -1,8 +1,8 @@
package mightypork.gamecore.resources.audio.players;
package mightypork.gamecore.audio.players;
import mightypork.gamecore.resources.audio.DeferredAudio;
import mightypork.gamecore.resources.audio.Volume;
import mightypork.gamecore.audio.DeferredAudio;
import mightypork.gamecore.audio.Volume;
import mightypork.utils.interfaces.Destroyable;

@ -1,8 +1,8 @@
package mightypork.gamecore.resources.audio.players;
package mightypork.gamecore.audio.players;
import mightypork.gamecore.resources.audio.DeferredAudio;
import mightypork.gamecore.resources.audio.Volume;
import mightypork.gamecore.audio.DeferredAudio;
import mightypork.gamecore.audio.Volume;
import mightypork.utils.math.constraints.vect.Vect;

@ -1,8 +1,8 @@
package mightypork.gamecore.resources.audio.players;
package mightypork.gamecore.audio.players;
import mightypork.gamecore.resources.audio.DeferredAudio;
import mightypork.gamecore.resources.audio.Volume;
import mightypork.gamecore.audio.DeferredAudio;
import mightypork.gamecore.audio.Volume;
import mightypork.utils.interfaces.Pauseable;
import mightypork.utils.interfaces.Updateable;
import mightypork.utils.math.animation.NumAnimated;

@ -1,4 +1,4 @@
package mightypork.gamecore.util;
package mightypork.gamecore.backends.lwjgl;
import java.nio.FloatBuffer;

@ -1,7 +1,8 @@
package mightypork.gamecore.backend.lwjgl;
package mightypork.gamecore.backends.lwjgl;
import mightypork.gamecore.core.init.InitTask;
import mightypork.gamecore.core.InitTask;
import mightypork.gamecore.core.OptionalInitTask;
import mightypork.utils.logging.writers.LogWriter;
@ -10,6 +11,7 @@ import mightypork.utils.logging.writers.LogWriter;
*
* @author Ondřej Hruška (MightyPork)
*/
@OptionalInitTask
public class InitTaskRedirectSlickLog extends InitTask {
@Override

@ -1,9 +1,11 @@
package mightypork.gamecore.backend.lwjgl;
package mightypork.gamecore.backends.lwjgl;
import mightypork.gamecore.backend.Backend;
import mightypork.gamecore.render.GraphicsModule;
import mightypork.gamecore.resources.audio.AudioModule;
import mightypork.gamecore.audio.AudioModule;
import mightypork.gamecore.backends.lwjgl.audio.SlickAudioModule;
import mightypork.gamecore.backends.lwjgl.graphics.LwjglGraphicsModule;
import mightypork.gamecore.core.AppBackend;
import mightypork.gamecore.graphics.GraphicsModule;
/**
@ -11,7 +13,7 @@ import mightypork.gamecore.resources.audio.AudioModule;
*
* @author MightyPork
*/
public class LwjglBackend extends Backend {
public class LwjglBackend extends AppBackend {
private LwjglGraphicsModule graphics;
private SlickAudioModule audio;
@ -22,6 +24,8 @@ public class LwjglBackend extends Backend {
{
addChildClient(graphics = new LwjglGraphicsModule());
addChildClient(audio = new SlickAudioModule());
app.addInitTask(new InitTaskRedirectSlickLog());
}

@ -1,4 +1,4 @@
package mightypork.gamecore.backend.lwjgl;
package mightypork.gamecore.backends.lwjgl;
import java.util.logging.Level;
@ -11,7 +11,7 @@ import mightypork.utils.logging.writers.LogWriter;
*
* @author Ondřej Hruška (MightyPork)
*/
public class SlickLogRedirector implements org.newdawn.slick.util.LogSystem {
class SlickLogRedirector implements org.newdawn.slick.util.LogSystem {
LogWriter writer;

@ -1,10 +1,10 @@
package mightypork.gamecore.backend.lwjgl;
package mightypork.gamecore.backends.lwjgl.audio;
import java.io.IOException;
import java.io.InputStream;
import mightypork.gamecore.resources.audio.DeferredAudio;
import mightypork.gamecore.audio.DeferredAudio;
import mightypork.utils.files.FileUtil;
import org.lwjgl.openal.AL10;

@ -1,11 +1,11 @@
package mightypork.gamecore.backend.lwjgl;
package mightypork.gamecore.backends.lwjgl.audio;
import java.nio.FloatBuffer;
import mightypork.gamecore.resources.audio.AudioModule;
import mightypork.gamecore.resources.audio.DeferredAudio;
import mightypork.gamecore.util.BufferHelper;
import mightypork.gamecore.audio.AudioModule;
import mightypork.gamecore.audio.DeferredAudio;
import mightypork.gamecore.backends.lwjgl.BufferHelper;
import mightypork.utils.logging.Log;
import mightypork.utils.math.constraints.vect.Vect;
import mightypork.utils.math.constraints.vect.var.VectVar;

@ -1,4 +1,4 @@
package mightypork.gamecore.backend.lwjgl;
package mightypork.gamecore.backends.lwjgl.graphics;
import java.awt.image.BufferedImage;
@ -8,7 +8,7 @@ import java.nio.ByteBuffer;
import javax.imageio.ImageIO;
import mightypork.gamecore.render.Screenshot;
import mightypork.gamecore.graphics.Screenshot;
/**

@ -1,4 +1,4 @@
package mightypork.gamecore.backend.lwjgl;
package mightypork.gamecore.backends.lwjgl.graphics;
import static org.lwjgl.opengl.GL11.*;
@ -7,11 +7,11 @@ import java.nio.ByteBuffer;
import java.util.Stack;
import mightypork.gamecore.core.App;
import mightypork.gamecore.graphics.GraphicsModule;
import mightypork.gamecore.graphics.Screenshot;
import mightypork.gamecore.graphics.textures.DeferredTexture;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.gamecore.gui.events.ViewportChangeEvent;
import mightypork.gamecore.render.GraphicsModule;
import mightypork.gamecore.render.Screenshot;
import mightypork.gamecore.resources.textures.DeferredTexture;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.utils.logging.Log;
import mightypork.utils.math.color.Color;
import mightypork.utils.math.color.Grad;

@ -1,10 +1,10 @@
package mightypork.gamecore.backend.lwjgl;
package mightypork.gamecore.backends.lwjgl.graphics;
import java.io.IOException;
import mightypork.gamecore.resources.MustLoadInRenderingContext;
import mightypork.gamecore.resources.textures.DeferredTexture;
import mightypork.gamecore.graphics.textures.DeferredTexture;
import mightypork.gamecore.resources.loading.MustLoadInRenderingContext;
import mightypork.utils.annotations.Alias;
import mightypork.utils.exceptions.IllegalValueException;
import mightypork.utils.files.FileUtil;

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.fonts.impl;
package mightypork.gamecore.backends.lwjgl.graphics.font;
import java.awt.Font;
@ -6,10 +6,9 @@ import java.awt.FontFormatException;
import java.io.IOException;
import java.io.InputStream;
import mightypork.gamecore.resources.BaseDeferredResource;
import mightypork.gamecore.resources.MustLoadInRenderingContext;
import mightypork.gamecore.resources.fonts.IFont;
import mightypork.gamecore.resources.textures.FilterMode;
import mightypork.gamecore.graphics.fonts.DeferredFont;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.resources.loading.MustLoadInRenderingContext;
import mightypork.utils.annotations.Alias;
import mightypork.utils.files.FileUtil;
import mightypork.utils.math.color.Color;
@ -23,42 +22,11 @@ import mightypork.utils.math.constraints.vect.Vect;
*/
@MustLoadInRenderingContext
@Alias(name = "Font")
public class LazyFont extends BaseDeferredResource implements IFont {
public static enum FontStyle
{
PLAIN(Font.PLAIN), BOLD(Font.BOLD), ITALIC(Font.ITALIC), BOLD_ITALIC(Font.BOLD + Font.ITALIC);
int numval;
private FontStyle(int style) {
this.numval = style;
}
}
public class DeferredLwjglFont extends DeferredFont {
private IFont font = null;
private double size;
private FontStyle style;
private String chars;
private FilterMode filter;
private boolean antialias;
private double discardTop;
private double discardBottom;
/**
* A font from resource; setters shall be used to specify parameters in
* greater detail.
*
* @param resourcePath resource to load
* @param chars chars to load; null to load basic chars only
* @param size size (px)
*/
public LazyFont(String resourcePath, String chars, double size) {
this(resourcePath, chars, size, FontStyle.PLAIN, false, FilterMode.NEAREST);
}
/**
* A font from resource
@ -66,47 +34,11 @@ public class LazyFont extends BaseDeferredResource implements IFont {
* @param resourcePath resource to load
* @param chars chars to load; null to load basic chars only
* @param size size (px)
* @param style font style
* @param antialias use antialiasing for caching texture
* @param filter gl filtering mode
*/
public LazyFont(String resourcePath, String chars, double size, FontStyle style, boolean antialias, FilterMode filter) {
public DeferredLwjglFont(String resourcePath, String chars, double size) {
super(resourcePath);
this.size = size;
this.style = style;
this.chars = chars;
this.filter = filter;
this.antialias = antialias;
}
public synchronized void setSize(double size)
{
this.size = size;
}
public synchronized void setStyle(FontStyle style)
{
this.style = style;
}
public synchronized void setChars(String chars)
{
this.chars = chars;
}
public synchronized void setFilter(FilterMode filter)
{
this.filter = filter;
}
public synchronized void setAntialias(boolean antialias)
{
this.antialias = antialias;
}
@ -115,7 +47,7 @@ public class LazyFont extends BaseDeferredResource implements IFont {
{
final Font awtFont = getAwtFont(path, (float) size, style.numval);
font = new TextureBackedFont(awtFont, antialias, filter, chars);
font = new LwjglTextureBackedFont(awtFont, antialias, filter, chars);
font.setDiscardRatio(discardTop, discardBottom);
}
@ -209,26 +141,4 @@ public class LazyFont extends BaseDeferredResource implements IFont {
// this will have to suffice
font = null;
}
@Override
public void setDiscardRatio(double top, double bottom)
{
discardTop = top;
discardBottom = bottom;
}
@Override
public double getTopDiscardRatio()
{
return discardTop;
}
@Override
public double getBottomDiscardRatio()
{
return discardBottom;
}
}

@ -0,0 +1,37 @@
package mightypork.gamecore.backends.lwjgl.graphics.font;
import java.awt.Font;
import java.io.IOException;
import mightypork.gamecore.graphics.textures.FilterMode;
import mightypork.utils.annotations.Alias;
/**
* Font obtained from the OS
*
* @author Ondřej Hruška (MightyPork)
*/
@Alias(name = "FontNative")
public class DeferredLwjglFontFromSystem extends DeferredLwjglFont {
/**
* A font from OS, found by name
*
* @param fontName font family name
* @param chars chars to load; null to load basic chars only
* @param size size (pt)
*/
public DeferredLwjglFontFromSystem(String fontName, String chars, double size) {
super(fontName, chars, size);
}
@Override
protected Font getAwtFont(String resource, float size, int style) throws IOException
{
return new Font(resource, style, (int) size);
}
}

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.fonts.impl;
package mightypork.gamecore.backends.lwjgl.graphics.font;
import static org.lwjgl.opengl.GL11.*;
@ -18,8 +18,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mightypork.gamecore.resources.fonts.IFont;
import mightypork.gamecore.resources.textures.FilterMode;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.graphics.textures.FilterMode;
import mightypork.utils.exceptions.IllegalValueException;
import mightypork.utils.logging.Log;
import mightypork.utils.math.color.Color;
@ -41,7 +41,7 @@ import org.newdawn.slick.opengl.GLUtils;
* @author David Aaron Muhar (bobjob)
* @author Ondřej Hruška (MightyPork)
*/
public class TextureBackedFont implements IFont {
public class LwjglTextureBackedFont implements IFont {
private class CharTile {
@ -90,7 +90,7 @@ public class TextureBackedFont implements IFont {
* @param filter used Gl filter
* @param chars chars to load
*/
public TextureBackedFont(java.awt.Font font, boolean antialias, FilterMode filter, String chars) {
public LwjglTextureBackedFont(java.awt.Font font, boolean antialias, FilterMode filter, String chars) {
this(font, antialias, filter, (" " + chars).toCharArray());
}
@ -103,7 +103,7 @@ public class TextureBackedFont implements IFont {
* @param filter used Gl filter
* @param chars chars to load
*/
public TextureBackedFont(java.awt.Font font, boolean antialias, FilterMode filter, char[] chars) {
public LwjglTextureBackedFont(java.awt.Font font, boolean antialias, FilterMode filter, char[] chars) {
GLUtils.checkGLContext();
this.font = font;

@ -6,12 +6,13 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mightypork.gamecore.backend.Backend;
import mightypork.gamecore.audio.AudioModule;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.core.init.InitTask;
import mightypork.gamecore.core.plugins.AppPlugin;
import mightypork.gamecore.render.GraphicsModule;
import mightypork.gamecore.resources.audio.AudioModule;
import mightypork.gamecore.core.init.InitTaskCrashHandler;
import mightypork.gamecore.core.init.InitTaskIonizables;
import mightypork.gamecore.core.init.InitTaskLog;
import mightypork.gamecore.core.init.InitTaskLogHeader;
import mightypork.gamecore.graphics.GraphicsModule;
import mightypork.utils.annotations.Stub;
import mightypork.utils.eventbus.EventBus;
import mightypork.utils.eventbus.clients.BusNode;
@ -29,7 +30,7 @@ public class App extends BusNode {
private static App instance;
private final Backend backend;
private final AppBackend backend;
private final EventBus eventBus = new EventBus();
private boolean started = false;
@ -42,7 +43,7 @@ public class App extends BusNode {
*
* @param backend
*/
public App(Backend backend) {
public App(AppBackend backend) {
if (App.instance != null) {
throw new IllegalStateException("App already initialized");
}
@ -59,6 +60,7 @@ public class App extends BusNode {
// initialize and use backend
this.backend = backend;
this.eventBus.subscribe(backend);
this.backend.bind(this);
this.backend.initialize();
}
@ -75,8 +77,10 @@ public class App extends BusNode {
throw new IllegalStateException("App already started, cannot add plugins.");
}
plugin.initialize(this);
// attach to event bus
plugins.add(plugin);
plugin.bind(this);
plugin.initialize();
}
@ -100,7 +104,7 @@ public class App extends BusNode {
*
* @return the backend
*/
public Backend getBackend()
public AppBackend getBackend()
{
return backend;
}

@ -1,8 +1,8 @@
package mightypork.gamecore.backend;
package mightypork.gamecore.core;
import mightypork.gamecore.render.GraphicsModule;
import mightypork.gamecore.resources.audio.AudioModule;
import mightypork.gamecore.audio.AudioModule;
import mightypork.gamecore.graphics.GraphicsModule;
import mightypork.utils.eventbus.clients.BusNode;
@ -14,7 +14,24 @@ import mightypork.utils.eventbus.clients.BusNode;
*
* @author MightyPork
*/
public abstract class Backend extends BusNode {
public abstract class AppBackend extends BusNode {
protected App app;
/**
* Assign an app instance.
*
* @param app app
*/
public void bind(App app)
{
if (this.app != null) {
throw new IllegalStateException("App already set.");
}
this.app = app;
}
/**
* Initialize backend modules, add them to event bus.

@ -1,7 +1,6 @@
package mightypork.gamecore.core.plugins;
package mightypork.gamecore.core;
import mightypork.gamecore.core.App;
import mightypork.utils.annotations.Stub;
import mightypork.utils.eventbus.clients.BusNode;
@ -15,14 +14,21 @@ import mightypork.utils.eventbus.clients.BusNode;
*/
public class AppPlugin extends BusNode {
protected App app;
void bind(App app)
{
this.app = app;
}
/**
* Initialize the plugin for the given App.<br>
* The plugin is already attached to the event bus.
*
* @param app
*/
@Stub
public void initialize(App app)
public void initialize()
{
}
}

@ -1,4 +1,4 @@
package mightypork.gamecore.backend;
package mightypork.gamecore.core;
import mightypork.utils.annotations.Stub;

@ -1,4 +1,4 @@
package mightypork.gamecore.core.init;
package mightypork.gamecore.core;
import java.util.ArrayList;
@ -7,7 +7,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import mightypork.gamecore.core.App;
import mightypork.utils.Reflect;
import mightypork.utils.annotations.Stub;
import mightypork.utils.logging.Log;
@ -28,13 +28,8 @@ public abstract class InitTask {
* Assign the initialized app instance to a protected "app" field.
*
* @param app app
*/
public void bind(App app)
{
if (this.app != null) {
throw new IllegalStateException("App instance is already set.");
}
*/
void bind(App app) {
this.app = app;
}
@ -122,7 +117,14 @@ public abstract class InitTask {
if (remaining.size() > 0) {
// build error message for each bad task
int badInitializers = 0;
for (InitTask task : remaining) {
if (Reflect.hasAnnotation(task.getClass(), OptionalInitTask.class)) {
continue;
}
badInitializers++;
String notSatisfied = "";
for (String d : task.getDependencies()) {
@ -139,7 +141,7 @@ public abstract class InitTask {
Log.w("InitTask \"" + task.getName() + "\" - missing dependencies: " + notSatisfied);
}
throw new RuntimeException("Some InitTask dependencies could not be satisfied.");
if (badInitializers > 0) throw new RuntimeException("Some InitTask dependencies could not be satisfied.");
}
return ordered;

@ -4,8 +4,8 @@ package mightypork.gamecore.core;
import java.util.Deque;
import java.util.concurrent.ConcurrentLinkedDeque;
import mightypork.gamecore.graphics.Renderable;
import mightypork.gamecore.gui.screens.ScreenRegistry;
import mightypork.gamecore.render.Renderable;
import mightypork.utils.annotations.Stub;
import mightypork.utils.eventbus.clients.BusNode;
import mightypork.utils.eventbus.events.UpdateEvent;

@ -0,0 +1,19 @@
package mightypork.gamecore.core;
import java.lang.annotation.*;
/**
* Indicates that an {@link InitTask} can safely be ignored if it's dependencies
* are not satisfied.
*
* @author Ondřej Hruška (MightyPork)
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Inherited
public @interface OptionalInitTask {
}

@ -1,7 +1,7 @@
package mightypork.gamecore.core.config;
import mightypork.gamecore.core.init.InitTask;
import mightypork.gamecore.core.InitTask;
import mightypork.utils.annotations.Stub;
import mightypork.utils.exceptions.IllegalValueException;

@ -1,10 +1,10 @@
package mightypork.gamecore.core.init.impl;
package mightypork.gamecore.core.init;
import java.lang.Thread.UncaughtExceptionHandler;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.init.InitTask;
import mightypork.gamecore.core.InitTask;
import mightypork.utils.annotations.Stub;
import mightypork.utils.logging.Log;

@ -1,8 +1,8 @@
package mightypork.gamecore.core.init.impl;
package mightypork.gamecore.core.init;
import mightypork.gamecore.core.init.InitTask;
import mightypork.gamecore.render.GraphicsModule;
import mightypork.gamecore.core.InitTask;
import mightypork.gamecore.graphics.GraphicsModule;
/**

@ -1,9 +1,9 @@
package mightypork.gamecore.core.init.impl;
package mightypork.gamecore.core.init;
import java.io.IOException;
import mightypork.gamecore.core.init.InitTask;
import mightypork.gamecore.core.InitTask;
import mightypork.utils.ion.Ion;
import mightypork.utils.ion.IonInput;
import mightypork.utils.ion.IonOutput;

@ -1,11 +1,11 @@
package mightypork.gamecore.core.init.impl;
package mightypork.gamecore.core.init;
import java.io.File;
import java.util.logging.Level;
import mightypork.gamecore.core.InitTask;
import mightypork.gamecore.core.WorkDir;
import mightypork.gamecore.core.init.InitTask;
import mightypork.utils.logging.Log;
import mightypork.utils.logging.writers.LogWriter;
import mightypork.utils.string.StringUtil;

@ -1,10 +1,11 @@
package mightypork.gamecore.core.init.impl;
package mightypork.gamecore.core.init;
import java.io.IOException;
import mightypork.gamecore.core.InitTask;
import mightypork.gamecore.core.OptionalInitTask;
import mightypork.gamecore.core.WorkDir;
import mightypork.gamecore.core.init.InitTask;
import mightypork.utils.logging.Log;
@ -14,6 +15,7 @@ import mightypork.utils.logging.Log;
*
* @author Ondřej Hruška (MightyPork)
*/
@OptionalInitTask
public class InitTaskLogHeader extends InitTask {
@Override

@ -1,4 +1,4 @@
package mightypork.gamecore.core.init.impl;
package mightypork.gamecore.core.init;
import java.io.File;
@ -9,8 +9,8 @@ import java.util.Map.Entry;
import javax.swing.JOptionPane;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.InitTask;
import mightypork.gamecore.core.WorkDir;
import mightypork.gamecore.core.init.InitTask;
import mightypork.utils.annotations.Stub;
import mightypork.utils.files.InstanceLock;
import mightypork.utils.logging.Log;

@ -1,8 +1,8 @@
package mightypork.gamecore.core.plugins.screenshot;
import mightypork.gamecore.core.InitTask;
import mightypork.gamecore.core.WorkDir;
import mightypork.gamecore.core.init.InitTask;
/**

@ -2,8 +2,8 @@ package mightypork.gamecore.core.plugins.screenshot;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.AppPlugin;
import mightypork.gamecore.core.events.MainLoopRequest;
import mightypork.gamecore.core.plugins.AppPlugin;
import mightypork.utils.Support;

@ -6,7 +6,7 @@ import java.io.IOException;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.WorkDir;
import mightypork.gamecore.render.Screenshot;
import mightypork.gamecore.graphics.Screenshot;
import mightypork.utils.Support;
import mightypork.utils.logging.Log;

@ -1,4 +1,4 @@
package mightypork.gamecore.render;
package mightypork.gamecore.graphics;
import mightypork.utils.eventbus.BusEvent;

@ -1,9 +1,9 @@
package mightypork.gamecore.render;
package mightypork.gamecore.graphics;
import mightypork.gamecore.backend.BackendModule;
import mightypork.gamecore.resources.textures.DeferredTexture;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.gamecore.core.BackendModule;
import mightypork.gamecore.graphics.textures.DeferredTexture;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.utils.math.color.Color;
import mightypork.utils.math.color.Grad;
import mightypork.utils.math.constraints.rect.Rect;

@ -1,4 +1,4 @@
package mightypork.gamecore.render;
package mightypork.gamecore.graphics;
/**

@ -1,4 +1,4 @@
package mightypork.gamecore.render;
package mightypork.gamecore.graphics;
import java.io.File;

@ -0,0 +1,98 @@
package mightypork.gamecore.graphics.fonts;
import mightypork.gamecore.graphics.textures.FilterMode;
import mightypork.gamecore.resources.BaseDeferredResource;
/**
* Abstract deferred font stub.
*
* @author Ondřej Hruška (MightyPork)
*/
public abstract class DeferredFont extends BaseDeferredResource implements IFont {
public static enum FontStyle
{
PLAIN(0), BOLD(1), ITALIC(2), BOLD_ITALIC(3);
public int numval;
/**
* Font style
*
* @param style style index as in awt Font. Not using constants to be
* independent on awt.
*/
private FontStyle(int style) {
this.numval = style;
}
}
protected double size = 12;
protected FontStyle style = FontStyle.PLAIN;
protected String chars = Glyphs.basic;
protected FilterMode filter = FilterMode.NEAREST;
protected boolean antialias = false;
protected double discardTop = 0;
protected double discardBottom = 0;
public DeferredFont(String resource) {
super(resource);
}
public void setSize(double size)
{
this.size = size;
}
public void setStyle(FontStyle style)
{
this.style = style;
}
public void setChars(String chars)
{
this.chars = chars;
}
public void setFilter(FilterMode filter)
{
this.filter = filter;
}
public void setAntialias(boolean antialias)
{
this.antialias = antialias;
}
@Override
public void setDiscardRatio(double top, double bottom)
{
discardTop = top;
discardBottom = bottom;
}
@Override
public double getTopDiscardRatio()
{
return discardTop;
}
@Override
public double getBottomDiscardRatio()
{
return discardBottom;
}
}

@ -1,11 +1,11 @@
package mightypork.gamecore.resources.fonts;
package mightypork.gamecore.graphics.fonts;
import java.util.HashMap;
import mightypork.gamecore.backends.lwjgl.graphics.font.DeferredLwjglFont;
import mightypork.gamecore.core.App;
import mightypork.gamecore.resources.ResourceLoadRequest;
import mightypork.gamecore.resources.fonts.impl.LazyFont;
import mightypork.gamecore.resources.loading.ResourceLoadRequest;
import mightypork.utils.eventbus.clients.BusNode;
import org.newdawn.slick.opengl.Texture;
@ -23,12 +23,12 @@ public class FontRegistry extends BusNode {
/**
* Load a {@link LazyFont}
* Load a {@link DeferredLwjglFont}
*
* @param key font key
* @param font font instance
*/
public void addFont(String key, LazyFont font)
public void addFont(String key, DeferredFont font)
{
App.bus().send(new ResourceLoadRequest(font));

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.fonts;
package mightypork.gamecore.graphics.fonts;
import mightypork.gamecore.core.App;

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.fonts;
package mightypork.gamecore.graphics.fonts;
/**

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.fonts;
package mightypork.gamecore.graphics.fonts;
import mightypork.utils.math.color.Color;

@ -1,8 +1,8 @@
package mightypork.gamecore.resources.textures;
package mightypork.gamecore.graphics.textures;
import mightypork.gamecore.resources.BaseDeferredResource;
import mightypork.gamecore.resources.MustLoadInRenderingContext;
import mightypork.gamecore.resources.loading.MustLoadInRenderingContext;
import mightypork.utils.annotations.Alias;
import mightypork.utils.math.constraints.rect.Rect;

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.textures;
package mightypork.gamecore.graphics.textures;
/**

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.textures;
package mightypork.gamecore.graphics.textures;
import mightypork.utils.interfaces.Destroyable;

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.textures;
package mightypork.gamecore.graphics.textures;
import mightypork.utils.math.constraints.rect.Rect;

@ -1,11 +1,11 @@
package mightypork.gamecore.resources.textures;
package mightypork.gamecore.graphics.textures;
import java.util.HashMap;
import java.util.Map;
import mightypork.gamecore.core.App;
import mightypork.gamecore.resources.ResourceLoadRequest;
import mightypork.gamecore.resources.loading.ResourceLoadRequest;
import mightypork.utils.exceptions.KeyAlreadyExistsException;
import mightypork.utils.math.constraints.rect.Rect;

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.textures;
package mightypork.gamecore.graphics.textures;
import mightypork.utils.math.constraints.rect.Rect;

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.textures;
package mightypork.gamecore.graphics.textures;
import java.util.Random;

@ -1,4 +1,4 @@
package mightypork.gamecore.resources.textures;
package mightypork.gamecore.graphics.textures;
/**

@ -1,10 +1,10 @@
package mightypork.gamecore.gui.components;
import mightypork.gamecore.graphics.Renderable;
import mightypork.gamecore.gui.events.LayoutChangeEvent;
import mightypork.gamecore.gui.events.LayoutChangeListener;
import mightypork.gamecore.input.InputSystem;
import mightypork.gamecore.render.Renderable;
import mightypork.utils.Support;
import mightypork.utils.annotations.Stub;
import mightypork.utils.interfaces.Enableable;

@ -1,7 +1,7 @@
package mightypork.gamecore.gui.components;
import mightypork.gamecore.render.Renderable;
import mightypork.gamecore.graphics.Renderable;
import mightypork.utils.math.constraints.rect.PluggableRectBound;
import mightypork.utils.math.constraints.rect.Rect;
import mightypork.utils.math.constraints.rect.RectBound;

@ -1,10 +1,10 @@
package mightypork.gamecore.gui.components.input;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.gui.components.DynamicWidthComponent;
import mightypork.gamecore.gui.components.painters.TextPainter;
import mightypork.gamecore.input.InputSystem;
import mightypork.gamecore.resources.fonts.IFont;
import mightypork.utils.math.AlignX;
import mightypork.utils.math.color.Color;
import mightypork.utils.math.color.pal.RGB;

@ -2,9 +2,9 @@ package mightypork.gamecore.gui.components.painters;
import mightypork.gamecore.core.App;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.gamecore.gui.components.BaseComponent;
import mightypork.gamecore.gui.components.DynamicWidthComponent;
import mightypork.gamecore.resources.textures.TxQuad;
/**

@ -2,10 +2,10 @@ package mightypork.gamecore.gui.components.painters;
import mightypork.gamecore.core.App;
import mightypork.gamecore.graphics.fonts.FontRenderer;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.gui.components.BaseComponent;
import mightypork.gamecore.gui.components.DynamicWidthComponent;
import mightypork.gamecore.resources.fonts.FontRenderer;
import mightypork.gamecore.resources.fonts.IFont;
import mightypork.utils.math.AlignX;
import mightypork.utils.math.color.Color;
import mightypork.utils.math.color.pal.RGB;

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Collection;
import mightypork.gamecore.core.App;
import mightypork.gamecore.graphics.Renderable;
import mightypork.gamecore.gui.components.layout.ConstraintLayout;
import mightypork.gamecore.gui.events.LayoutChangeListener;
import mightypork.gamecore.input.Edge;
@ -12,7 +13,6 @@ import mightypork.gamecore.input.InputSystem;
import mightypork.gamecore.input.KeyBinder;
import mightypork.gamecore.input.KeyBindingPool;
import mightypork.gamecore.input.KeyStroke;
import mightypork.gamecore.render.Renderable;
import mightypork.utils.annotations.Stub;
import mightypork.utils.eventbus.clients.BusNode;
import mightypork.utils.interfaces.Enableable;

@ -2,13 +2,13 @@ package mightypork.gamecore.gui.screens;
import mightypork.gamecore.core.App;
import mightypork.gamecore.graphics.Renderable;
import mightypork.gamecore.gui.events.LayoutChangeEvent;
import mightypork.gamecore.gui.events.LayoutChangeListener;
import mightypork.gamecore.input.Edge;
import mightypork.gamecore.input.KeyBinder;
import mightypork.gamecore.input.KeyBindingPool;
import mightypork.gamecore.input.KeyStroke;
import mightypork.gamecore.render.Renderable;
import mightypork.utils.annotations.Stub;
import mightypork.utils.eventbus.clients.BusNode;
import mightypork.utils.math.constraints.rect.Rect;

@ -7,11 +7,11 @@ import java.util.Map;
import java.util.TreeSet;
import mightypork.gamecore.core.App;
import mightypork.gamecore.graphics.Renderable;
import mightypork.gamecore.gui.events.LayoutChangeEvent;
import mightypork.gamecore.gui.events.ScreenRequestListener;
import mightypork.gamecore.gui.events.ViewportChangeEvent;
import mightypork.gamecore.gui.events.ViewportChangeListener;
import mightypork.gamecore.render.Renderable;
import mightypork.utils.eventbus.clients.BusNode;
import mightypork.utils.logging.Log;

@ -1,15 +1,15 @@
package mightypork.gamecore.resources;
import mightypork.gamecore.resources.audio.SoundRegistry;
import mightypork.gamecore.resources.audio.players.EffectPlayer;
import mightypork.gamecore.resources.audio.players.LoopPlayer;
import mightypork.gamecore.resources.fonts.FontRegistry;
import mightypork.gamecore.resources.fonts.IFont;
import mightypork.gamecore.resources.textures.ITexture;
import mightypork.gamecore.resources.textures.TextureRegistry;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.gamecore.resources.textures.TxSheet;
import mightypork.gamecore.audio.SoundRegistry;
import mightypork.gamecore.audio.players.EffectPlayer;
import mightypork.gamecore.audio.players.LoopPlayer;
import mightypork.gamecore.graphics.fonts.FontRegistry;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.graphics.textures.ITexture;
import mightypork.gamecore.graphics.textures.TextureRegistry;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.gamecore.graphics.textures.TxSheet;
/**

@ -1,9 +1,9 @@
package mightypork.gamecore.resources;
import mightypork.gamecore.resources.audio.SoundRegistry;
import mightypork.gamecore.resources.fonts.FontRegistry;
import mightypork.gamecore.resources.textures.TextureRegistry;
import mightypork.gamecore.audio.SoundRegistry;
import mightypork.gamecore.graphics.fonts.FontRegistry;
import mightypork.gamecore.graphics.textures.TextureRegistry;
/**

@ -1,40 +0,0 @@
package mightypork.gamecore.resources.fonts.impl;
import java.awt.Font;
import java.io.IOException;
import mightypork.gamecore.resources.textures.FilterMode;
import mightypork.utils.annotations.Alias;
/**
* Font obtained from the OS
*
* @author Ondřej Hruška (MightyPork)
*/
@Alias(name = "FontNative")
public class LazyFontNative extends LazyFont {
/**
* A font from OS, found by name
*
* @param fontName font family name
* @param extraChars extra chars (0-255 loaded by default)
* @param size size (pt)
* @param style font style
* @param antialias use antialiasing when drawn on the cache texture
* @param filter GL filtering mode
*/
public LazyFontNative(String fontName, String extraChars, double size, FontStyle style, boolean antialias, FilterMode filter) {
super(fontName, extraChars, size, style, antialias, filter);
}
@Override
protected Font getAwtFont(String resource, float size, int style) throws IOException
{
return new Font(resource, style, (int) size);
}
}

@ -1,4 +1,4 @@
package mightypork.gamecore.resources;
package mightypork.gamecore.resources.loading;
import java.util.concurrent.ExecutorService;
@ -7,6 +7,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.events.MainLoopRequest;
import mightypork.gamecore.resources.DeferredResource;
import mightypork.utils.Reflect;
import mightypork.utils.Support;
import mightypork.utils.interfaces.Destroyable;

@ -1,4 +1,4 @@
package mightypork.gamecore.resources;
package mightypork.gamecore.resources.loading;
import java.lang.annotation.*;

@ -1,6 +1,7 @@
package mightypork.gamecore.resources;
package mightypork.gamecore.resources.loading;
import mightypork.gamecore.resources.DeferredResource;
import mightypork.utils.eventbus.BusEvent;
import mightypork.utils.eventbus.events.flags.SingleReceiverEvent;

@ -1,4 +1,6 @@
package mightypork.gamecore.resources;
package mightypork.gamecore.resources.loading;
import mightypork.gamecore.resources.DeferredResource;
/**

@ -3,19 +3,19 @@ package mightypork.rogue;
import junk.AppInitOptions;
import junk.BaseApp;
import mightypork.gamecore.backend.lwjgl.LwjglBackend;
import mightypork.gamecore.backends.lwjgl.LwjglBackend;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.core.events.MainLoopRequest;
import mightypork.gamecore.core.events.ShudownRequest;
import mightypork.gamecore.core.events.UserQuitRequest;
import mightypork.gamecore.core.plugins.screenshot.ScreenshotRequest;
import mightypork.gamecore.graphics.FullscreenToggleRequest;
import mightypork.gamecore.graphics.GraphicsModule;
import mightypork.gamecore.gui.events.ViewportChangeEvent;
import mightypork.gamecore.gui.events.ViewportChangeListener;
import mightypork.gamecore.gui.screens.ScreenRegistry;
import mightypork.gamecore.input.Edge;
import mightypork.gamecore.input.InputSystem;
import mightypork.gamecore.render.FullscreenToggleRequest;
import mightypork.gamecore.render.GraphicsModule;
import mightypork.gamecore.resources.Res;
import mightypork.rogue.RogueStateManager.RogueState;
import mightypork.rogue.events.RogueStateRequest;

@ -1,16 +1,17 @@
package mightypork.rogue;
import mightypork.gamecore.audio.SoundRegistry;
import mightypork.gamecore.backends.lwjgl.graphics.font.DeferredLwjglFont;
import mightypork.gamecore.graphics.fonts.DeferredFont;
import mightypork.gamecore.graphics.fonts.FontRegistry;
import mightypork.gamecore.graphics.fonts.Glyphs;
import mightypork.gamecore.graphics.textures.FilterMode;
import mightypork.gamecore.graphics.textures.ITexture;
import mightypork.gamecore.graphics.textures.QuadGrid;
import mightypork.gamecore.graphics.textures.TextureRegistry;
import mightypork.gamecore.graphics.textures.WrapMode;
import mightypork.gamecore.resources.ResourceSetup;
import mightypork.gamecore.resources.audio.SoundRegistry;
import mightypork.gamecore.resources.fonts.FontRegistry;
import mightypork.gamecore.resources.fonts.Glyphs;
import mightypork.gamecore.resources.fonts.impl.LazyFont;
import mightypork.gamecore.resources.textures.FilterMode;
import mightypork.gamecore.resources.textures.ITexture;
import mightypork.gamecore.resources.textures.QuadGrid;
import mightypork.gamecore.resources.textures.TextureRegistry;
import mightypork.gamecore.resources.textures.WrapMode;
import mightypork.utils.math.constraints.rect.Rect;
@ -19,15 +20,15 @@ public class RogueResources implements ResourceSetup {
@Override
public void addFonts(FontRegistry fonts)
{
LazyFont font;
DeferredFont font;
//fonts.loadFont("polygon_pixel", new DeferredFont("/res/font/PolygonPixel5x7Standard.ttf", Glyphs.basic, 16));
fonts.addFont("press_start", font = new LazyFont("/res/font/PressStart2P.ttf", Glyphs.basic, 16));
fonts.addFont("press_start", font = new DeferredLwjglFont("/res/font/PressStart2P.ttf", Glyphs.basic, 16));
fonts.addFont("battlenet", font = new LazyFont("/res/font/battlenet.ttf", Glyphs.basic, 16));
fonts.addFont("battlenet", font = new DeferredLwjglFont("/res/font/battlenet.ttf", Glyphs.basic, 16));
font.setDiscardRatio(3 / 16D, 2 / 16D);
fonts.addFont("tinyutf", font = new LazyFont("/res/font/TinyUnicode2.ttf", Glyphs.basic, 16));
fonts.addFont("tinyutf", font = new DeferredLwjglFont("/res/font/TinyUnicode2.ttf", Glyphs.basic, 16));
font.setDiscardRatio(5 / 16D, 3 / 16D);
// aliases

@ -3,12 +3,12 @@ package mightypork.rogue.screens;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.components.painters.TextPainter;
import mightypork.gamecore.gui.screens.Overlay;
import mightypork.gamecore.input.Edge;
import mightypork.gamecore.resources.Res;
import mightypork.gamecore.resources.fonts.IFont;
import mightypork.utils.math.AlignX;
import mightypork.utils.math.color.pal.RGB;
import mightypork.utils.math.constraints.num.Num;

@ -2,8 +2,8 @@ package mightypork.rogue.screens.game;
import mightypork.gamecore.core.App;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.gamecore.gui.components.BaseComponent;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.utils.math.AlignX;
import mightypork.utils.math.constraints.num.Num;
import mightypork.utils.math.constraints.num.var.NumVar;

@ -2,10 +2,10 @@ package mightypork.rogue.screens.game;
import mightypork.gamecore.core.App;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.gamecore.gui.components.LayoutComponent;
import mightypork.gamecore.gui.components.layout.FlowColumnLayout;
import mightypork.gamecore.resources.Res;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.utils.math.AlignX;
import mightypork.utils.math.constraints.rect.Rect;
import mightypork.utils.math.constraints.rect.RectBound;

@ -2,11 +2,11 @@ package mightypork.rogue.screens.game;
import mightypork.gamecore.core.App;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.components.input.ClickableComponent;
import mightypork.gamecore.gui.components.painters.TextPainter;
import mightypork.gamecore.resources.Res;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.rogue.world.PlayerFacade;
import mightypork.rogue.world.WorldProvider;
import mightypork.rogue.world.item.Item;

@ -4,6 +4,7 @@ package mightypork.rogue.screens.game;
import java.io.IOException;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.components.input.TextButton;
import mightypork.gamecore.gui.components.layout.RowLayout;
@ -13,7 +14,6 @@ import mightypork.gamecore.gui.components.painters.TextPainter;
import mightypork.gamecore.gui.screens.impl.FadingLayer;
import mightypork.gamecore.input.Edge;
import mightypork.gamecore.resources.Res;
import mightypork.gamecore.resources.fonts.IFont;
import mightypork.rogue.screens.game.ScreenGame.GScrState;
import mightypork.rogue.world.WorldProvider;
import mightypork.utils.logging.Log;

@ -4,6 +4,7 @@ package mightypork.rogue.screens.game;
import java.io.IOException;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.components.input.TextButton;
import mightypork.gamecore.gui.components.layout.RowLayout;
@ -15,7 +16,6 @@ import mightypork.gamecore.gui.components.painters.TextPainter;
import mightypork.gamecore.gui.screens.impl.FadingLayer;
import mightypork.gamecore.input.Edge;
import mightypork.gamecore.resources.Res;
import mightypork.gamecore.resources.fonts.IFont;
import mightypork.rogue.RogueStateManager.RogueState;
import mightypork.rogue.events.RogueStateRequest;
import mightypork.rogue.screens.game.ScreenGame.GScrState;

@ -4,6 +4,7 @@ package mightypork.rogue.screens.game;
import java.io.File;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.components.input.TextButton;
import mightypork.gamecore.gui.components.layout.RowLayout;
@ -14,7 +15,6 @@ import mightypork.gamecore.gui.components.painters.TextPainter;
import mightypork.gamecore.gui.screens.impl.FadingLayer;
import mightypork.gamecore.input.Edge;
import mightypork.gamecore.resources.Res;
import mightypork.gamecore.resources.fonts.IFont;
import mightypork.rogue.RogueStateManager.RogueState;
import mightypork.rogue.events.RogueStateRequest;
import mightypork.rogue.world.WorldProvider;

@ -2,9 +2,9 @@ package mightypork.rogue.screens.game;
import mightypork.gamecore.core.App;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.gamecore.gui.components.input.ClickableComponent;
import mightypork.gamecore.resources.Res;
import mightypork.gamecore.resources.textures.TxQuad;
/**

@ -3,6 +3,7 @@ package mightypork.rogue.screens.menu;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.core.events.UserQuitRequest;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.components.input.TextButton;
import mightypork.gamecore.gui.components.layout.RowLayout;
@ -13,7 +14,6 @@ import mightypork.gamecore.gui.screens.Screen;
import mightypork.gamecore.gui.screens.ScreenLayer;
import mightypork.gamecore.input.Edge;
import mightypork.gamecore.resources.Res;
import mightypork.gamecore.resources.fonts.IFont;
import mightypork.rogue.RogueStateManager.RogueState;
import mightypork.rogue.events.RogueStateRequest;
import mightypork.rogue.screens.RogueScreen;

@ -3,6 +3,7 @@ package mightypork.rogue.screens.select_world;
import java.io.File;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.components.input.TextButton;
import mightypork.gamecore.gui.components.layout.ConstraintLayout;
@ -10,7 +11,6 @@ import mightypork.gamecore.gui.components.layout.GridLayout;
import mightypork.gamecore.gui.components.painters.QuadPainter;
import mightypork.gamecore.gui.events.ScreenRequest;
import mightypork.gamecore.resources.Res;
import mightypork.gamecore.resources.fonts.IFont;
import mightypork.rogue.events.LoadingOverlayRequest;
import mightypork.rogue.world.World;
import mightypork.rogue.world.WorldProvider;

@ -2,7 +2,7 @@ package mightypork.rogue.world;
import mightypork.gamecore.core.App;
import mightypork.gamecore.render.GraphicsModule;
import mightypork.gamecore.graphics.GraphicsModule;
import mightypork.rogue.world.entity.Entity;
import mightypork.rogue.world.level.Level;
import mightypork.rogue.world.level.render.TileRenderContext;

@ -2,9 +2,9 @@ package mightypork.rogue.world.entity.render;
import mightypork.gamecore.core.App;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.gamecore.graphics.textures.TxSheet;
import mightypork.gamecore.resources.Res;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.gamecore.resources.textures.TxSheet;
import mightypork.rogue.world.entity.Entity;
import mightypork.rogue.world.entity.EntityRenderer;
import mightypork.rogue.world.level.render.MapRenderContext;

@ -4,9 +4,9 @@ package mightypork.rogue.world.gui;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import mightypork.gamecore.graphics.fonts.FontRenderer;
import mightypork.gamecore.gui.components.BaseComponent;
import mightypork.gamecore.resources.Res;
import mightypork.gamecore.resources.fonts.FontRenderer;
import mightypork.rogue.world.WorldConsole;
import mightypork.rogue.world.WorldProvider;
import mightypork.utils.logging.Log;

@ -2,7 +2,7 @@ package mightypork.rogue.world.item.render;
import mightypork.gamecore.core.App;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.rogue.world.item.Item;
import mightypork.rogue.world.item.ItemRenderer;
import mightypork.utils.math.constraints.rect.Rect;

@ -2,9 +2,9 @@ package mightypork.rogue.world.tile;
import mightypork.gamecore.core.App;
import mightypork.gamecore.render.GraphicsModule;
import mightypork.gamecore.graphics.GraphicsModule;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.gamecore.resources.Res;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.rogue.world.level.render.TileRenderContext;
import mightypork.rogue.world.tile.render.NullTileRenderer;
import mightypork.utils.annotations.Stub;

@ -3,7 +3,7 @@ package mightypork.rogue.world.tile.impl;
import java.io.IOException;
import mightypork.gamecore.resources.textures.TxSheet;
import mightypork.gamecore.graphics.textures.TxSheet;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.TileRenderer;
import mightypork.rogue.world.tile.TileType;

@ -1,7 +1,7 @@
package mightypork.rogue.world.tile.impl;
import mightypork.gamecore.resources.textures.TxSheet;
import mightypork.gamecore.graphics.textures.TxSheet;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.TileRenderer;
import mightypork.rogue.world.tile.TileType;

@ -1,7 +1,7 @@
package mightypork.rogue.world.tile.impl;
import mightypork.gamecore.resources.textures.TxSheet;
import mightypork.gamecore.graphics.textures.TxSheet;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.TileRenderer;
import mightypork.rogue.world.tile.TileType;

@ -3,7 +3,7 @@ package mightypork.rogue.world.tile.impl;
import java.io.IOException;
import mightypork.gamecore.resources.textures.TxSheet;
import mightypork.gamecore.graphics.textures.TxSheet;
import mightypork.rogue.world.tile.TileColors;
import mightypork.rogue.world.tile.TileModel;
import mightypork.utils.ion.IonInput;

@ -1,7 +1,7 @@
package mightypork.rogue.world.tile.impl;
import mightypork.gamecore.resources.textures.TxSheet;
import mightypork.gamecore.graphics.textures.TxSheet;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.TileType;
import mightypork.rogue.world.tile.render.BasicTileRenderer;

@ -2,7 +2,7 @@ package mightypork.rogue.world.tile.render;
import mightypork.gamecore.core.App;
import mightypork.gamecore.resources.textures.TxSheet;
import mightypork.gamecore.graphics.textures.TxSheet;
import mightypork.rogue.world.level.render.TileRenderContext;
import mightypork.rogue.world.tile.Tile;
import mightypork.rogue.world.tile.TileRenderer;

@ -2,7 +2,7 @@ package mightypork.rogue.world.tile.render;
import mightypork.gamecore.core.App;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.rogue.world.level.render.TileRenderContext;
import mightypork.rogue.world.tile.TileRenderer;
import mightypork.rogue.world.tile.impl.TileBaseChest;

@ -2,7 +2,7 @@ package mightypork.rogue.world.tile.render;
import mightypork.gamecore.core.App;
import mightypork.gamecore.resources.textures.TxSheet;
import mightypork.gamecore.graphics.textures.TxSheet;
import mightypork.rogue.world.level.render.TileRenderContext;
import mightypork.rogue.world.tile.TileRenderer;
import mightypork.rogue.world.tile.impl.TileBaseDoor;

@ -2,7 +2,7 @@ package mightypork.rogue.world.tile.render;
import mightypork.gamecore.core.App;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.rogue.world.level.render.TileRenderContext;
import mightypork.rogue.world.tile.Tile;
import mightypork.rogue.world.tile.TileRenderer;

@ -2,7 +2,7 @@ package mightypork.rogue.world.tile.render;
import mightypork.gamecore.core.App;
import mightypork.gamecore.resources.textures.TxQuad;
import mightypork.gamecore.graphics.textures.TxQuad;
import mightypork.rogue.world.level.render.TileRenderContext;
import mightypork.rogue.world.tile.Tile;
import mightypork.rogue.world.tile.TileRenderer;

Loading…
Cancel
Save