Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 8th Apr 2010 18:17
Firstly here's a pic of 5000 windows all moveable and everything (not resizeable, though I could if I need them to):



As you can tell by the FPS it runs really fast, even better is the fact that you'd never use no where near as many windows so it would run even faster with a lot less. Also it doesn't matter how big the windows are, it will run at the same speed. So before I let loose all my secrets out the bat cave, can you work out how I did this?

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th Apr 2010 18:30
Disabled background, so you only draw the current window as the previous window is just left there. I'm thinking your using a sprite for the current window. Then when you move a window, you redraw everything but, and grab the screen, then wipe the screen with that while dragging the window and updating the one sprite.

I've found that the ability to draw directly to images makes GUI's so much nicer to work with. Usually I just use an image for each window and redraw controls on it using the ImageKit plugin. It's really fast too, like I have a little sprite editor test interface, and it's just as fast as any sprite editor I've used, ImageKit has lots of handy features, like creating an image with a solid colour really quickly, then pasting that onto a grid on an image. I think rotation has been added - so it could do some really nice dials and knobs, right onto am image. It certainly cuts down on all the cutting and pasting needed with most GUI's.

Good to see people thinking outside the box, no matter how your doing it, it works beautifully.


Health, Ammo, and bacon and eggs!
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 8th Apr 2010 18:49 Edited at: 8th Apr 2010 18:49
Quote: "Disabled background, so you only draw the current window as the previous window is just left there. I'm thinking your using a sprite for the current window. Then when you move a window, you redraw everything but, and grab the screen, then wipe the screen with that while dragging the window and updating the one sprite"


Hmm... interesting idea, not what i've done but I'd love to code that. Just a wonder, if you disable the background wouldn't anything that's moving, say anything 3d leave trials?

The way I did it was dump anything non-active to a bitmap and copy it to the root bitmap ever frame. Also I don't use sprites (though I did use one when redrawing just to alter the alpha so you could see all the windows in this pic).

Quote: "I've found that the ability to draw directly to images makes GUI's so much nicer to work with. Usually I just use an image for each window and redraw controls on it using the ImageKit plugin. It's really fast too, like I have a little sprite editor test interface, and it's just as fast as any sprite editor I've used, ImageKit has lots of handy features, like creating an image with a solid colour really quickly, then pasting that onto a grid on an image. I think rotation has been added - so it could do some really nice dials and knobs, right onto am image. It certainly cuts down on all the cutting and pasting needed with most GUI's."


Ha, I do that as well now. ImageKit really is great and really fast.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 8th Apr 2010 19:11 Edited at: 8th Apr 2010 19:15
How fast does this method run for you, exe attached.

Edit: btw, there's not 5000 windows in this one cause it takes ages to create them all.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Robert The Robot
19
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 8th Apr 2010 19:31
Wow, that looks amazing! I'm working on my own GUI at the moment as well, but for DBC - just out of interest, how fast is it when you need to redraw the non-active forms to a bitmap?

I'd imagine 5000 Sprite/Paste image commands would tear the FPS to shreds during the redraw, though it would improve once only the top, active form was being drawn.

Also, can your GUI handle drawing 3D in the background/other sprites? or are you restricted to just running the GUI?

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 8th Apr 2010 19:51 Edited at: 8th Apr 2010 19:53
Quote: "how fast is it when you need to redraw the non-active forms to a bitmap?"


Well paste sprite/image is really fast so I doubt you'd even notice. But here's the thing, any app you make will use no where near 5000 windows so it doesn't matter. Also once everything is drawn, you don't have to draw it again, but just edit the gadgets with ImageKit which is how i'm doing it. Though my other GUI projects didn't use any of this and still ran fast, especially the Steam based one.

Quote: "Also, can your GUI handle drawing 3D in the background/other sprites? or are you restricted to just running the GUI?"


It can if you copy the whole screen to the bitmap, which btw, there must be a way of turn all those unused pixels into alpha, though I know the root bitmap only accepts certain formats. But to combat this, you just copy only the window coordinates to the bitmap for each window.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 8th Apr 2010 19:56
I'm guessing you just batch all the windows together using cloggy's d3d dll, or maybe using direct3d directly? The text and title bar are probably rendered to an image on load, and then the image is used as a texture when rendering.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 8th Apr 2010 20:03
You might find this surprising, but I've never used cloggy's d3d dll even though I know very clearly of all it's benefits. Hmm... I really don't know why I'm not, I could probably achieve even more if I did.

Keep these coming guy's, I like hearing all these different methods for doing the same thing. Looks like I'll have to make them in the future to see which is the best method.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
NickH
18
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 9th Apr 2010 01:08 Edited at: 9th Apr 2010 19:45
I had a go at a GUI using D3D and Matrix plugins quite a while ago which I will find a use for one day Draggable windows, sizeable, and they snap together, the txt is all centred and automatically shorten when theres not enough space, they can be focused and the tabs work. Also its easy to put contents within the windows and I did started making the tabs draggable from window to window which I was half way through at the time. I didn't use any sprites. Quite fun making this

ShaunRW
DBPro Developer
18
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 9th Apr 2010 06:29
I have no idea how you did this. But it's cool. I had about 2400 FPS with the exe you uploaded.

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 9th Apr 2010 19:45
Nice, i got 100 fps with the exe, which is actually great for my laptop

Rawwrr. Sig Fail.
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 12th Apr 2010 16:30 Edited at: 12th Apr 2010 16:30
I ported the method to my Valve's Steam inspired GUI, pic:





Not only do they run faster but I can do some mad stuff since I'm using ImageKit this time round. After a play around, I found I could increase the performance further by getting rid of Bitmaps and use ImageKit's 'Create Image' and 'Paste Image on Image' commands, also I sorts out the transparency issues I would have with Bitmaps. Basically the GUI now runs 4 times the speed it did.

The funny thing is rendering the GUI is really quick, what slows it down is the arrays, especially if you've got 5000 windows in a priority list (array) and you need to shift one element to the top, then that can really slow things down. But since you'd never have that windows and you would never have that over 50 windows open then it doesn't matter, and everything can go back to light speed.

NickH, that pretty cool, and the 'tabs draggable from window to window' sound interesting, I just wondering if there and actually use for it. I can drag my tabs off windows to form new windows and drab window into windows to form tabs, though I don't use it much.

ShaunRW, My new method is even faster now.

Mad Nightmare, Haha, that's about the same I get on my laptop. Though I don't really use it any more after my studies ended, it's just become a portable movie player.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Caleb1994
17
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 12th Apr 2010 16:48
How did you redraw the offscreen bitmap so fast when you grab lets say the bottom window?????? there is NO speed change!

New Site! Check it out \/
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 12th Apr 2010 16:55
All windows are pre-rendered images, so I only need to paste the image of the windows I'm grabbing to the screen, hence pretty much no speed change.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 12th Apr 2010 17:05
That's the beauty of ImageKit - you can get rid of that horrific GET IMAGE command, as well as a need to use bitmaps. It's my favorite plugin, and I have them all pretty much. With it, it should be able to do any sort of 2D GUI you'd ever need, but fast.

Valve GUI looks neat, somehow I think that's the only style of GUI that suits Steam, I can't imagine it with any shiny glass blue led nonsense .


Health, Ammo, and bacon and eggs!
GIDustin
18
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 12th Apr 2010 22:02
What method do you use to draw text to your images? I know that I have run into problems with d3dfunc drawing text to an image/bitmap that was not the same resoluton as the window. It would shrink the text down considerably. That is what kept me from using images as a "cache" before.

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 13th Apr 2010 01:18
I would make a bitmap font, then either cut out each letter and paste it in to combine strings. There are a few bitmap font tutorials around, very handy for this sort of thing you should check them out, if you can find one that pastes the images, then it should be very easy to convert to image drawing.


Health, Ammo, and bacon and eggs!
dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 13th Apr 2010 03:24
Quote: "The funny thing is rendering the GUI is really quick, what slows it down is the arrays, especially if you've got 5000 windows in a priority list (array) and you need to shift one element to the top, then that can really slow things down. But since you'd never have that windows and you would never have that over 50 windows open then it doesn't matter, and everything can go back to light speed. "


I have no idea what a priority list is, but if it's anything like a priority queue then why aren't you using a linked list? That way, shifting items to the top can be done in constant time. I don't see why you would need to sort the list by priority for a GUI as it's not like you'd ever randomly insert windows with an initially unknown depth.

Caleb1994
17
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 13th Apr 2010 07:38
Quote: "I have no idea what a priority list is, but if it's anything like a priority queue then why aren't you using a linked list? That way, shifting items to the top can be done in constant time. I don't see why you would need to sort the list by priority for a GUI as it's not like you'd ever randomly insert windows with an initially unknown depth."


I agree. I made a GUI once. Every window knew what window came next and what window was before it. It also knew the handle to it's first and last child. So window handle zero references the first and last windows with no parent. That way you can use that to run through all the windows. Also to change the order, just change the next/prev properties of the window you are moving and the top window. It is really fast, and it keeps the priority like you are doing now!

New Site! Check it out \/
NickH
18
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 13th Apr 2010 20:55 Edited at: 13th Apr 2010 21:11
Quote: "NickH, that pretty cool, and the 'tabs draggable from window to window' sound interesting, I just wondering if there and actually use for it. I can drag my tabs off windows to form new windows and drab window into windows to form tabs, though I don't use it much."


Its mainly so you can configure the GUI. Each window is like a blank canvas. GIMP can do a similar thing. It drags at the moment, but doesn't drop yet. When I've finished my main project I'll probably endup using a rewrite of my GUI system to make my next game...if it requires such a GUI that is
Sid Sinister
21
Years of Service
User Offline
Joined: 10th Jul 2005
Location:
Posted: 28th Apr 2010 21:30
Sasuke, nice to see you're still doing work on stuff. I haven't dropped by the DBP forums in a while, but I remembered you today and looked you up. Your work is amazing as always! Have you done any work in XNA? A few more weeks and I'll be done with my XNA Game Dev class.

"If I have seen a little further it is by standing on the shoulders of Giants" - Isaac Newton
Current Project: http://strewnfield.wordpress.com/ (Last updated 06/11/09)
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 28th Apr 2010 22:00
Wow, that valve gui looks really cool. Would it be possible to post an exe of that? Also, are you planning on making this a dll or releasing the code?

Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 28th Apr 2010 22:05
Hey this is pretty nice..

Any plans to release it soon? Maybe a building app that generates the DB code ? That would be really useful

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 3rd May 2010 21:08
@ dark coder & Caleb1994, your absolutely right, I actually use linked lists on the other GUI's, but didn't for some reason on this one. Though I was surprised how slow arrays would be.

@ Sid, thanks and no I haven't had a bash at XNA, though I've looked at a bit of it. Found some useful stuff and ported it to DBP. Currently working on GUI surfaces, like you would have seen in Doom 3.

@ thenerd & Neco, when I've got the best technique down for GUI's then I will release the code or maybe make an official GUI thread, yeah, that sound the way to go.

Quick question on linked lists. Whats the best way to handle them, for instance, a singular array that handles all classes which when it come to combolists or any gadget that can have multiple childs I'm alittle lost on how to setup, a singular array that works as a reference for separate class arrays, multiple linked list, a combination of the previous (what i'm using) or something I haven't thought of. Basically what the best method that works for all standard gadgets?

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Sharlenwar
17
Years of Service
User Offline
Joined: 4th Mar 2009
Location:
Posted: 4th May 2010 09:18
Amazing work Sasuke!

Question though, could you point me in the right direction on where one would even attempt to create a GUI? I once remember you mentioning that you would put together a tutorial of a sorts. Did that ever materialize?

Anyways, great work, and with my computer back up and running here, I plan on working on some interesting DBPro programs.

Login to post a reply

Server time is: 2026-07-27 20:18:06
Your offset time is: 2026-07-27 20:18:06