Closed Rodoxdexts closed 3 weeks ago
I'ts amazing the power of chatgpt 😮 All the code is basically wrong, but it gives an idea of what the code should look like xD. I believe camera support is currently out-of-scope, see #261
Yes, unfortunately, so I propose a very cool suggestion: should I advertise this project so that people who see it will give financial support to this guy so he can improve this software?
Duplicate of https://github.com/friction2d/friction/issues/261
Also, do not use LLM for math or code, it's trash. I not accept generated/stolen code.
btw, everything related to transforms etc uses skia.
Hello, I'm using ai it so I can be useful in some way. Being quite honest, i only know how to program in gdscript, so thanks for making this fork a good program! I asked AI to analyze this fork and write a solution, because it hasn't been implemented since https://github.com/friction2d/friction/issues/66 And also thanks for the consideration! I like your work.
Description:
I would like to propose the implementation of a camera system within the Friction 2D engine. This feature would enhance the capabilities of the engine, allowing users to create more dynamic and flexible 2D scenes through effective camera manipulation.
Proposed Implementation Steps
Clone the Friction 2D Repository:
First, clone the repository to your local machine:
Understand the Project Structure:
Before implementing the camera system, it’s essential to understand the existing architecture, particularly:
Renderer.h
andRenderer.cpp
.Scene
orEntity
directories.Create the Camera Class:
Introduce a
Camera
class to manage the following functionalities:Here’s a basic implementation of the
Camera
class in C++:Integrate with the Rendering Pipeline:
Modify the existing rendering code to utilize the
Camera
class. Adjust the transformation matrices in the rendering pipeline to consider the camera’s position, zoom, and rotation. For example:Handle Input for Camera Control:
Implement input handling to allow users to control the camera. This can be integrated into the existing input system of Friction 2D:
Compile and Test:
After integrating the camera functionality, compile the project and run tests to ensure that the camera behaves as expected:
Optional: Implement GUI Controls for Camera:
For enhanced usability, consider implementing GUI controls using a library like ImGui to allow real-time camera adjustments through sliders or buttons:
Documentation:
Provide comprehensive documentation on how to utilize the camera system within the engine, including setup instructions and example usage scenarios.
Distinction Between Core Feature and Plugin
Core Feature Implementation: Integrating the camera system directly into the Friction 2D engine would provide native support for camera functionality across all projects using the engine. This approach is preferable for users who require seamless camera operations in their games or applications.
Plugin Implementation: If a more modular approach is desired, a camera module could be developed as a plugin, allowing users to opt-in to camera functionalities without altering the core engine. This might be beneficial for those who prefer a lighter version of the engine or want to implement their custom camera behaviors.
Benefits of Implementing a Camera System:
Thank you for considering this feature request! I believe adding a camera system will significantly enhance the Friction 2D engine's capabilities and provide developers with powerful tools for their projects.
Feel free to modify any details to better suit your tone or any specific aspects you want to emphasize!