Mouse wheel selector

Blitz3D Forums/Blitz3D Beginners Area/Mouse wheel selector

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.

create a function to cap the values.

Function minmax# (value#,minval#,Maxval#)
	If value > maxval value = maxval
	If value < minval value = minval
	Return value
End Function


To use this, simply call minmax with the appropriate minimum and Max values.

example,...
print minmax (5,0,10) ; will return 5
print minmax (50,0,10) ;will return 10
print minmax (-10,0,10) ; will return 0

in your own code, you can use:
mousewheelposition=minmax(MouseZ(), minimum,maximum)

Edit: ahhh I see the problem you are having,... You will need to use this instead:
mousewheelposition=minmax(mousewheelposition + MouseZSpeed(), -5 ,-1)

now you are using the speed of the wheel to move rather than the absolute position.