Jun. 15th, 2005

mrlachatte: (Default)
I 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.

December 2007

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526 272829
3031     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 7th, 2025 11:00 pm
Powered by Dreamwidth Studios