Code Monkey home page Code Monkey logo

fastj's Introduction

FastJ Logo

Build Status SonarCloud Code Coverage

Javadoc Maven Central jitpack.io Discord Server

What is FastJ?

FastJ is a free and open-source Java-based 2D game engine and framework. It aims to provide the best 2D game-making experience using Java (and the JVM languages).

Disclaimer

This project is still under heavy development. There is a very good chance bugs are still prevalent and untracked, as the engine is not fully covered by unit tests. Documentation is readily available, but may change over time. Feel free to help us out by contributing to the project!

Projected Feature List

Feature Description Support
2D Rendering Rendering of Shapes, Models, Text, Sprites, Lighting
Scene System Scene-based Rendering & Scene Switching
Scriptable Behaviors Control GameObject state
Desktop Support Full Compatibility on Windows, Linux, and macOS
Audio Engine Loading, Playing, and Controlling .wav, .ogg, .mp3 files
Image Support Image rendering, Spritesheet Creation
Animation Engine Interpolation, Sprite Animation, Tweening Framework
UI System Flexible UI System to replace Swing UI
Particle Engine Particle Emitters, Interaction with Game Elements
Physics Engine Custom 2D Physics Engine
Asset Manager Load, Unload, and Hot Reload Game Assets
FastJ Model Creator Create & Export 2D Models with an editor
FastJ Editor Make Games in FastJ with an editor
Web Support Run FastJ in Modern Web Browsers

✅ is complete and satisfactory.

✔ is implemented and usable, but is missing certain features.

⭕ is in progress.

❌ is not yet implemented.

Features with examples available have their prime example linked.

How do I Learn FastJ?

There are many ways to learn FastJ -- check them out below!

Template Projects

Use a template project! It's the fastest way to jump into using FastJ. You just need to pick a programming language from the ones below. We suggest Java, as it has the most tutorial content, but Kotlin and Groovy are fine options as well.

Tutorials

FastJ provides article tutorials on its website to accommodate as many types of developers as possible. From beginners to experts, the website tutorials are written to give enough information to satisfy anyone willing to learn!

Code Examples

Explore FastJ's code examples to see the different ways FastJ can be used, and all of its features. These come with in-example explanations and easy plug-and-playability to give you the best chance at understanding how FastJ works.

API Documentation

Check out FastJ's documentation to get a better understanding of the code FastJ provides to improve your game-making experience.

I'll add the dependency myself!

Well in that case...

Click here to expand the manual dependency instructions.

Dependency Management

This library can be found in the following places:

When adding the dependency, make sure to replace [latest version here] with the actual version (you'll find this in the jitpack.io or Maven Central link up above). The current latest version is 1.7.0-SNAPSHOT-2.

A few common dependencies are provided below:

  • Gradle Build Script
    • Groovy:
      repositories.mavenCentral()
      
      dependencies.implementation('io.github.lucasstarsz.fastj:fastj-library:1.7.0-SNAPSHOT-2')
    • Kotlin:
      repositories.maven {
          setUrl("https://jitpack.io")
      }
      
      dependencies.implementation("io.github.lucasstarsz.fastj:fastj-library:1.7.0-SNAPSHOT-2")
  • Maven POM
    <dependency>
      <groupId>io.github.lucasstarsz.fastj</groupId>
      <artifactId>fastj-library</artifactId>
      <version>1.7.0-SNAPSHOT-2</version>
    </dependency>

You'll also want to make sure you add a dependency for a logging framework from SLF4J, since FastJ uses it for all its logging purposes. Take your pick!

Community

FastJ's community of developers is growing day by day!

  • Join the FastJ Discord Server to join a growing community of game developers, artists, and more! We host Game Jams every few months, so keep an eye out 😄

Games Made with FastJ

Gameplay of Stack Attack by Lucas Z

Gameplay of Rhythm Game by Lucas Z

Want your FastJ game featured? Open an issue, or ask in our discord!

Contributing to FastJ

Plan on contributing to the repository? Awesome! We're glad to have you ❤️

Please be sure to read over the contribution guidelines so that you can get started.

License

This repository is Free and Open Source, licensed under the MIT License.

Dependencies

  • SLF4J for logging support.
  • [JOrbis] and [VorbisSPI] for .ogg support.
  • [MP3SPI] for .mp3 support.
  • [tritonus-share] for utility processing tools related to above audio libraries.

fastj's People

Contributors

aurumbyte avatar dependabot[bot] avatar infiniteloopgamedev avatar lucasstarsz avatar mellobacon avatar saadrehmancs avatar sammie156 avatar tomlin7 avatar xchgeax avatar yeffian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fastj's Issues

[Enhancement]: Add URL option to AudioManager.playSound

What's Up?

In #87, the audio system received a buff in that audio files could now be played from a URL. This feature should also be applied to AudioManager.playSound. Furthermore, unit tests should be added to ensure these methods work as intended.

The following tasks should be completed:

  • Add overload to AudioManager.playSound using a URL object
  • Add unit testing for both variants of AudioManager.playSound

Code of Conduct

  • I agree to follow FastJ's Code of Conduct

Add comment explaining use of cascading switch

case Paused: { audioEventListener.audioResumeAction.accept(audioEvent); }

I was wondering if you might want to add a break statement here?

Actually, I've been meaning to include a comment explaining the lack of a break! Good catch.
The audio event system includes audio events for when audio is paused, and when the audio's playing stream is stopped (either temporarily or permanently). As of right now, I've intentionally had both trigger because it made sense at the time -- when an audio stream stops, ot could be either paused or completely stopped. If it is paused, then an extra event should be created for that. Feel free to dispute this though -- I've been considering adding those break statements for a while.

Originally posted by @lucasstarsz in #71 (comment)

At some point I need to add a comment explaining the usage that I talk about here.

[Feature Request] Improve Keyboard state checking

Is your feature request related to a problem? Please describe.

The current keyboard input solution for FastJ is fairly useful in terms of checking against keyboard state. However, there is a need for an improvement in terms of keycodes.

What should the solution be like?

The following features should be implemented:

  • Have each value in Keys contain its keycode and key location such that users don't have to determine where on the keyboard a key is. (Change Keys to an enum)
  • Wrap java.awt.KeyEvent to provide extra methods that mesh with the Keys enum

Progress will be tracked in the keyboard branch.

[Feature Request]: Add versioning system

Origins of the Feature

As FastJ quickly shoots through multiple versions, a versioning system needs to be set up. This will help to better mark out compatibility issues between different versions of FastJ in different sectors such as .psdf files.

The New Feature Idea(s)

The following tasks should be completed:

  • Add an option to get the current version of FastJ, and all versions of FastJ
  • Add versions to generated files (such as .psdf) for easy comparisons and checking in the future

Alternatives

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature Request] Dynamic 2D lighting and Shadows

Is your feature request related to a problem? Please describe.

Currently in FastJ, the only way to set up lighting is to use gradients... while this may solve basic needs. It can be tedious sometimes to set up proper lighting, not to mention shadows won't be supported

What should the solution be like?

Drawing of basic lighting (could be pixel based or gradients) that forms shadows dynamically when light is moved closer to another solid object.

Alternatives?

There aren't really any alternatives to this, but like i said above, the only way as of right now is to use gradients, and again, as i said above... it gets tedious sometimes and there's no shadow rendering as well..

[Bug] Update Examples with builder class content

Platform Info

  • Windows
    • Version: e.g. Windows 10 20H2
  • Mac OS
    • Version: e.g. High Sierra 10.13.6
  • Linux
    • Distro: Any
    • Version: Any

Describe the Bug

After #35 and #37 were merged, the examples for FastJ became severely outdated in content and would break upon usage due to outdated code.

Solution

Update examples so that they account for recent merges to the game engine.

Progress will be tracked in the examples branch.

[Documentation] Add

The Outdated/Incorrect Information

As of #65, FastJ now supports x11 hardware acceleration. But, in the examples/engineconfig example, it says only Direct3D and OpenGL are supported.

Suggested Documentation Changes

Update the engineconfig example to include x11 in the supported graphics API's.

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: Occasional concurrent modification issues with FastJ Scene System

What happened?

While running FastJ unit tests, I received a ConcurrentModificationException from FastJ's scene system. It seems despite many efforts FastJ still has occasional threading issues.

How to Reproduce the Error

1. Run any FastJ program that uses the scene system.
2. (Very) occasionally, the error will appear.

FastJ Version

1.5.0 (Latest Version)

Java Version

Java 11

Relevant Exceptions/Log Output

Unexpected exception type thrown ==> expected: <java.lang.IllegalStateException> but was: <java.util.ConcurrentModificationException>
Expected :java.lang.IllegalStateException
Actual   :java.util.ConcurrentModificationException
<Click to see difference>

org.opentest4j.AssertionFailedError: Unexpected exception type thrown ==> expected: <java.lang.IllegalStateException> but was: <java.util.ConcurrentModificationException>
	at [email protected]/org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:65)
	at [email protected]/org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:37)
	at [email protected]/org.junit.jupiter.api.Assertions.assertThrows(Assertions.java:3007)
	at fastj.library.test/unittest.testcases.systems.control.SceneManagerTests.trySceneManagerSetCurrentScene_bySceneName_withSceneNameThatDoesNotExist(SceneManagerTests.java:146)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at [email protected]/org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
	at [email protected]/org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at [email protected]/org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at [email protected]/org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
	at [email protected]/org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
	at [email protected]/org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
	at [email protected]/org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at [email protected]/org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at [email protected]/org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at [email protected]/org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at [email protected]/org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at [email protected]/org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at [email protected]/org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at [email protected]/org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at [email protected]/org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:210)
	at [email protected]/org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at [email protected]/org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:206)
	at [email protected]/org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
	at [email protected]/org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at [email protected]/org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
	at [email protected]/org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
	at [email protected]/org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at [email protected]/org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
	at [email protected]/org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
	at [email protected]/org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
	at [email protected]/org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at [email protected]/org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
	at [email protected]/org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
	at [email protected]/org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
	at [email protected]/org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
	at [email protected]/org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
	at [email protected]/org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at [email protected]/org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at [email protected]/org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at [email protected]/org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
	at [email protected]/org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
	at [email protected]/org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
	at [email protected]/org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
	at [email protected]/org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
	at [email protected]/org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
	at [email protected]/org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at com.sun.proxy.$Proxy5.stop(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:135)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
	at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.util.ConcurrentModificationException
	at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1493)
	at java.base/java.util.HashMap$ValueIterator.next(HashMap.java:1521)
	at fastj.library/tech.fastj.systems.behaviors.BehaviorManager.reset(BehaviorManager.java:111)
	at fastj.library/tech.fastj.engine.FastJEngine.exit(FastJEngine.java:557)
	at fastj.library/tech.fastj.engine.FastJEngine.forceCloseGame(FastJEngine.java:401)
	at fastj.library/tech.fastj.engine.FastJEngine.error(FastJEngine.java:432)
	at fastj.library/tech.fastj.systems.control.SceneManager.sceneExistenceCheck(SceneManager.java:360)
	at fastj.library/tech.fastj.systems.control.SceneManager.setCurrentScene(SceneManager.java:100)
	at fastj.library.test/unittest.testcases.systems.control.SceneManagerTests.lambda$trySceneManagerSetCurrentScene_bySceneName_withSceneNameThatDoesNotExist$3(SceneManagerTests.java:146)
	at [email protected]/org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:55)
	... 93 more


Gradle Test Executor 1 finished executing tests.
> Task :test
SceneManagerTests > trySceneManagerSetCurrentScene_bySceneName_withSceneNameThatDoesNotExist() FAILED
    org.opentest4j.AssertionFailedError: Unexpected exception type thrown ==> expected: <java.lang.IllegalStateException> but was: <java.util.ConcurrentModificationException>
        at [email protected]/org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:65)
        at [email protected]/org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:37)
        at [email protected]/org.junit.jupiter.api.Assertions.assertThrows(Assertions.java:3007)
        at fastj.library.test/unittest.testcases.systems.control.SceneManagerTests.trySceneManagerSetCurrentScene_bySceneName_withSceneNameThatDoesNotExist(SceneManagerTests.java:146)
        Caused by:
        java.util.ConcurrentModificationException
            at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1493)
            at java.base/java.util.HashMap$ValueIterator.next(HashMap.java:1521)
            at fastj.library/tech.fastj.systems.behaviors.BehaviorManager.reset(BehaviorManager.java:111)
            at fastj.library/tech.fastj.engine.FastJEngine.exit(FastJEngine.java:557)
            at fastj.library/tech.fastj.engine.FastJEngine.forceCloseGame(FastJEngine.java:401)
            at fastj.library/tech.fastj.engine.FastJEngine.error(FastJEngine.java:432)
            at fastj.library/tech.fastj.systems.control.SceneManager.sceneExistenceCheck(SceneManager.java:360)
            at fastj.library/tech.fastj.systems.control.SceneManager.setCurrentScene(SceneManager.java:100)
            at fastj.library.test/unittest.testcases.systems.control.SceneManagerTests.lambda$trySceneManagerSetCurrentScene_bySceneName_withSceneNameThatDoesNotExist$3(SceneManagerTests.java:146)
            at [email protected]/org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:55)
            ... 3 more

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature Request] Fill/Outline rendering options

Is your feature request related to a problem? Please describe.

java2d is perfectly capable of rendering both the outline and the fill of anything being rendered. As such, FastJ should support both of these options for Text2D and Polygon2D.

What should the solution be like?

FastJ should support the following options:

  • Declare what type of rendering to do (Fill, Outline, Both)
  • Set/Get both outline (Stroke) and fill (Paint) variables

Progress will be tracked in the drawable-improvement branch.

Testing

Considering just how much there is to this game engine, and the amount of times bugs go untested, a bit of testing for the various functions in the game engine would be much appreciated.

This is our coverage of tests so far:

  • engine

    • FastJEngine
    • FPSValue
  • engine.config

    • EngineConfig
  • graphics

    • Boundary
    • Drawable
  • graphics.dialog

    • DialogConfig
    • DialogUtil
  • graphics.display

    • Camera
    • FastJCanvas
    • SimpleDisplay
  • graphics.game

    • GameObject
    • Polygon2D
    • Model2D
    • Text2D
    • Sprite2D
  • graphics.ui.elements

    • Button
  • graphics.util

    • DisplayUtil
    • DrawUtil
  • graphics.gradients

    • GradientBuilder
    • Gradients
    • LinearGradientBuilder
    • RadialGradientBuilder
  • input

    • InputManager
  • input.keyboard

    • Keyboard
    • Keys
  • input.mouse

    • Mouse
  • logging

    • LogLevel
  • math

    • Maths
    • Point
    • Pointf
    • Transform2D
  • resources

    • ResourceManager
  • resources.files

    • FileUtil
  • resources.images

    • ImageResourceManager
    • ImageUtil
  • resources.models

    • PsdfUtil
    • ObjUtil
    • MtlUtil
  • systems.audio

    • Audio
    • MemoryAudio
    • StreamedAudio
    • MemoryAudioPlayer
    • StreamedAudioPlayer
    • AudioEventListener
    • AudioManager
  • systems.audio.state

    • PlaybackState
  • systems.behaviors

    • Behavior
    • BehaviorHandler
    • BehaviorManager
  • systems.collections

    • ManagedList
  • systems.control

    • DrawableManager
    • SimpleManager
    • SceneManager
    • Scene
  • systems.tags

    • TaggableEntity
    • TagHandler

As the engine develops, more tests will be written.

[Source Code]: Rename SupportedFileFormats to SupportedModelFormats

What's Up?

The tech.fastj.graphics.io.SupportedFileFormats class' purpose is to provide a list of supported formats for model reading and writing. It serves its purpose well, but the name can be misleading, and for future purposes is a bit too general. Later on in the future there will be other classes similar to it for other types of files being read, such as audio files.

My recommended solution is to change the class name to SupportedModelFormats, since it is much more representative of what the class is for.

Code of Conduct

  • I agree to follow FastJ's Code of Conduct

[Documentation]: Add Discord server badge & link to FastJ

The Outdated/Incorrect Information

The lack of discord server link is quite bad, let's be honest.

Suggested Documentation Changes

Add the discord server badge (from shields.io) and a mention to the discord server in the main README.

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Documentation]: Streamline Feature List Descriptions

The Outdated/Incorrect Information

FastJ's README feature list section works well for its purpose, but the descriptions are far from optimal.

2D Rendering - Rendering of 2D Polygons, Models, Lighting

This is a succinct description of what the 2D rendering situation in FastJ should amount to.

Audio Engine - Play sounds of several different formats at any given time.

This is a vague description of the general ideas on Fastj's audio engine.

FastJ Model Creator - Create & Export 2D Models quickly and easily.

This, is quite literally a marketing ploy.

With the way FastJ has been reaching people in the last few days, now would be a great time to improve the descriptions to clear up how FastJ should appear to people -- a no-nonsense, reasonably simple 2D java game engine.

Suggested Documentation Changes

Change the descriptions in the README to match one general style -- no-nonsense, simple explanations. It's an open-source game engine -- give it a reason to stand out as professional!

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature Request] Replace Drawable derivative constructors with builders

Is your feature request related to a problem? Please describe.

Since #35, Polygon2D's constructors have been replaced with a builder instance. This is useful, but still inconsistent with the current state of the other Drawable derivative classes.

What should the solution be like?

In both Text2D and Model2D classes...

  • Add builder classes
  • Replace the multitude of constructors with the created builder classes

Progress will be tracked in the drawable-improvement branch.

[Source Code]: FastJEngine.exit() doesn't dispose of RunAfterUpdate/Render list contents

What's Up?

The tech.fastj.engine.FastJEngine.exit() method does not clear the AfterUpdateList or AfterRenderList, when it should because at that point those methods should not be executed.

Tasks:

  • Clear the AfterUpdateList in the FastJEngine.exit() method
  • Clear the AfterRenderList in the FastJEngine.exit() method

Code of Conduct

  • I agree to follow FastJ's Code of Conduct

[Feature Request] Simplify InputManager

Is your feature request related to a problem? Please describe.

The InputManager was originally integrated into the Scene class, but involved quite a bit of method clutter. To counter this, the InputManager class was created to control the state, and was exposed publicly to allow direct usage.

Now I know we can do better.

This issue was created to re-integrate the InputManager into the Scene class, and work on restricting direct input firing to the engine itself. However, this will not be what is worked on for now -- it will likely integrate with issue #11 before reaching that point.

The following should be completed:

  • Decrease InputManager's method count for later possible integration with the Scene class

Progress will be tracked in the merge-inputmanager branch. Comments welcome!

[Bug]: Scene/SimpleManager don't destroy behaviors when reset

What happened?

Neither the Scene class nor the SimpleManager class destroy behaviors when it is reset. This can be checked through placing a logging statement inside the destroy method of any Behavior, then attaching it to a game object within any one of these managers.

How to Reproduce the Error

1. Add a logging statement to any Behavior's destroy() method.
2. Attach said Behavior to any GameObject within a Scene or SimpleManager.
3. Run the program.
4. See error

FastJ Version

1.5.0 (Latest Version)

Java Version

Java 11, Java 16

Relevant Exceptions/Log Output

N/A (The log does not print out.)

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Documentation]: Broken link to examples

The Outdated/Incorrect Information

Broken link to an example in FastJ news (in FastJ 1.5.0 Release news) in the Audio Engine section, There's this message:

For the best information, check out the audio usage example.

I clicked the link, And it redirects to https://example.fastj.dev/audio/Main.java page. that redirects to https://github.com/fastjengine/FastJ/tree/main/src/example/java/tech/fastj/example/audio/Main.java which does not exist.

Suggested Documentation Changes

Fix the link into the correct one.

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: Text2D Collision Metrics adding extra translation to collision path

What happened?

Within tech.fastj.graphics.game.Text2D, the setMetrics method adds the object's current translation to the collision. However, the outward-facing collision path already gets transformed -- this means the translation gets doubled, which leads to issues rendering.

Fix through completion of the following tasks;

  • Remove translation performed during Text2D.setMetrics

How to Reproduce the Error

1. Create a Text2D object with a translation of some sort. In the logs below, a translation of (400, 300) was used.
2. Log the Text2D's current collision path (using text2D.getCollisionPath().getBounds2D())
3. Change the Text2D's text or font, or otherwise trigger the "setMetrics" method to run.
4. Log the Text2D's current collision path (using text2D.getCollisionPath().getBounds2D())
5. See error -- the translation has changed between the two, despite the translation not having been updated.

FastJ Version

1.5.1 (Latest Version), 1.5.0 (Latest General Version)

Java Version

Java 11, Java 12-15, Java 16

Relevant Exceptions/Log Output

[main] INFO tech.fastj.engine.FastJEngine - BEFORE
[main] INFO tech.fastj.engine.FastJEngine - java.awt.geom.Rectangle2D$Float[x=400.0,y=300.0,w=157.0,h=22.0]

[main] INFO tech.fastj.engine.FastJEngine - AFTER
[main] INFO tech.fastj.engine.FastJEngine - java.awt.geom.Rectangle2D$Float[x=800.0,y=600.0,w=81.0,h=22.0]

Code of Conduct

  • I agree to follow this project's Code of Conduct

Example Programs

Is your feature request related to a problem? Please describe.

The lack of tutorials for how to use FastJ greatly hinder a newcomer's ability to effectively use the game engine.

What should the solution be like?

Add tutorials to FastJ depicting how just about anything in FastJ works -- from an empty window, to rendering game objects, to adding game object behaviors, to scene management, etc.

Anyone is free to create tutorials!

@lucasstarsz will be proofreading and content-checking tutorials as needed.
You may also request that I notify you if your tutorial needs to be updated for whatever reason -- you can opt out of this at any time.

Tutorials to complete

  • Using SimpleManager
    • Empty Window -- Hello, FastJ!
  • Using Drawables
    • Creating/Rendering a Game Object
    • Creating/Rendering a UI Element
    • Creating Models
    • Writing/Reading Models to .psdf format
  • Using FastJEngine
    • Using FastJEngine#log/warning/error
    • Using FastJEngine#configure
    • Using FastJEngine#setTargetFPS
    • Using FastJEngine#setTargetUPS
  • Using SceneManager
    • Switching between two Scenes in a SceneManager
    • Using a persistent UI to switch between 3+ Scenes
  • Miscellaneous
    • Getting Keyboard Input
    • Getting Mouse Input
    • Moving the Camera
    • Using Behaviors
    • Using Tags
    • Using Audio -- see #23
    • Change global rendering settings

Progress on this issue will be tracked in the examples branch. Feel free to suggest tutorials not yet mentioned!

[Feature Request] Add x11 to the hardware acceleration options

Is your feature request related to a problem? Please describe.

HWAccel currently does not contain an option for Linux's x11 rendering.

Solution

  • Add an X11 option with the x11-based java2d properties to HWAccel.java.
  • Restrict access to the option to Linux users only (for an example of this, take a look at FastJEngine#configureHardwareAcceleration. This process is already done for Direct3D.

[Bug]: Behaviors are not used in SimpleManager

What happened?

FastJ's current implementation of SimpleManager does not use Behaviors whatsoever. There is no place in which behaviors are updated, or initialized, nor destroyed.

How to Reproduce the Error

1. Add a behavior to any game object in a SimpleManager
2. Run the program
3. See error

FastJ Version

1.5.0 (Latest Version)

Java Version

Java 11, Java 16

Relevant Exceptions/Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature Request] Separate transform logic from GameObject classes

Is your feature request related to a problem? Please describe.

As part of the constant improvement of the FastJ engine, we shouldn't forget that maintainability is as important as new functionality. Currently, both GameObject and Camera classes contain transform logic, which is duplicated and hard to maintain. This logic should instead be transfered over to a new class Transform2D, which will contain transform logic, and provide a friendly way to interface with AffineTransforms.

What should the solution be like?

A possible set of changes is as follows:

GameObject and Camera

  • Remove transform logic from GameObject and Camera classes
  • Integration of the newly created Transform2D class

The Transform2D class may find use as well in other classes which require transformation logic.

Transform2D

  • Getting and setting position, rotation, and scale
  • Translate, rotate, and scale functions
  • Support for converting to and from AffineTransform

Comments, questions, and suggestions about this feature request are welcomed. Please put them below!

Progress will be tracked in the drawable-improvement and camera-transform branches.

[Feature Request]: Replace MemoryAudio entirely with StreamedAudio

Origins of the Feature

MemoryAudio and StreamedAudio currently serve different purposes in audio.

  • MemoryAudio has explicit looping and playback controls but a lack of panning, volume, muting, and other controls. It also uses much more memory as the entire file gets loaded into the system at once.
  • StreamedAudio, on the other hand, loads the file in chunks which uses much less memory. It has the panning, volume, muting, etc. controls but still lacks explicit looping and playback controls.

In this situation, StreamedAudio has more pros than MemoryAudio and should be the chosen audio type to use.

The New Feature Idea(s)

I would like to replace MemoryAudio entirely, in favor of StreamedAudio. Being more memory-efficient, it is the most natural option to continue using.

This also means that StreamedAudio needs to support the following features:

  • Explicit looping controls (LoopSequences for controlling a sequence of loops)
  • Explicit playback controls (these may require an asynchronous awaiting response) such as audio seeking (responsive to loop sequences?)

Other than that, these tasks should also be completed:

  • Update audio examples to only use the one audio type
  • integrate StreamedAudio into the Audio interface?
  • explicit unit testing for all of StreamedAudio's new features

Alternatives

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature Request] Split larger classes into smaller defintions

Is your feature request related to a problem? Please describe.

FastJ contains certain classes that need to be simplified -- their overall length is a pain to maintain in its current setup.

What should the solution be like?

Each problematic file and its solution will be displayed here, as well as the progress made on simplifying it. As updates are made, this issue will be updated.
Commits dealing with this are tracked in the class-diverging branch.

  • Display.java
    • Separate GraphicsEnvironment-related content into a separate file.
    • Unify fullscreen-enabling with a single (or two) method(s).
      - FastJEngine.java
      - [ ] Abstract settings into a SettingsConfig
      - [ ] Load settings from a settings file
      The FastJEngine class will be updated in a separate issue and branch.

[Feature Request] Audio

Is your feature request related to a problem? Please describe.

FastJ 1.5.0 is near, and an audio engine would be a great addition to the arsenal of tools.

What should the solution be like?

The Audio engine should, for 1.5.0, support the following features:

  • Load/Unload audio into memory
  • Play audio
  • Loop audio
  • Hook into audio events (start, stop, open, close)
  • Change audio volume
  • Change audio pan
  • Linearly interpolate between volume/pan/other configurable values

As an aside, the branch should also contain:

  • Examples for how to use the audio engine
    • Simple audio example explaining how to play sound using AudioManager#playSound as well as file paths
    • More complex example of working with audio, covering all topics mentioned above -- see #20
  • Unit testing -- see #3

Progress will be tracked in the audio branch.

Migrate releases to Jitpack.io

Maven Central has served us well, but with all the production mistakes being made it might be a good time to switch to an easier-to-use platform.

The following should be completed:

  • "publish" all releases of FastJ to jitpack.io
  • update README.md to get dependencies from jitpack.io
  • update project templates with jitpack.io dependencies

[Documentation] Add package-info files to each fastj package

FastJ's packages each lack descriptors for what they relate to. With the engine on the rise, it would make sense to provide a general run-down of what each of the packages contain.

The following packages need to be covered:

  • tech.fastj.engine
    • tech.fastj.engine.internals
  • tech.fastj.graphics
    • tech.fastj.graphics.display
    • tech.fastj.graphics.game
    • tech.fastj.graphics.gradients
    • tech.fastj.graphics.io
    • tech.fastj.graphics.ui
    • tech.fastj.graphics.util
  • tech.fastj.input
    • tech.fastj.input.keyboard
    • tech.fastj.input.mouse
  • tech.fastj.math
  • tech.fastj.systems
    • tech.fastj.systems.audio
    • tech.fastj.systems.behaviors
    • tech.fastj.systems.control
    • tech.fastj.systems.fio
    • tech.fastj.systems.tags

Suggest changes or fixes below.

[Feature Request]: Images, Sprites, and Animation

Origins of the Feature

As FastJ heads into version 1.6.0, a system for handling images, sprites, and sprite animation will be needed to accompany FastJ's growing model system.

The New Feature Idea(s)

The following tasks should be completed:

  • Adding base image support in FastJ through an optimized Sprite2D class
  • Add a set of image processing/handling tools that can handle these tasks:
    • loading images from files
    • creating volatile images
    • splitting images into parts (for use mainly with spritesheets)
  • Add spritesheets and sprite animation to Sprite2D, with the following features:
    • animation frame rate controlling
    • multiple animation "sets" (group images based on a certain label provided by the user)
    • animation triggers based on conditions
    • built-in support for an "idle" animation
    • (separate extension idea: multiple animation set configurations)

Alternatives

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug] Stretched display

Platform Info

Place an x in the box(es) [x] that the issue occurs on (or that you've found the issue on)

  • Windows
    • Version: Windows 10 (Build 1909)
  • Mac OS
    • Version: e.g. High Sierra 10.13.6
  • Linux
    • Distro: e.g Linux Mint
    • Version: e.g. 20.1

Describe the Bug

A clear and concise description of what the bug is.
I tried running FastJ in 800x600 resolution, Then I found out that the Text is stretched and smaller than it should compare to running at 1280x720 resolution.

Expected Behavior

A clear and concise description of what you expected to happen.
I expect the Text to display properly, With the same size when displayed on 1280x720 resolution.

How to Reproduce the Bug

Steps to reproduce the behavior:

  1. Use the following code to initialize FastJ:
FastJEngine.init(gameName, this);
FastJEngine.configureViewerResolution(new Point(800, 600));
FastJEngine.run();
  1. Add a Text in the SimpleManager init method.
  2. Run the code.
  3. See the stretched text.

Media Aid

If applicable, add screenshots/GIFs/videos to help explain your problem.

java_p6OxTgQ5ft

Additional context

Additional context not provided above.
I use a Custom class to create the Text.
The code for the class:

package ga.susite.StablerCharacter;

import java.awt.Color;
import java.awt.Font;

import tech.fastj.graphics.game.Text2D;

public class TextInfo {
	Color color;
	Font font;
	
	TextInfo(Color nColor, Font nFont) {
		color = nColor;
		font = nFont;
	}
	
	public Text2D build(String message) {
		return Text2D.create(message).withFont(font).withFill(color).build();
	}
}

Add Drawable support for curves

As FastJ's drawable system grows, curves need to be supported by all polygons. The following tasks should be completed:

  • Add two sets of points for instances where curves/quads may be present (these sets of points mark out which indexes contain curve/quad points)
  • With the same principle as above, add curve/quad support to .psdf files
  • Add quad/curve-handling capabilities to DrawUtil's Path generation methods

[Bug] Unusable Quit Button and Resizing when initialized on New window

Platform Info

Place an x in the box(es) [x] that the issue occurs on (or that you've found the issue on)

  • Windows
    • Version: Windows 10 (Build 1909)
  • Mac OS
    • Version: e.g. High Sierra 10.13.6
  • Linux
    • Distro: e.g Linux Mint
    • Version: e.g. 20.1

Describe the Bug

A clear and concise description of what the bug is.
I'm making a Swing UI for adjusting window resolution and Other settings.
But when I run the Code, I pressed play, The game window appears properly. But I can't exit out of the Game using the x button on the Window border.
And it messed up the Window resizing as well.

Expected Behavior

A clear and concise description of what you expected to happen.
Exit the Java program peacefully. And can resize like normal.

How to Reproduce the Bug

Steps to reproduce the behavior:

  1. Use my code (Available to the public soon)
  2. Build and run it
  3. Press play
  4. The game window will popup
  5. Try resizing and Press x on the Window border.

Media Aid

If applicable, add screenshots/GIFs/videos to help explain your problem.

Messed up resizing

K0fgxrOiv9.mp4

(Video provided by: lucasstarsz)

Additional context

Additional context not provided above.

Add Drawable support for textures

As FastJ's Drawable system grows, textures for polygons need to be supported. The following tasks should be completed:

  • Add TexturePaint as an option to generate for paints
  • Add support for TexturePaint to .psdf file format

[Feature Request] Massively enhance LogicManager/Scene Classes

Is your feature request related to a problem? Please describe.

As part of the next version(s) of FastJ, improving the LogicManager and Scene-related classes is a must.

What should the solution be like?

These are the following features I'd like to see:

LogicManager

  • Essentially, turn LogicManager into an interface and have two options for general use: SceneManager (has scenes), and SimpleManager (no scenes here!)
    • Abstract LogicManager into an interface, to allow for LogicManagers without Scene implementations
    • Add option to not use scenes (completely abstract scenes away as a concept only known to a certain type of LogicManager
      - Simplify scene setup in SceneManager
      - [ ] setCurrentScene should attempt to safely add the scene to the manager before setting as current
      - [ ] If no scenes are loaded, still throw an error!

Scenes

- [ ] Add support for scene dividing (layering)
- [ ] Allow parallelization of updating/rendering, due to each layer running independently (one layer cannot affect the state of another)

Progress of these features will be tracked in the logicmanager-and-scene-improvement branch.

Move logo to its own folder

I'm wondering how you would go about moving ./.github/media/* to the root of the project. As in ./assets/branding or such. The reason I'm suggesting this is that I haven't really seen any repository have resources/branding/assets/whatever in .github/*.

How would this help though?
Well, nothing. As far as I've seen/know, it's traditional to have that. I've noticed godot has that directly in its root, in my opinion, that makes it less organized. Oh well, I hope this issue is clear enough.

[Bug] Broken button positioning

Platform Info

Place an x in the box(es) [x] that the issue occurs on (or that you've found the issue on)

  • Windows
    • Version: Windows 10 (Build 1909)
  • Mac OS
    • Version: e.g. High Sierra 10.13.6
  • Linux
    • Distro: e.g Linux Mint
    • Version: e.g. 20.1

Describe the Bug

A clear and concise description of what the bug is.
The button position is set, But the button is still placed at the top left corner.

Expected Behavior

A clear and concise description of what you expected to happen.
The button supposed to Position properly.

How to Reproduce the Bug

Steps to reproduce the behavior:

  1. Create a New button (in Scenes)
  2. Position it somewhere that is not in the Top left corner.
  3. Run the game
  4. See that the Button is still placed on the Top left corner

Media Aid

If applicable, add screenshots/GIFs/videos to help explain your problem.

Additional context

Additional context not provided above.
The FastJ version I was using was FastJ 1.5.0 (Snapshot)
You have to use the Scenes workflow to reproduce it. (Because Buttons only supports scenes at the moment)

[Feature Request] Enhance Pointf and Point classes

Is your feature request related to a problem? Please describe.

The Point and Pointf classes are FastJ's choice of weaponry when it comes to vector math. As such, there are many things to consider adding.

What should the solution be like?

Several methods revolving around vectors should be implemented, such as:

  • Magnitude
  • Square Magnitude
  • Normalization
  • Dot Product
  • Cross Product
  • Vector Rotation
  • Angle (between two vectors)

The following are of less importance, but it is also desirable to create abstractions to allow working with certain AWT types:

  • Conversion to java.awt.Dimension

And last but not least, I would like to achieve some more major improvements to the system as a whole:
- Abstract Point/Pointf to an interface, allowing the following:
- [ ] Immutable versions of Pointf and Point classes
- [ ] Reusability and a better guarantee that they will mesh together reliably in the future.

The above will be considered in a later issue. For now, it's out of the scope for completing smaller projects within the engine.

If you find more methods to be necessary, please leave a comment.
Progress of these features will be tracked in the math-improvement branch.

[Feature Request] Massively overhaul Drawable classes

Is your feature request related to a problem? Please describe.

As part of the massive performance, feature, and structural overhaul needed to propel FastJ into 2.0, we need an incredibly strong and flexible foundation. As such, this issue is opened to describe the many things needed in order to consider the engine ready for a more useful UI system, among other things.

What should the solution be like?

This is the list of features currently expected as a bare minimum in order to proceed:

General Model Loading

  • Overhaul psdf contents
    • Add support for gradients
    • #110
    • Add outline/stroke support
    • #109
  • Support read/write with the svg format
  • Support read/write with the obj format

Text2D

  • Improve Text2D with vector graphics/attribute modifiers
  • Support to read/write Text2D to tsdf/svg

Polygon2D

  • Improve Polygon2D with more paint options/outline options
  • Add extra options for working with complex curves (beziers)
  • Add option to create Polygon2D from Path2D instance

Drawable

  • Add child/parent system
  • Store Scene reference in each Drawable
  • Abstract transform implementations -- see #12

If you have any suggestions for other features, please leave a comment down below explaining. Progress of this will be tracked in the drawable branch.

[Feature Request]: Add option to load audio with URL

Origins of the Feature

Currently in FastJ's audio engine, all audio files are gotten from a Path file. This is fine for general purposes, but it is insufficient for cases where an audio file needs to be read from within a jarfile.


To attempt to load an audio file in FastJ from inside a jarfile the code may look like this:

Path pathToAudio = new File(
        Objects.requireNonNull(
                classLoader.getResource("path/to/audio.wav")
        ).getFile().substring(5) // substring(5) removes the "file:" from the beginning of the output of getFile()
).toPath();

AudioManager.loadMemoryAudio(pathToAudio);

Despite this seeming to work, it does not. The file system (which is resolving the File created from the Path provided) is not able to find the file, because it is inside the jarfile. The error may look like this:

java.io.FileNotFoundException: F:\project\build\libs\project-0.0.1.jar!\path\to\audio.wav (The system cannot find the path specified)

However, this code:

AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(
        Objects.requireNonNull(
                TheClass.class.getClassLoader().getResource("path/to/audio.wav")
        )
);

runs perfectly fine.

I'm inclined to believe that the File system does not evaluate files within jars as a result.

The New Feature Idea(s)

To combat these issues, I propose the following changes:

  • Overload AudioManager#newAudioStream to allow generation of an AudioInputStream using a URL object.
  • Provide overloads of all methods that normally only allow Path objects, including:
    • MemoryAudio constructor
    • StreamedAudio constructor
    • AudioManager#loadMemoryAudio methods
    • AudioManager#loadStreamedAudio methods
  • Unit testing for all cases to prove readiness for multiple platforms

This should be sufficient to allow for audio objects to be loaded with URL files.

Alternatives

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Source Code]: Add default case to AudioEventListener state checking

What's Up?

In tech.fastj.systems.audio.AudioEventListener, inside the AudioEventProcessor Map, the mappings for audio start/stop check the PlaybackState in order to process actions. However, the current switch statements do not cover all cases.

I suggest adding default cases to each of the switch statements that throw illegal state exceptions -- these errors should state that the audio state was unexpected and invalid.

Code of Conduct

  • I agree to follow FastJ's Code of Conduct

[Feature Request] Improve Display render options setting

Is your feature request related to a problem? Please describe.

In FastJ's current Display, render options are set through using java.awt.RenderingHints. This interface is fine, but there should be an interface included that words content for better readability.

What should the solution be like?

The following should be added:

  • Add class containing all the different options for rendering
  • Add method using the new class to set rendering options

Progress will be tracked in the display-options branch.

Use and supply SLF4J for logging

System.out was good and all for the time, but this project is finally going somewhere -- might be time to give it some debugging wiiiiiiiiiiiiiiiiiiiiings.

Here are the tasks to complete for the logging system:

  • Create simple logging abstraction overtop SLF4J which aligns with FastJEngine's current logging setup
  • Add debugging statements to all of FastJ's code as needed
  • Add fields determining logging settings (setting log level, enabling/disabling engine logging, log output type and path if needed)

External tasks (moved to a separate issue)

Progress will be was tracked on the slf4j branch.

Better README, documentation, wiki

It's become clear to me we need a lot better explanation of how to use FastJ.
Could probably use all of these:

  • Specify java version needed
  • a separate example project
  • instructions for using FastJ in a project
  • a wiki explaining FastJ and its many features
  • better documentation explaining the purpose of each part of FastJ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.