Re: Mousewheel scrolling?[SDL 2.03]

Sanette <[email protected]>
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
1. the basic behaviour is to add some fixed number of pixels to the
vertical position of the element you want to scroll at each mouse
wheel event.  for instance add (5 multiplied by the y field of
SDL_MouseWheelEvent)

2. if your event loop is not continuous or too slow, the events will
accumulate. It's a good idea to sum them up at once (and remove them
from the event queue).

3. if you want *smooth* scrolling like in most browsers, it is much more
delicate. Few people have a good code for this.



Le 17/10/2016 à 07:27, theatron a écrit :
> I've been experimenting with the mouse events today and im basically confused on how i can make this work the way i want it to. Whenever i scroll the mouse wheel up it literally only outputs the number 1. But when i trace tge mouses position it gives me alot more than just "1". Im trying to add a feature in my app that'll allow it to scroll up and down and how fast it'll scroll is based on how fast the wheels going(ex: Web Browsers).  > > Heres the code i had: > > > > > > > > Code: > > int y = 0; > > 
void Update() > { >     if(evt.type = SDL_MOUSEWHEEL) >        { 
 >                 cout << y << endl; >         } > > } > > > Is SDL 2 
capable of the kind of mouse scrolling i mentioned? or am i doing it the 
wrong way :/ ? > > Thanks > > > 
_______________________________________________ > SDL mailing list > 
[email protected] > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.