Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: GUI Issue  (Read 8241 times)

0 Members and 1 Guest are viewing this topic.

john_locke

  • Newbie
  • *
  • Posts: 1
    • View Profile
GUI Issue
« on: June 30, 2021, 06:06:42 pm »
Hello, I am having a bit of a mid-project crisis. I am trying to make a simple GUI library that I can use for future projects. I recklessly hurtled along implementing the first ideas that came to mind. For the most part it worked out. Buttons work, Labels work, Panels, well Panels exist...

Currently I have panels implemented as a nine slice. Longer panel? Just add another middle sprite and watch as those corners don't become stretched and blurry! In my hurried hubris I failed to consider a common use case, what If the user (me really) wants custom sized panels. Uh oh, they're restricted to sizes that are multiples of each texture size (assuming you want the details of the texture to be a certain size).

I can't seem to come up with a satisfactory solution, and I was hoping someone here could give me some inspiration / point me to a relevant tutorial or something.

ps, as far as I can tell, this is an appropriate place to post this, but my sincere apologies if not...
« Last Edit: July 01, 2021, 07:46:34 am by Laurent »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: GUI Issue
« Reply #1 on: June 30, 2021, 08:35:41 pm »
It seems to me that you're designing the GUI library ahead of any project that uses it. While this can be nice to experiment with different scenarios, it is often more efficient to do Dogfooding, as it will make the use cases more clearer and also tell you how the API should look.

What I can also recommend is to look at one of the many existing UI libraries for SFML. Chances are that you might not need to reinvent the wheel, or at least draw inspiration from existing projects. There are of course also many UI libraries completely outside SFML; if you're not developing a game, that might be a better choice.

Btw, what is up with your font size? :D
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: