Quote: "Try it out"
You could use floats instead of integers too!
// Project: scroll
// Created: 2017-12-10
// show all errors
SetErrorMode(2)
#constant width = 1024
#constant height = 768
// set window properties
SetWindowTitle( "scroll" )
SetWindowSize( width, height, 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 ) // since version 2.0.22 we can use nicer default fonts
text = createtext("Hello, this is a test of a scrolling to see how smooth it is. Does it work for you")
SetTextSize(text,20)
textposition# = 0 - GetTextTotalWidth(text)
speed# = .8
do
inc textposition#, speed#
SetTextPosition(text, textposition#, height/2)
if textposition#>width then textposition# = 0 - GetTextTotalWidth(text)
if textposition# < 0 - GetTextTotalWidth(text) then textposition#=width
if GetRawKeyPressed(38) then inc speed#
if GetRawKeyPressed(40) then dec speed#
Print( ScreenFPS() )
Print ("Pressing Cursor UP Key inc speed")
Print ("Pressing Cursor Down dec speed")
Sync()
loop
Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1