SyntaxBomb - Indie Coders

Languages & Coding => Blitz Code Archives => User Input => Topic started by: RemiD on September 28, 2023, 11:24:58

Title: mouse wheel to increase decrease a value
Post by: RemiD on September 28, 2023, 11:24:58
i have probably already posted such example in some of my others code examples, but i don't remember where or when...

use the mouse wheel to increase (+1) or decrease (-1) a value.

;mouse wheel to increase (+1) or decrease (-1) a value by RemiD (20230928)

Graphics( 854, 480, 32, 2 )

Global MZOld% = 0
Global MZCur% = 0
Global MWheel% = 0

Global ValueInt% = 0

Main()

End()

Function Main()

 Repeat

  MWheel = 0
  MZCur = MouseZ()
  If(MZCur > MZOld)
  MWheel = + 1
  MZOld = MZCur
  ElseIf(MZCur < MZOld)
  MWheel = - 1
  MZOld = MZCur
  EndIf

  If( MWheel = + 1 )
  ValueInt = ValueInt + 1
  Else If( MWheel = - 1 )
  ValueInt = ValueInt - 1
  EndIf

  SetBuffer( BackBuffer() )
  ClsColor( 000, 000, 000 ) : Cls()

  Color( 240, 240, 240 )
  Text( 854/2-StringWidth(ValueInt)/2, 480/2-StringHeight(ValueInt)/2, ValueInt )

  Flip(1)

 Until( KeyDown(1)=1 )

End Function
Title: Re: mouse wheel to increase decrease a value
Post by: Baggey on September 29, 2023, 18:07:02
What language is this?

Baggey
Title: Re: mouse wheel to increase decrease a value
Post by: RemiD on September 30, 2023, 09:59:24
blitz3d / blitzbasic