Pajama Framework is a lightweight, annotation-based Java framework designed to streamline game and application development. By leveraging dependency injection, game lifecycle management, and modular architecture, Pajama helps developers build clean, efficient applications with minimal boilerplate code. The framework is extensible, easy to use, and perfect for small to medium-scale projects.
-
Annotation-Based Dependency Injection
Simplify your application's architecture with@Inject
and@EngineComponent
annotations. -
Game Lifecycle Management
Effortlessly manage game loops and initialization with@GameLoop
andEngineContext
. -
Render Management
IntegratedRenderManager
for rendering graphics, clearing the screen, and managing drawing operations with ease. -
Multi-Threading Support
Automatically manage thread pools withThreadManagerPool
for efficient and scalable task execution. -
Extensible & Lightweight
Focus on your application logic without unnecessary complexity or boilerplate. -
Built-in Logging
Log messages and errors easily withPajamaLogger
.
- Java 11 or higher
- Maven or Gradle
To use Pajama Framework, include it in your project dependencies:
<dependency>
<groupId>io.github.pajama-framework</groupId>
<artifactId>pajama-framework</artifactId>
<version>1.0.0</version>
</dependency>
implementation 'io.github.pajama-framework:pajama-framework:1.0.0'
Here’s how to get started with Pajama Framework:
-
Create Components
Annotate your classes with@EngineComponent
to define them as components managed by the framework.@EngineComponent public class MyComponent { public void doSomething() { System.out.println("Component is working!"); } }
-
Inject Dependencies
Use@InjectPajamaDependency
to inject components into your classes.@EngineComponent public class MyService { @InjectPajamaDependency private MyComponent myComponent; public void performAction() { myComponent.doSomething(); } }
-
Define a Game Loop
Use@GameLoop
to annotate your game class and manage the game lifecycle.@GameLoop @EngineComponent public class MyGame implements Runnable { @InjectPajamaDependency private RenderManager renderManager; @Override public void run() { renderManager.initialize() .setWidth(800) .setHeight(600) .setTitle("Pajama Game") .newThread(pool -> { pool.runAsync(() -> { while (true) { render(); } }); }); } private void render() { Optional.ofNullable(renderManager.getGraphics()).ifPresent(graphics -> { renderManager.clearScreen(graphics, Color.BLACK); String message = "Pajama Framework!"; Point position = renderManager.calculateCenteredPosition(graphics, message); renderManager.drawMessage(graphics, message, position, Color.WHITE); graphics.dispose(); renderManager.show(); }); } }
-
Run the Application
Start your app withPajamaApplication.run
:public class Main { public static void main(String[] args) throws Exception { PajamaApplication.run(MyGame.class); } }
src/
├── main/
│ ├── java/
│ │ ├── dark/cat/ # Core framework code
│ │ ├── dark/cat/annotations/ # Annotations for components and game loop
│ │ ├── dark/cat/context/ # Engine context and initialization logic
│ │ ├── dark/cat/managers/ # RenderManager and ThreadManagerPool
│ │ ├── dark/cat/utils/ # Logging and response utilities
│ │ └── example/ # Example implementations
│ └── resources/ # Configuration files (if any)
Check out the examples/
directory for sample projects using Pajama Framework. These examples serve as templates for your own game or application development.
Contributions are welcome! Here’s how you can help:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
. - Commit your changes:
git commit -m "Add new feature"
. - Push to the branch:
git push origin feature-name
. - Submit a pull request.
For large changes, open an issue first to discuss your ideas.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Have questions or suggestions? Reach out!
- Email: [email protected]
- GitHub Issues: Open an Issue
If you enjoy this framework, consider giving the repo a ⭐!
Feel free to suggest or request changes. Happy coding! 😊