Smooth Scrolling With The Mousewheel

Blitz3D Forums/Blitz3D Beginners Area/Smooth Scrolling With The Mousewheel

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hiya!

I've been having all sorts of nightmares with getting smoother scrolling up and down with using the mouse wheel. When saying smoother, I mean the image scrolls according to how fast the mouse wheel is moved. As you'll see from the example below it's not right. And would love help me getting it working correctly.

Cheers so much!

;-========================-
;-=[Mouse Scroll Wheel	]=-
;-=[Moving Image Program]=-
;-========================-

Const xres=640,yres=480
Graphics xres,yres
SetBuffer BackBuffer()

Global Scroll_Image=CreateImage(xres-100,1000)
	SetBuffer ImageBuffer(Scroll_Image)
		Color 164,000,000
		Rect 100,0,xres-100,yres,1
		
		For Bits=0 To Rnd(200)
			Color Rnd(60,250),Rnd(60,255),Rnd(60,255)
			Rect Rnd(100,xres),Rnd(0,yres),Rnd(4,20),Rnd(4,20)
		Next
	SetBuffer BackBuffer()
	
Global MY#

While Not KeyHit(1)
Cls
	Update_Image_With_Scroll_Wheel()			
Flip
Wend



Function Update_Image_With_Scroll_Wheel()

MY=MouseZ()+MouseZSpeed()
;-============================-
;-=[Draw And Move The Screen]=-
;-============================-
DrawImage Scroll_Image,0,MY
End Function