Particle rendering application based on the factory design pattern.
Use Case 1 | |
---|---|
Vorbedingung | Applikation ist gestartet |
Beschreibung Anwendungsfall | User möchte einen Partikel Rendern |
Nachbedingung | - |
Ausnahmen | - |
The Idea is to have a factory which allows us to instantiate different sub-classes of the class Particle.
The Application would have:
- a class Particle which defines the particle itself.
- a particle factory that instantiates the particles
- a particle system that creates a collection of particles out of the instantiated particles
- a particle renderer that renders the particles in a window
g++ -std=c++11 main.cpp Particle.cpp ParticleSystem.cpp ParticleFactory.cpp ParticleRenderer.cpp -o particle_project -I /opt/homebrew/include -L /opt/homebrew/lib -lsfml-graphics -lsfml-window -lsfml-system
Class: Particle Responsibilities:
- Define the properties and behavior of a particle.
Collaborators:
- ParticleFactory: Instantiates particles.
Class: ParticleFactory Responsibilities:
- Instantiate different sub-classes of the Particle class.
- Provide a method to create particles.
Collaborators:
- Particle: Represents the particle class to be instantiated.
Class: ParticleSystem Responsibilities:
- Create a collection of particles.
- Manage the collection of instantiated particles.
Collaborators:
- ParticleFactory: Instantiate particles for the system.
Class: ParticleRenderer Responsibilities:
- Render particles in a window.
- Display the visual representation of particles.
Collaborators:
- ParticleSystem: Provides the collection of particles to be rendered.
Preconditions: The application is not currently running.
Postconditions: The application is started and ready for use.
Description:
- The user initiates the application.
- The system initializes and displays the main application window.
- The user can proceed to select the particle type and start rendering.
Preconditions: The system is started and the main application window is displayed.
Postconditions: The selected particle type is set for rendering.
Description:
- The user interacts with the application to select a specific particle type.
- The system validates the selected particle type.
- The system sets the selected particle type for rendering.
Preconditions: The system is started, and a particle type is selected.
Postconditions: The particles are rendered in a window.
Description:
- The user triggers the start rendering action.
- The system creates a particle system based on the selected particle type.
- The system instantiates particles using the particle factory.
- The particle system manages the collection of particles.
- The particle renderer renders the particles in a window.
Preconditions: The system is running and particles are being rendered.
Postconditions: The system stops rendering particles and returns to the initial state.
Description:
- The user triggers the stop system action.
- The system stops rendering particles.
- The system clears the particle collection and returns to the initial state.
These use case specifications outline the sequence of events, preconditions, postconditions, and main actions for each use case represented in the use case diagram.