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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - forrestcupp

Pages: 1 [2] 3 4
16
SFML projects / cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« on: September 28, 2009, 05:42:28 pm »
**Major Update**

I have just released cpGUI version 1.5.5b on the wiki.  This update adds a few things that people in this thread have asked for.

First, I have added the functions SetMouseoverColor() and GetMouseoverColor().  These functions allow you to customize the "hot" color that the object changes to when the user mouses over the object.

Secondly, I have added the ability to only include the objects that you want to use for your project to cut down on bloat.  I have separated most of the object classes into their own header and cpp files so that you can include only the ones you want.  There are cpGUI_base.h and cpGUI_base.cpp files that must be included as a requirement.  These files include the classes for cpGuiContainer, cpObject, cpButton, and cpScrollBar.  This is necessary because other objects depend on these.  cpSelectionBox and cpDropDownBox classes are both in the cpSelection-DropDownBox.h and cpSelection-DropDownBox.cpp files because the drop down box depends on the selection box.  Other than that, each of the other objects have their own files.  There is now a cpGUI-example-partial.cpp file to demonstrate how to do things this way.

Of course, you can still choose to do things the old way and include all of the classes in the original cpGUI.h and cpGUI.cpp files.  If you choose to do it this way, you don't need to include any of the new files.  The download still includes the cpGUI-example.cpp file to demonstrate how to do things this way.  The new features and bug fixes are incorporated into these files, also.

Lastly, I fixed a selection box bug pointed out by nacsasoft.  This bug caused a runtime error when you dynamically RemoveLastChoice() when the user makes a certain selection and the scroll bar is all the way down.  This bug is now fixed along with some much needed error catching in the RemoveLastChoice() function.

Enjoy!

17
SFML projects / cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« on: September 28, 2009, 05:30:54 pm »
Well, there actually was a bug in the way RemoveLastChoice() was implemented.  It had to do with how the scroll bar is repopulated.  I also didn't have any error catching, and it desperately needed it.  I have completely fixed this bug in the version I just released in the wiki.  Thanks to nacsasoft for pointing this out.

Also, if you're dynamically removing the last choice when a selection is made, make sure you are only doing it when the selection is actually being made.  If you just set a variable to the selection and only test that variable, it will just end up removing all the selections because that variable will not change until the user changes their selection.

See my next post about the new version!


By the way, your first screen shot is pretty sweet, nacsasoft!

18
General / Why?
« on: September 27, 2009, 11:19:18 pm »
I'm sure you have it figured out by now, but just for reference, it's better to use a forward slash / instead of a backward slash \.  Windows recognizes forward slashes, too, and it makes your code more portable since other OS's don't use backward slashes.  Also, if you use forward slashes, you don't have to worry about character escapes, and you don't have to use 2 backward slashes, \\.

19
General / Crash exit app with CPGUI
« on: September 26, 2009, 06:48:08 pm »
You probably either need to not make selBox a pointer, or delete it in your destructor.  Any time you create a pointer in a constructor, you need to delete it in your destructor, or you will have memory leaks.  That goes for any pointer, not just cpGUI ones.

20
SFML projects / cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« on: September 14, 2009, 11:35:16 pm »
Sweet!  Thanks for doing that.

I added your links to the wiki.  If you don't want them there, let me know.  Thanks again.

21
SFML projects / cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« on: September 06, 2009, 10:07:49 pm »
Quote from: "Andershizzle"
I added that include line to the cpGUI.cpp and the two errors mentioned above disappear. Also I added -Wall to my build line to show me any other possible errors. Now I'm getting this
Well, warnings are not the same as errors.  The code should run fine with warnings.  I tried to get rid of them all, and in Visual Studio, I did.

I honestly don't know why it's hanging for you.  I can't reproduce it.  Does SFML itself work for you without using cpGUI?  Also, are you using SFML version 1.5?

Quote from: "crazy2be"
I might adopt this project, as i need a GUI toolkit for my project, and using this would be easier than creating my own. However, i might have to release it under a GPL license, since my already existing window code is GPL license. Also, why did you put it all in one file? Doesn't that make it a pain to work with? (or do you have multiple files, you just combined them into one for release?). If you have it broken down into multiple files, i would appreciate if you PMed me the files or posted them here.
the zlib/libpng license is supposed to be compatible with the GPL.  That doesn't mean that cpGUI will turn into GPL for everyone else, though.  But it should be able to be incorporated into a GPL project.

Are you just wanting the classes each in their own files to make it more modular so you can just include only what you need?  I was thinking about doing that, but I never got around to it.  It really wouldn't be that hard for you to do it yourself, if that's what you're wanting.  I don't know when I'm going to get around to it.

22
SFML projects / cpGUI - A new object oriented GUI toolkit based on SFML 1.5
« on: September 04, 2009, 10:01:26 pm »
Quote from: "crazy2be"
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.
Thanks for the compliment.

Technically, it does have a hot/mouseover color; you just can't customize it.  It would be pretty easy for me to add that feature, but my wife just had a baby, and I don't know when I'll have time to get back to it.

In the mean time, you could get into the code and change the color to whatever you want, but it would apply to every instance.  If you want to do that, look into the CheckState functions for cpObject and cpButton.  I think it's around lines 478 & 794.

As for dragable windows, I don't think I'll be doing that anytime soon. :)  You're free to add that feature to the code if you want as long as you follow the license.

Quote from: "Andershizzle"
When I go to build your example using MingW in Windows I get 2 errors...

Quote

Compiling...
cpGUI.cpp: In member function `sf::Font* cp::cpGuiContainer::GetFont(std::string
, unsigned int)':
cpGUI.cpp:146: error: `runtime_error' is not a member of `std'
Finished!
  Run Executable? 'y' or 'n'
Y

Sorry.  I use Visual Studio, which automatically includes some standard headers in the project.  Maybe trying this in the cpGUI code will help:
Code: [Select]
#include <stdexcept>
Also, it appears that maybe you're trying to load a font that doesn't exist where you're telling it to look.

23
Window / [COMPLICATED:] Dynamic Input Manager
« on: August 15, 2009, 10:56:24 pm »
Quote from: "Hiura"
Because it's legal. Like
Code: [Select]
int(297)
Well, that's what I'm saying.  If sf::Key::Code(297) is the up key, why not just do something like:

Code: [Select]
m_actionlist[whatever].second = sf::Key::Code(myxmlfile.GetValue());

24
Graphics / Can't change sprite image
« on: August 15, 2009, 10:51:07 pm »
I never could get that to work properly.

25
Graphics / Can't load sf::Sprite from a function
« on: August 14, 2009, 09:14:13 pm »
You could just create the sprite in your main() function and pass a reference to it as one of the parameters in your Load function.  Then you don't even have to worry about memory management or leaks.

26
Graphics / Can't change sprite image
« on: August 14, 2009, 09:03:14 pm »
Quote from: "Laurent"
I've implemented this new parameter in the sfml2 branch.

Enjoy :)
Sweet!  Thank you.


In the meantime, you can just call
Code: [Select]
sprite.SetImage(sf::Image());before you set it with the new image, and it will clear the old subrect settings along with everything else from the old image.

27
Window / [COMPLICATED:] Dynamic Input Manager
« on: August 14, 2009, 08:57:14 pm »
I've done a lot since then, so I may be wrong.  But I'm pretty sure I tried something like
Code: [Select]
sf::Key::Code(297)and it worked.

28
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?

29
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.

30
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.

Pages: 1 [2] 3 4
anything