Works fine for me
// Project: flickscroll
// Created: 21-02-03
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "flickscroll" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )
setvsync(1)
SetPrintSize(64)
distance as float
y as float = 0
for i=1 to 100
id = createtext("This is line "+str(i))
settextsize(id, 24)
SetTextPosition(id, 0, y)
inc y, GetTextTotalHeight(id)
next
bottom as float
bottom = y - GetTextTotalHeight(id) * 5
scale as float = 0.4
sy as float
inertia as float
do
if GetPointerPressed()
y = GetPointerY()
sy = y
endif
if GetPointerReleased()
inertia = (sy - GetPointerY()) * scale
endif
if GetPointerState()
distance = (y - GetPointerY())
if GetViewOffsetY() + distance < bottom and GetViewOffsetY() + distance > 0
SetViewOffset(GetViewOffsetX(), GetViewOffsetY() + distance)
endif
y = GetPointerY()
else
if GetViewOffsetY() + inertia < bottom and GetViewOffsetY() + inertia > 0
SetViewOffset(GetViewOffsetX(), GetViewOffsetY() + inertia)
endif
inertia = inertia * 0.9
endif
Print( str(inertia))
Sync()
loop