Scrollbar in DirectX

Started by
7 comments, last by VitaliBR 13 years, 6 months ago
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?
http://mateusvitali.wordpress.com/
Advertisement
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?
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.
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.
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
http://mateusvitali.wordpress.com/
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.
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?
http://mateusvitali.wordpress.com/
Anyone know how to change the layout of DXUT gui?
http://mateusvitali.wordpress.com/
anyone? :(

I've searched but found nothing

thanks
http://mateusvitali.wordpress.com/

This topic is closed to new replies.

Advertisement