Click go the shears, boys
Jun. 15th, 2005 01:04 amI had a nice break from my ball thingie and decided to work on a scrollbar implementation in SDL that I'd dreamed up recently. This is the result:

It functions perfectly, from surfaces one pixel larger than the view (300px) to gigantic ones (16384px), with nice smooth scrolling, all in under 250 lines of code. Now, the only thing missing is the ability to drag the scrollbar, basically I want to emulate scrollbars in any decent program. Unfortunately, I cannot figure out how to get the dragging to work. I calculate the position of the scrollbar based on the y offset into an SDL_Surface, but I'm drawing a blank on how to figure out that offset based on a mouse click inside the scroll bar area.
Win32 binary, one C file, 5 resources (101kb)
I'm hoping someon out in interweb land might have an idea for me, I spent two hours making this thing and the last 2.5 trying to get the dragging to work. Hopefully I'll have fresh ideas while I'm out at Blackbutt tomorrow.
It functions perfectly, from surfaces one pixel larger than the view (300px) to gigantic ones (16384px), with nice smooth scrolling, all in under 250 lines of code. Now, the only thing missing is the ability to drag the scrollbar, basically I want to emulate scrollbars in any decent program. Unfortunately, I cannot figure out how to get the dragging to work. I calculate the position of the scrollbar based on the y offset into an SDL_Surface, but I'm drawing a blank on how to figure out that offset based on a mouse click inside the scroll bar area.
Win32 binary, one C file, 5 resources (101kb)
I'm hoping someon out in interweb land might have an idea for me, I spent two hours making this thing and the last 2.5 trying to get the dragging to work. Hopefully I'll have fresh ideas while I'm out at Blackbutt tomorrow.