Jump to content
  • Advertisement
  • entries
  • comments
  • views


Sign in to follow this  


I'm really doubting my intelligience at the moment, as I just spent at least three hours working on these stupid scrollbars. Then, I went over laid on the bed for like two seconds and all of a sudden "OMFG" and I figured it out[tears].

Anyway, that set me back quite a bit[lol]. I planned on finishing at least four of the controls yesterday, but instead I only finished about one and a half. I got (delayed) tool-tips put in as well (it's totally ignored if the control doesn't have any tool-tip text.) Next I'm going to attempt to modify the VScrollBar class to support horizontal too, or I just might make a second class to make it easier.

Anyway, here's a new screenshot. Not quite as purty since I'm using test graphics. If you remember back when I released my old GUI I was having problems with the texture coordinates because I wasn't offsetting them by .5? Well, for some reason now offsetting them by .5 is causing me issues which is really annoying. I'm going to release a quick demo in a couple days and hopefully I can get some of you to test it out.

I also had to get rid of smart pointers. They were throwing a huge kink in my system, probably for the fact that I haven't really looked into how boost handles them. (I just removed the GUI shared pointers, Textures, Fonts, and other resources still use smart pointers.)

Some other modifications are that I added dragging. All controls inheritantly have dragging, but they have to override the OnDrag() function to do anything. I'm going to be adding drag and drop code, which I have planned out. Another modification is that I added OnChildX() overridable methods that are called when different events happen (for instance, when you click the scroll-up or scroll-down button on the scrollbar it sends the button to the scrollbar's OnChildClick() method.) This'll make things 10x easier than in my other design.

If I had to give out any advice on writing GUIs at the moment (because I'm SO in the position to be handing it out[rolleyes]) is to design your system so that controls notify the next level up, instead of the next level up checking for things. The above is a good example. In version 1.0, I iterated through each of control's children, sending them the OnLeftRelease() message and checking to see if they were pressed. In this this version, the children send the parent (or GuiManager if there is no parent) a message saying that it was clicked.

So, the next stuff on my list to finish are:
  • HScrollBar (Done; Decided to just make another class for now.)
  • ProgressBar
  • Tally
  • Counter
  • TextBox
  • ListBox
  • Dialog

Anyway, back to work for me. I didn't get up intil 6pm yesterday (I haven't been feeling good and I stayed up until after 6am yesterday morning), so I have the feeling that I'm not going to be tired any time soon.

For a good idea of what I meant by the .5 offset screwing things up, check out the image below:

This is supposed to be a combination of a 2x2 grid:
blue green
green blue

But the black borders around it are leaking into the gradient (it's more noticeable when in the hover state, since it had red borders.) Anyway, as you can see not offsetting works fine in mine. It also works fine on my mom's computer, my laptop, and ace4016's.
Sign in to follow this  


Recommended Comments

Original post by Rob Loach


Original post by Sir Sapo
Wow, that looks great, much better than my hacked together GUI system[grin]

Thanks Sir Sapo! Hopefully it turns out better than my old version lol.

Thanks for the comments guys!

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!