i'm assuming? that you want to use the built-in text commands since you stated:
Quote: "...with Drawtext function"
// Project: pickimage
// Created: 2019-03-15
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "PickImage" )
SetWindowSize( 1080, 720, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1080, 720 ) // 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
images as String []
thisfile$ = GetFirstFile()
repeat
if right(thisfile$,3) = "png" or right(thisfile$,3) = "jpg"
images.insert(thisfile$)
endif
thisfile$ = GetNextFile()
until thisfile$ = ""
NumImages = Images.Length
if numImages > -1
for x = 0 to NumImages
CreateText(x+1,images[x])
SetTextPosition(x+1,0,(x*48))
SetTextSize(x+1,48)
next x
else
CreateText(1,"No Images Present")
SetTextSize(1,48)
endif
do
if GetPointerPressed()
mx = GetPointerX() : my = GetPointerY()
for x = 0 to (Images.Length)
If GetTextHitTest(x+1,mx,my) = 1
if GetSpriteExists(pic) then DeleteSprite(pic)
pic = LoadSprite(GetTextString(x+1))
SetSpritePosition(pic,780,0)
SetSpriteSize( pic, 300, -1 )
endif
next x
endif
Sync()
loop
...which i wouldn't recommend since the
GetTextHitTest() is very basic (requiring the brute-force approach above, cycling thru all Text objects) and you'll have to sort things out if you have more filenames than fit on the screen, etc, but if you're looking for basic functionality, the above would do it.