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

Author Topic: cpGUI - A new object oriented GUI toolkit based on SFML 1.5  (Read 54836 times)

0 Members and 1 Guest are viewing this topic.

forrestcupp

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #15 on: August 11, 2009, 08:04:20 pm »
Quote from: "l0calh05t"

Why not use a manager like mine as a member of cpGuiContainer, and get your fonts from there? This would be invisible to the user. (It will add dependencies to boost::thread and boost::smart_ptr though... if you can get away with no thread safety, you might remove the lock/mutex and boost::smart_ptr only requires a few headers)
It might be a little while before I have time to look through the code and figure out how to fit it in.  

If I can work it out, is it ok for me to use your code?  If so, what would be the proper protocol for doing that?  I'm new at working with free licenses, and it looks like your license's terminology is slightly different than the zlib/libpng license I used.  I don't know how it works to mix code with different licenses and the best way to direct the credit where it is due.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #16 on: August 11, 2009, 08:28:09 pm »
Quote from: "forrestcupp"
It might be a little while before I have time to look through the code and figure out how to fit it in.  

If I can work it out, is it ok for me to use your code?  If so, what would be the proper protocol for doing that?  I'm new at working with free licenses, and it looks like your license's terminology is slightly different than the zlib/libpng license I used.  I don't know how it works to mix code with different licenses and the best way to direct the credit where it is due.


Since you mentioned the license... I just noticed that I didn't replace all the <> tags... Anyways... it's just your basic 3-clause BSD license which means, yes, you can use the code, but the copyright holder (me) has to be mentioned and the license in the documentation (or otherwise visibly included with the program). Furthermore you may not use my name in any advertising without my permission.
As far as I understand, you could use my code in your project and redistribute it, as long as you point out that parts of the code (and which parts) are licensed under a different license. (But I am no Lawyer)

forrestcupp

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #17 on: August 11, 2009, 08:42:27 pm »
Quote from: "l0calh05t"
Quote from: "forrestcupp"
It might be a little while before I have time to look through the code and figure out how to fit it in.  

If I can work it out, is it ok for me to use your code?  If so, what would be the proper protocol for doing that?  I'm new at working with free licenses, and it looks like your license's terminology is slightly different than the zlib/libpng license I used.  I don't know how it works to mix code with different licenses and the best way to direct the credit where it is due.


Since you mentioned the license... I just noticed that I didn't replace all the <> tags... Anyways... it's just your basic 3-clause BSD license which means, yes, you can use the code, but the copyright holder (me) has to be mentioned and the license in the documentation (or otherwise visibly included with the program). Furthermore you may not use my name in any advertising without my permission.
As far as I understand, you could use my code in your project and redistribute it, as long as you point out that parts of the code (and which parts) are licensed under a different license. (But I am no Lawyer)
As far as you understand, would it satisfy the requirements for me to just leave your license in the comments above your code just like you have it?  Of course, I would also give you credit in the wiki.

I need to take the time to make sure I can get it to work, first, though.  Thanks a lot for your assistance.


Edit:
I have updated my code with redkiing's fix for resizing the windows.  That fix is posted to the wiki now.  Thank you redkiing.

forrestcupp

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #18 on: August 11, 2009, 09:27:52 pm »
Quote from: "l0calh05t"
Quote from: "forrestcupp"
So, does anyone have any solutions of an easier way to handle this problem?  Is it a big enough problem to even open a can of worms like this?  I'm open to suggestions here.


You could have a look at my resource manager ( http://www.sfml-dev.org/wiki/en/sources/resource_manager_l0calh05t ), it includes a sf::Font example. This would prevent reloading of the fonts as long as different elements use the same font size (so 8 buttons with font size 20 will share one font)
The main problem I'm seeing as I look through your code is that if someone doesn't have the boost libraries installed, it will render the whole thing useless.  I'd kind of hate to put that requirement on it.  It's definitely giving me stuff to think about, though.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #19 on: August 11, 2009, 10:33:38 pm »
Quote from: "forrestcupp"
As far as you understand, would it satisfy the requirements for me to just leave your license in the comments above your code just like you have it?  Of course, I would also give you credit in the wiki.


If the distribution is in source code form, yeah, sure.

Quote
The main problem I'm seeing as I look through your code is that if someone doesn't have the boost libraries installed, it will render the whole thing useless. I'd kind of hate to put that requirement on it. It's definitely giving me stuff to think about, though.


Every C++ programmer should have the boost libraries installed :P You could obviously replace the shared/weak pointers by a different implementation, but in general the boost ones are very reliable (which is why I chose them)

forrestcupp

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #20 on: August 11, 2009, 10:47:51 pm »
You've helped me a lot by pointing me towards the benefits of maps over vectors.  That helps me a lot.

I think by learning from your code and also Wavesonics resource manager, I can come up with something customized that will fit well in my project.

Thank you for your help.

forrestcupp

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #21 on: August 13, 2009, 05:30:16 pm »
I have added a built-in font manager to help save on resources. Now, rather than having a separate font for each object, new fonts are only loaded when necessary. Also, when a font is no longer used by any object, it is automatically deleted. Other than cpGUI's default font, you will never have an unused font in memory.

This is all automatic, and it doesn't change how cpGUI is used.

Thanks to “Meltra Bour” for pointing out the need on the forums. Thanks to “l0calh05t” & “Wavesonics” for helping me learn how to implement this.

There were also other minor bug fixes in this update.  You can download the update in the Projects section of the Wiki.

Meltra Bour

  • Newbie
  • *
  • Posts: 28
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #22 on: August 13, 2009, 07:56:44 pm »
Nicely done, its looking relay nice now. To bad I was told to stay away from sf::string and the likes. :roll:

forrestcupp

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #23 on: August 13, 2009, 09:57:48 pm »
Ha, ha.  Well, you can just stay away from sf::String in everything you do except cpGUI.  I don't think I'll be changing that anytime soon.  It really shouldn't affect anything else you do.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #24 on: August 14, 2009, 02:55:56 pm »
sf::String could definitely use some improvement (VAs instead of immediate mode, and since text always has to be set when changed the vertex data etc. should be prepared once, instead of being generate every frame etc..) but if cpGUI is meant for SFML it should use it, and the fixes have to be done on the SFML-side of things

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #25 on: August 14, 2009, 03:02:52 pm »
It's true that sf::String is not optimized at all. There will be many improvements in SFML 2, including the use of VBOs/VAs.
Laurent Gomila - SFML developer

forrestcupp

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #26 on: August 14, 2009, 07:52:31 pm »
Will there be a lot of old stuff that is broken with SFML 2.0, or will most of the end-user code be easy to port?

luminous

  • Newbie
  • *
  • Posts: 8
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #27 on: August 19, 2009, 10:22:10 am »
I am hardly the authority on the matter, But from my poking around in the SFML 2.0 code to get idea's on using FBO's of sizes differing from the screen size with SFML drawable objects it looked like most of the code would be compatible with sfml 1.x, likely only requiring minor changes and a recompile due to slight API differences.

Really I can't wait SFML 2.0 is something I am looking forward to.

I have a Gui project I am working on as well, if your interested I would be more then happy to post the code after I polish it a bit.

I have a working 9slice render that draws to an FBO and saves the result as a texture for use later to prevent having to re-render  the same thing every frame. My widgets use FBO's as well and my gui only "re-renders" when something changes.  Maybe this approach would help with sf:String speed issues as well?

drew

  • Newbie
  • *
  • Posts: 11
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #28 on: August 19, 2009, 07:21:12 pm »
Ah very nice! I was just trying to plan out ideas on how to implement my own GUI objects and I ran across this. I do kinda want to make my own to learn more but at the same time I'm so tempted to use this in my current project so I don't have to bother trying to do it all, which would probably end up being really inefficient anyway. :D

crazy2be

  • Newbie
  • *
  • Posts: 9
    • View Profile
cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« Reply #29 on: August 30, 2009, 01:34:41 am »
Really great! The biggest improvements i could imagine on this are the adding of "hot" colors as imgui called them, or mouseover colors, and the ability to have dragable windows with controls in them.

 

anything