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

Author Topic: Graphics and design question - sf::Image <resolved>  (Read 2478 times)

0 Members and 2 Guests are viewing this topic.

maiev

  • Newbie
  • *
  • Posts: 3
    • View Profile
Graphics and design question - sf::Image <resolved>
« on: July 03, 2012, 09:57:51 pm »
Hi,

This is actually more of a design issue than an actual sfml one but any feedback would be appreciated.

Assuming window size is fixed, I want to create a "text box" with a custom border from an image.  I see two ways of solving this.  One is to just create a sprite of the correct size and draw that each frame, but this is likely relatively costly and the image itself would have to be modified if I decide to ever change the window size.  The second option is to get a sprite sheet of small segments of the border such as vertical, horizontal, and edge pieces and then create the border programmatically.  Once created, I want to keep this image as a whole to be drawn later.  Is the best way to do this just coping these loaded images onto a master image?

Similarly what if I want to create a very dense menu, such as a player menu with complex layout.  This menu will likely be too complex to break down into components.  At this point the only solution I can imagine is just having the entire menu predefined and loading it as an image.  Does anyone have a better method to implement this?
« Last Edit: July 04, 2012, 11:41:01 pm by maiev »

mimipim

  • Newbie
  • *
  • Posts: 49
    • View Profile
Re: Graphics and design question - sf::Image
« Reply #1 on: July 03, 2012, 10:12:16 pm »
I am not sure but If you need a GUI you can take a look at SFGUI.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Graphics and design question - sf::Image
« Reply #2 on: July 03, 2012, 10:37:57 pm »
But just keep in mind that SFGUI has not yet a possibility for rendering textures, at the moment there's only BREW which uses lines and shapes, but you can modify them at your needs with CSS like markup.

You can of course create your own GUI, but if it should be usefull the task can get complicated pretty fast. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

maiev

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Graphics and design question - sf::Image
« Reply #3 on: July 03, 2012, 10:44:50 pm »
I am not sure but If you need a GUI you can take a look at SFGUI.

This looks great but I don't think it's what I need.

After a bit more thinking I think the best solution for the menu is just to create it externally and then scale it if I ever change my resolution.  On that note, is scaling down a bad idea graphically?  Upscaling seem bad intuitively but what about downscaling?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Graphics and design question - sf::Image
« Reply #4 on: July 03, 2012, 10:55:13 pm »
This looks great but I don't think it's what I need.

What do you need then?
Your opening questions is a bit cryptic...

After a bit more thinking I think the best solution for the menu is just to create it externally and then scale it if I ever change my resolution.  On that note, is scaling down a bad idea graphically?  Upscaling seem bad intuitively but what about downscaling?
It always depends. I'd even say upscaling is sometimes better than downscaling.
Because if you scale up say by a factor of two you always just double every pixel and the end result looks the same just a bit bigger with more pixel, thus no information was lost.
On the other hand if you downscale, the scale algorithm has to decide which information should be dropped, since you can't paint two pixels at one position, you'll either have to pick one or merge their colors together. In both ways you lose information.

About the idea, you can do that, but a complete GUI library would make a better job... ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

maiev

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Graphics and design question - sf::Image
« Reply #5 on: July 04, 2012, 11:40:28 pm »
Thanks for all the help!  I think I have a workable solution for this now.