From 36e4f06c45d1cb0a7d5fd34217ed44e4a8ea04a5 Mon Sep 17 00:00:00 2001 From: PanJohnny Date: Wed, 25 Oct 2023 21:12:36 +0200 Subject: [PATCH] Javadocs --- .../pjgl/adapt/desktop/package-info.java | 3 +- .../pjgl/adapt/lwjgl/GLFWKeyboard.java | 5 ++++ .../pjgl/adapt/lwjgl/LWJGLConstants.java | 4 +++ .../pjgl/adapt/lwjgl/LWJGLInitializer.java | 3 +- .../pjgl/adapt/lwjgl/OpenGLRenderer.java | 30 ++++++++++++++++++- .../pjgl/adapt/lwjgl/package-info.java | 7 +++++ .../panjohnny/pjgl/adapt/package-info.java | 7 +++++ .../panjohnny/pjgl/api/asset/Animation.java | 8 +++++ .../pjgl/api/asset/SpriteRegistry.java | 1 + .../pjgl/api/asset/atlas/AtlasRegion.java | 3 ++ .../pjgl/api/asset/atlas/TextureAtlas.java | 6 ++++ .../pjgl/api/asset/atlas/package-info.java | 6 ++++ .../pjgl/api/asset/package-info.java | 7 +++++ .../pjgl/api/camera/OrthographicCamera2D.java | 3 +- .../pjgl/api/camera/package-info.java | 4 +++ .../pjgl/api/event/package-info.java | 6 ++++ .../pjgl/api/object/components/Animator.java | 2 ++ .../api/object/components/package-info.java | 4 +++ .../pjgl/api/object/package-info.java | 4 +++ .../com/panjohnny/pjgl/api/package-info.java | 6 ++++ .../com/panjohnny/pjgl/api/util/FileUtil.java | 4 +++ .../pjgl/api/util/SerializationUtil.java | 5 ++++ .../com/panjohnny/pjgl/api/util/Track.java | 5 +++- .../panjohnny/pjgl/api/util/package-info.java | 4 +++ .../pjgl/core/adapters/package-info.java | 4 +++ .../com/panjohnny/pjgl/core/package-info.java | 6 ++++ .../java/com/panjohnny/pjgl/package-info.java | 6 ++++ 27 files changed, 148 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/panjohnny/pjgl/adapt/lwjgl/package-info.java create mode 100644 src/main/java/com/panjohnny/pjgl/adapt/package-info.java create mode 100644 src/main/java/com/panjohnny/pjgl/api/asset/atlas/package-info.java create mode 100644 src/main/java/com/panjohnny/pjgl/api/asset/package-info.java create mode 100644 src/main/java/com/panjohnny/pjgl/api/camera/package-info.java create mode 100644 src/main/java/com/panjohnny/pjgl/api/event/package-info.java create mode 100644 src/main/java/com/panjohnny/pjgl/api/object/components/package-info.java create mode 100644 src/main/java/com/panjohnny/pjgl/api/object/package-info.java create mode 100644 src/main/java/com/panjohnny/pjgl/api/package-info.java create mode 100644 src/main/java/com/panjohnny/pjgl/api/util/package-info.java create mode 100644 src/main/java/com/panjohnny/pjgl/core/adapters/package-info.java create mode 100644 src/main/java/com/panjohnny/pjgl/core/package-info.java create mode 100644 src/main/java/com/panjohnny/pjgl/package-info.java diff --git a/src/main/java/com/panjohnny/pjgl/adapt/desktop/package-info.java b/src/main/java/com/panjohnny/pjgl/adapt/desktop/package-info.java index d893bc2..2e51241 100644 --- a/src/main/java/com/panjohnny/pjgl/adapt/desktop/package-info.java +++ b/src/main/java/com/panjohnny/pjgl/adapt/desktop/package-info.java @@ -1,4 +1,5 @@ /** - * Adaptation for java.desktopwith swing and awt. + * {@code java-desktop@pjgl}

+ * PJGL adaptation that uses {@code java.desktop} module. That means: {@link java.awt} and {@link javax.swing}. */ package com.panjohnny.pjgl.adapt.desktop; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/GLFWKeyboard.java b/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/GLFWKeyboard.java index 504b641..2fdf104 100644 --- a/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/GLFWKeyboard.java +++ b/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/GLFWKeyboard.java @@ -6,6 +6,11 @@ import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFWKeyCallbackI; +/** + * Keyboard implementation using GLFW. + * + * @author PanJohnny + */ @Adaptation("lwjgl@pjgl") public class GLFWKeyboard implements KeyboardAdapter, GLFWKeyCallbackI { private final boolean[] keys; diff --git a/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/LWJGLConstants.java b/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/LWJGLConstants.java index ba82f29..e9bb944 100644 --- a/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/LWJGLConstants.java +++ b/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/LWJGLConstants.java @@ -2,6 +2,10 @@ import com.panjohnny.pjgl.adapt.Adaptation; +/** + * Provides constants shared across this adaptation. + * @author PanJohnny + */ @SuppressWarnings("unused") @Adaptation("lwjgl@pjgl") public class LWJGLConstants { diff --git a/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/LWJGLInitializer.java b/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/LWJGLInitializer.java index 6a41d29..ce87210 100644 --- a/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/LWJGLInitializer.java +++ b/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/LWJGLInitializer.java @@ -13,7 +13,8 @@ import static org.lwjgl.glfw.GLFW.*; /** - * An initializer for quickly starting your project with LWJGL adaptation + * An initializer for quickly starting your project with LWJGL adaptation. + * @author PanJohnny */ @Adaptation("lwjgl@pjgl") public class LWJGLInitializer implements PJGLInitializer { diff --git a/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/OpenGLRenderer.java b/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/OpenGLRenderer.java index 48e4145..1733f51 100644 --- a/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/OpenGLRenderer.java +++ b/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/OpenGLRenderer.java @@ -5,8 +5,8 @@ import com.panjohnny.pjgl.api.PJGL; import com.panjohnny.pjgl.api.PJGLEvents; import com.panjohnny.pjgl.api.asset.Sprite; -import com.panjohnny.pjgl.api.asset.atlas.AtlasRegion; import com.panjohnny.pjgl.api.asset.SpriteRegistry; +import com.panjohnny.pjgl.api.asset.atlas.AtlasRegion; import com.panjohnny.pjgl.api.camera.OrthographicCamera2D; import com.panjohnny.pjgl.api.object.GameObject; import com.panjohnny.pjgl.api.object.components.Position; @@ -34,7 +34,21 @@ import static org.lwjgl.opengl.GL11C.glEnable; /** + *

Rendering with OpenGL

+ *

Default states

+ *
    + *
  • {@code GL_TEXTURE_2D}
  • + *
  • {@code GL_TRIANGLES}
  • + *
  • {@code GL_BLEND}
  • + *
+ * + *

Rendering

+ *

Uses orthographic view to render objects. Supports rendering {@link com.panjohnny.pjgl.api.asset.atlas.TextureAtlas} and {@link Sprite} of type Integer.

+ * + * + * @apiNote This renderer is really simple and I advise you to check the source code. If you are not happy with the result and capabilities create your own. * @author PanJohnny + * @see OpenGLOrthographicCamera */ @Adaptation("lwjgl@pjgl") public class OpenGLRenderer implements RendererAdapter { @@ -191,6 +205,20 @@ public OrthographicCamera2D getCamera() { return cam; } + /** + * Provides the functionality as a orthographic camera. Uses the following functions: + *
+     * {@code
+     * glMatrixMode(GL_PROJECTION);
+     * glLoadIdentity();
+     * glViewport(0, 0, windowWidth, windowHeight);
+     * glOrtho(0.0f, windowWidth, windowHeight, 0.0f, 0.0f, 1.0f);
+     * glTranslated(transformX, transformY, 0);
+     * glScaled(scaleX, scaleY, 0);
+     * }
+     * 
+ * @author PanJohnny + */ public static class OpenGLOrthographicCamera extends OrthographicCamera2D { @Override diff --git a/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/package-info.java b/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/package-info.java new file mode 100644 index 0000000..1e4d3b0 --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/adapt/lwjgl/package-info.java @@ -0,0 +1,7 @@ +/** + * {@code lwjgl@pjgl}

+ * PJGL adaptation that uses {@link org.lwjgl}. + * + * @see com.panjohnny.pjgl.adapt.lwjgl.OpenGLRenderer + */ +package com.panjohnny.pjgl.adapt.lwjgl; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/adapt/package-info.java b/src/main/java/com/panjohnny/pjgl/adapt/package-info.java new file mode 100644 index 0000000..d58e591 --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/adapt/package-info.java @@ -0,0 +1,7 @@ +/** + * Contains default adaptations. The {@link com.panjohnny.pjgl.adapt.Adaptation} annotation is so to be present on every adaptation class. + * + * @see com.panjohnny.pjgl.adapt.lwjgl.LWJGLInitializer + * @see com.panjohnny.pjgl.adapt.desktop.JDInitializer + */ +package com.panjohnny.pjgl.adapt; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/api/asset/Animation.java b/src/main/java/com/panjohnny/pjgl/api/asset/Animation.java index 385a837..1593a9a 100644 --- a/src/main/java/com/panjohnny/pjgl/api/asset/Animation.java +++ b/src/main/java/com/panjohnny/pjgl/api/asset/Animation.java @@ -16,6 +16,14 @@ import java.util.List; import java.util.function.BiConsumer; +/** + * Create animations! + * + * @see Animation#loadFromJson(String, BiConsumer) + * @see AnimationBuilder + * + * @author PanJohnny + */ @SuppressWarnings({"unused", "UnusedReturnValue"}) public class Animation { private final String id; diff --git a/src/main/java/com/panjohnny/pjgl/api/asset/SpriteRegistry.java b/src/main/java/com/panjohnny/pjgl/api/asset/SpriteRegistry.java index 2490d05..3ec504e 100644 --- a/src/main/java/com/panjohnny/pjgl/api/asset/SpriteRegistry.java +++ b/src/main/java/com/panjohnny/pjgl/api/asset/SpriteRegistry.java @@ -20,6 +20,7 @@ *

Texture Sprites

*

These sprites contain integer representing OpenGL texture.

*

Register them with {@link #registerTextureSprite(String, String)}. This method supports loading from filesystem.

+ * @author PanJohnny */ @SuppressWarnings("unused") public final class SpriteRegistry { diff --git a/src/main/java/com/panjohnny/pjgl/api/asset/atlas/AtlasRegion.java b/src/main/java/com/panjohnny/pjgl/api/asset/atlas/AtlasRegion.java index ed66b86..f0a261c 100644 --- a/src/main/java/com/panjohnny/pjgl/api/asset/atlas/AtlasRegion.java +++ b/src/main/java/com/panjohnny/pjgl/api/asset/atlas/AtlasRegion.java @@ -2,6 +2,9 @@ import com.panjohnny.pjgl.api.asset.Sprite; +/** + * @author PanJohnny + */ public class AtlasRegion extends Sprite { private final float offsetX; private final float offsetY; diff --git a/src/main/java/com/panjohnny/pjgl/api/asset/atlas/TextureAtlas.java b/src/main/java/com/panjohnny/pjgl/api/asset/atlas/TextureAtlas.java index e0b489e..e8e6bbe 100644 --- a/src/main/java/com/panjohnny/pjgl/api/asset/atlas/TextureAtlas.java +++ b/src/main/java/com/panjohnny/pjgl/api/asset/atlas/TextureAtlas.java @@ -2,6 +2,12 @@ import com.panjohnny.pjgl.api.asset.Sprite; +/** + * Texture atlases are used to optimize rendering. + * + * @apiNote Only for LWJGL + * @author PanJohnny + */ public class TextureAtlas extends Sprite { private final int width, height; public TextureAtlas(String id, Integer image, int width, int height) { diff --git a/src/main/java/com/panjohnny/pjgl/api/asset/atlas/package-info.java b/src/main/java/com/panjohnny/pjgl/api/asset/atlas/package-info.java new file mode 100644 index 0000000..33b1e20 --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/api/asset/atlas/package-info.java @@ -0,0 +1,6 @@ +/** + * Use texture atlas to optimize rendering. + * + * @see com.panjohnny.pjgl.api.asset.atlas.TextureAtlas + */ +package com.panjohnny.pjgl.api.asset.atlas; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/api/asset/package-info.java b/src/main/java/com/panjohnny/pjgl/api/asset/package-info.java new file mode 100644 index 0000000..dbe0ec3 --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/api/asset/package-info.java @@ -0,0 +1,7 @@ +/** + * Asset handling and animations. + * + * @see com.panjohnny.pjgl.api.asset.SpriteRegistry + * @see com.panjohnny.pjgl.api.asset.atlas + */ +package com.panjohnny.pjgl.api.asset; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/api/camera/OrthographicCamera2D.java b/src/main/java/com/panjohnny/pjgl/api/camera/OrthographicCamera2D.java index a943f89..a5b9963 100644 --- a/src/main/java/com/panjohnny/pjgl/api/camera/OrthographicCamera2D.java +++ b/src/main/java/com/panjohnny/pjgl/api/camera/OrthographicCamera2D.java @@ -3,7 +3,8 @@ /** * Simple orthographic camera implementation. Override {@link #apply(Object)} to apply effects. * - * @since v0.3.7-alpha + * @since 0.3.7-alpha + * @author PanJohnny */ @SuppressWarnings("unused") public abstract class OrthographicCamera2D { diff --git a/src/main/java/com/panjohnny/pjgl/api/camera/package-info.java b/src/main/java/com/panjohnny/pjgl/api/camera/package-info.java new file mode 100644 index 0000000..606c241 --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/api/camera/package-info.java @@ -0,0 +1,4 @@ +/** + * Camera(s) to be implemented by an adaptation. + */ +package com.panjohnny.pjgl.api.camera; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/api/event/package-info.java b/src/main/java/com/panjohnny/pjgl/api/event/package-info.java new file mode 100644 index 0000000..7422f12 --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/api/event/package-info.java @@ -0,0 +1,6 @@ +/** + * PJGL uses event based system to communicate. + * + * @see com.panjohnny.pjgl.api.event.PJGLEvent + */ +package com.panjohnny.pjgl.api.event; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/api/object/components/Animator.java b/src/main/java/com/panjohnny/pjgl/api/object/components/Animator.java index 0f425b5..7660dbc 100644 --- a/src/main/java/com/panjohnny/pjgl/api/object/components/Animator.java +++ b/src/main/java/com/panjohnny/pjgl/api/object/components/Animator.java @@ -9,6 +9,8 @@ /** * Component that handles animations. Requires SpriteRenderer to be present on the owner. + * + * @author PanJohnny */ @SuppressWarnings("unused") public class Animator extends Component { diff --git a/src/main/java/com/panjohnny/pjgl/api/object/components/package-info.java b/src/main/java/com/panjohnny/pjgl/api/object/components/package-info.java new file mode 100644 index 0000000..12a78f1 --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/api/object/components/package-info.java @@ -0,0 +1,4 @@ +/** + * Components that you can add to objects to make them better and stronger! + */ +package com.panjohnny.pjgl.api.object.components; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/api/object/package-info.java b/src/main/java/com/panjohnny/pjgl/api/object/package-info.java new file mode 100644 index 0000000..09ae812 --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/api/object/package-info.java @@ -0,0 +1,4 @@ +/** + * Objects and stuff, what can I say? + */ +package com.panjohnny.pjgl.api.object; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/api/package-info.java b/src/main/java/com/panjohnny/pjgl/api/package-info.java new file mode 100644 index 0000000..fe07377 --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/api/package-info.java @@ -0,0 +1,6 @@ +/** + * Classes to be used as an API to interact with PJGL. + * + * @see com.panjohnny.pjgl.api.PJGL + */ +package com.panjohnny.pjgl.api; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/api/util/FileUtil.java b/src/main/java/com/panjohnny/pjgl/api/util/FileUtil.java index c5b227c..5278c24 100644 --- a/src/main/java/com/panjohnny/pjgl/api/util/FileUtil.java +++ b/src/main/java/com/panjohnny/pjgl/api/util/FileUtil.java @@ -5,6 +5,10 @@ import java.io.FileNotFoundException; import java.io.InputStream; +/** + * Utility to resolve the hardest question of java programmer. To resource, or to file? Obviously it depends on the use case, but I need to write some silly stuff somewhere eh. + * @author PanJohnny + */ public final class FileUtil { public static InputStream resolveFileOrResource(String path) throws FileNotFoundException{ // attempt to load resource diff --git a/src/main/java/com/panjohnny/pjgl/api/util/SerializationUtil.java b/src/main/java/com/panjohnny/pjgl/api/util/SerializationUtil.java index 708452b..bc8f3b3 100644 --- a/src/main/java/com/panjohnny/pjgl/api/util/SerializationUtil.java +++ b/src/main/java/com/panjohnny/pjgl/api/util/SerializationUtil.java @@ -6,6 +6,11 @@ import java.io.*; import java.util.Base64; +/** + * I heard there was java serialization, so here I am... Maybe networking someday? + * + * @author PanJohnny + */ @SuppressWarnings("unused") public final class SerializationUtil { /** diff --git a/src/main/java/com/panjohnny/pjgl/api/util/Track.java b/src/main/java/com/panjohnny/pjgl/api/util/Track.java index 14c8735..a7d59b2 100644 --- a/src/main/java/com/panjohnny/pjgl/api/util/Track.java +++ b/src/main/java/com/panjohnny/pjgl/api/util/Track.java @@ -5,7 +5,10 @@ import javax.sound.sampled.*; /** - * Class for playing music + * Class for playing music, well umm not OpenAL tho... Coming soon? + * + * + * @author PanJohnny */ @SuppressWarnings("unused") public class Track { diff --git a/src/main/java/com/panjohnny/pjgl/api/util/package-info.java b/src/main/java/com/panjohnny/pjgl/api/util/package-info.java new file mode 100644 index 0000000..18a2a88 --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/api/util/package-info.java @@ -0,0 +1,4 @@ +/** + * (Hopefully) useful utilities. + */ +package com.panjohnny.pjgl.api.util; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/core/adapters/package-info.java b/src/main/java/com/panjohnny/pjgl/core/adapters/package-info.java new file mode 100644 index 0000000..efcbfaa --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/core/adapters/package-info.java @@ -0,0 +1,4 @@ +/** + * Elsa, do you want to build an adapter? + */ +package com.panjohnny.pjgl.core.adapters; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/core/package-info.java b/src/main/java/com/panjohnny/pjgl/core/package-info.java new file mode 100644 index 0000000..0b66df1 --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/core/package-info.java @@ -0,0 +1,6 @@ +/** + * The libraries core. + * + * @see com.panjohnny.pjgl.core.EngineOptions + */ +package com.panjohnny.pjgl.core; \ No newline at end of file diff --git a/src/main/java/com/panjohnny/pjgl/package-info.java b/src/main/java/com/panjohnny/pjgl/package-info.java new file mode 100644 index 0000000..270cee7 --- /dev/null +++ b/src/main/java/com/panjohnny/pjgl/package-info.java @@ -0,0 +1,6 @@ +/** + * Contains all of PJGL. + * + * @see com.panjohnny.pjgl.api.PJGL PJGL to get started + */ +package com.panjohnny.pjgl; \ No newline at end of file