raylib-cpp icon indicating copy to clipboard operation
raylib-cpp copied to clipboard

Add TextureUnmanaged

Open RobLoach opened this issue 2 years ago • 3 comments

@Ataraxia-Mechanica What about something like this?

raylib::Font font("myfont.ttf");
{
  raylib::TextureUnmanaged fontTexture = font.GetTexture();
  fontTexture.Draw();
}
// No more error since we're usning a Unmanaged object?

RobLoach avatar Sep 18 '22 01:09 RobLoach

This looks pretty cool, it allows method chaining too which is also a plus

Ataraxia-Mechanica avatar Sep 18 '22 09:09 Ataraxia-Mechanica

What do you think ab ok it having TextureUjmanaged inherit from Texture instead ifnyhe other way around?

RobLoach avatar Sep 18 '22 09:09 RobLoach

I think both way's fine

Ataraxia-Mechanica avatar Sep 19 '22 05:09 Ataraxia-Mechanica

Thinking about this more, I think having this inheitance structure makes the most sense...

Texture
- raylib::TextureUnmanaged
  - raylib::Texture

Then the majority of work is in the TextureUnmanaged classes, and the Texture just adds the managed aspect, along with the deleted copy constructor, etc.

RobLoach avatar Sep 27 '22 18:09 RobLoach