Sign in to follow this  
VitaliBR

Scrollbar in DirectX

Recommended Posts

VitaliBR    147
Hi!

I have to put a scrollbar on a menu of my game, look:
http://img535.imageshack.us/img535/2720/semttulofub.png


On screen, it is only 18 images, with a scrollbar would like, could be placed more pictures.

How do I do that?

Share this post


Link to post
Share on other sites
Evil Steve    2017
Are you asking how to make a scrollbar control with Direct3D? What version of DirectX are you using? What part exactly are you having trouble with?

Share this post


Link to post
Share on other sites
Dawoodoz    461
A scrollbar would take weeks to make from scratch and might confuse the player.
The best looking solution would be to divide levels into chapters so that you turn a page by clicking on a "previous" or "next" button.

If you have the time to make a scrollbar, make a class with draw, scroll up, scroll down, hover, press and release calls. The class will allocate and draw a vertical background, up and down button images that changes from hover and pressing and a rectangle showing the interval of lines visible. To make smooth scrolling, render all level images with a screen projected alpha multiplying texture to clip away images outside of their area. Use a fast culling method to only draw from the first to the last visible level image.

Remember that you can use as much dynamic object orienting as you want because GUI is not a performance bottleneck. Make sure that you can reuse all GUI code and modify the look for your next games.

Share this post


Link to post
Share on other sites
szecs    2990
Scrollbar in weeks??
A whole GUI system can be written from scratch in weeks (for a game at least).

You need to render the scrollbar, you need to detect mouse click (a few point in rectangle check), you need to write a functions for the separate areas (if you want it to be real fancy, one clickable area would suffice too). Those functions are very simple functions: Moving the slider, and converting the slider coordinates to page coordinates.

That's pretty much it.

Share this post


Link to post
Share on other sites
VitaliBR    147
Quote:
Original post by Evil Steve
Are you asking how to make a scrollbar control with Direct3D? What version of DirectX are you using? What part exactly are you having trouble with?


Yes, i'm using the DirectX 9.c

I do not know where to start, Direct3D supports the scrollbar? or have to use a lib?

Thanks

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by VitaliBR
I do not know where to start, Direct3D supports the scrollbar? or have to use a lib?
DirectX is just a rendering API, it doesn't support anything as high level as that. You could use DXUI or some other UI toolkit, or if you want to implement it yourself you'll need to start from scratch - render each part of the scrollbar as a separate object and handle input yourself.

Share this post


Link to post
Share on other sites
VitaliBR    147
Found in samples from the Direct3D:
http://www.clootie.ru/Images/sdk_samples_92/CustomUI_big.jpg

I will study the sample, and if in doubt, I ask? you have experience with DXUI?

Share this post


Link to post
Share on other sites

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

Sign in to follow this