Page 1 of 1

Scroll Bars?

PostPosted: Wed Mar 24, 2010 5:04 pm
by Hblade
Hey, would anyone like to tell me how I could take something that a canvas is drawing from, (say, a 320 x 280 size canvas or something is drawing a 1024x768 size image), and make scroll bars for it? The scroll bars can be canvas also for all I care, I just wanna know if it's possible.

Re: Scroll Bars?

PostPosted: Mon Apr 05, 2010 8:36 pm
by Thanx
If I understand well, then you're simply asking for a scrollbar... any kind possible...
Create something that goes as a bar, and make 3 other things/images: A button that points up, and one that points down (or left and right, doesn't matter). Put those on the end of the bar. The last thing is the scroll, or the rectangle, or whatever, that should be something scalable, so I advise a canvas, the size of the bar, minus the two ends.

Then you calculate with these factors: What's the visible height or width? What is the actual widht/height? The proportions they have to each other, gives the proportions of the scroll, to the lenght of the bar itself, and that's what you should use for canvas drawing.
The onclick of the buttons at the ends should change the view's position, while these things are parented. The other option is, that they change the position of the actor(s) viewed, but then if the scrolled area is not the whole window, you need an actor to frame it all.
Then use the positions of the viewed actors and the view itself to determine where you are viewing these actors, which determines where to paint the scroll thing itself, and determines wether the buttons should enable any scrolling. To enable the dragging of the scroll I don't know what to do, but it must be something similar....

Hope that helps...

Re: Scroll Bars?

PostPosted: Mon Apr 05, 2010 9:03 pm
by Hblade
Thanks :D