I wanted to focus on the system itself and don't know much about
rendering and physics, so I'm using external libraries for this.
An "entity system" should not directly handle rendering and physics anyway; at best it should just have references to objects that are part of the rendering or physics systems, whether or not you wrote those systems yourself.
These libraries come with pre-defined classes for their objects.
(Sprites, Bodies etc.) These do not fit into my entity system easily.
How can I utilize existing libraries and classes within an entity
system?
Wrap them in structures that your system can consume.
An entity system really should not be a low-level API, so systems like physics and rendering should not depend or even know about it. Entity systems are about representing game objects and very high level behavior.
If you're building something akin to the current fad of "entity / component" systems, you'd create a visual component and a physics component that are at the abstraction level of your entity system and which respectively wrap the actual rendering or physics objects necessary. Something like:
struct RenderComponent {
Render::RenderableObject m_renderable;
Matrix m_transform;
}
struct PhysicsComponent {
Physics::RigidBody m_body;
}
And so on. These act as adapters to the rendering and physics systems, and can be written to expose via their public interface the various details of the underlying external library objects that might be relevant to other things within the entity system.
Even if you aren't taking the "component-based" approach, you can still build adapters as above (although exactly what you call them should be informed by the structure of the rest of your API, which you have not specified).