Hi,
I added to the conversation on the forum for "How to make scrolling menu by swiping?"
https://forum.thegamecreators.com/thread/215041#postHolder
I am struggling to use the swipe menu commands
The phone struggles to tell the difference between
if touch_type = 1 and
if touch_type = 3
SetVirtualResolution(800,1200)
// create and size a sprite
function tidytext()
for i=1 to 50
settextdepth(i,100)
next i
endfunction
//LOAD TEXT FONT
loadimage(37,"myfont.png")
// creating text for keywords
opentoread(1,"example.txt")
for i=1 to 50
createtext(i,readline(1))
settextsize(i,50)
settextdepth(i,101)
settextcolor(i,0,255,255,255)
settextposition(i,xpos-1500,200)
settextmaxwidth(i,750)
next i
closefile(1)
swipe=1
///subjects
Loadimage(1,"1.jpg")
Loadimage(2,"2.jpg")
Loadimage(3,"3.jpg")
Loadimage(4,"4.jpg")
Loadimage(5,"5.jpg")
Loadimage(6,"6.jpg")
Loadimage(7,"7.jpg")
Loadimage(8,"8.jpg")
Loadimage(9,"9.jpg")
Loadimage(10,"10.jpg")
Loadimage(11,"11.jpg")
Loadimage(12,"12.jpg")
Loadimage(13,"13.jpg")
Loadimage(14,"14.jpg")
Loadimage(15,"15.jpg")
Loadimage(16,"16.jpg")
Loadimage(17,"17.jpg")
Loadimage(18,"18.jpg")
Loadimage(19,"19.jpg")
Loadimage(20,"20.jpg")
for i= 1 to 20
createSprite(i,i)
next i
for i = 1 to 8
SetSpriteSize(i,400,400)
SetSpritePosition(i,400*(i-1),200)
setspritedepth(i,10)
SetSpriteSize(i+8,400,400)
SetSpritePosition(i+8,400*(i-1),650)
setspritedepth(i+8,10)
next i
for i = 15 to 16
setSpriteSize(i,400,150)
SetSpritePosition(i,400*(i-15),0)
fixSpriteToScreen(i,1)
setspritedepth(i,10)
next i
for i = 17 to 18
setSpriteSize(i,400,150)
SetSpritePosition(i,400*(i-17),1050)
fixSpriteToScreen(i,1)
setspritedepth(i,1)
next i
setSpriteSize(20,800,900)
SetSpritePosition(20,xpos,150)
setspritedepth(20,15)
// position of the sprite
xpos = 0
ypos = 0
do
// find out which sprite has been hit or clicked
//pressing mouse
if getpointerpressed()=1
id=getspritehit(getpointerx(),getpointery())
if id>0 and id<14
settextdepth(id,0)
settextposition(id,xpos+100,200)
settextmaxwidth(id,600)
setspritedepth(20,2)
SetSpritePosition(20,xpos,150)
endif
if id =17
StartTextInput ( )
endif
if id=18
Stoptextinput ()
text$ = GetTextInput ( )
endif
if id=20
setspritedepth(20,20)
SetSpritePosition(20,-1500,200)
for i=1 to 16
SetTextPosition(i,-1500,200)
settextdepth(i,100)
next i
endif
endif
if id=15
//opens camera
if GETCAMERAEXISTS() =1
if SHOWIMAGECAPTURESCREEN() =1
while ISCAPTURINGIMAGE() =1
sync()
endwhile
image=GETCAPTUREDIMAGE()
if image=0 then end
idsprite = CreateSprite ( image )
sx#=1024.0/getimagewidth(image)
sy#= 768.0/getimageheight(image)
SetSpriteScale( idsprite, sx#, sy# )
endif
else
message("no cam")
endif
//ShowImageCaptureScreen()
endif
// capture touch event
touch = GetRawFirstTouchEvent(1)
// get all the basic information about the touch events
touch_type = GetRawTouchType(touch)
touch_xs = GetRawTouchStartX(touch)
touch_xc = GetRawTouchCurrentX(touch)
touch_xl = GetRawTouchLastX(touch)
touch_ys = GetRawTouchStartY(touch)
touch_yc = GetRawTouchCurrentY(touch)
touch_yl = GetRawTouchLastY(touch)
// if touch is drag event then move the view
if touch_type = 3
tidytext()
xpos = xpos - (touch_xc - touch_xl)
ypos = ypos - (touch_yc - touch_yl)
SetviewOffset(xpos,0)
endif
if touch_type=0
//
if id>0 and id<14
settextdepth(id,0)
settextposition(id,xpos+100,200)
settextmaxwidth(id,600)
setspritedepth(20,2)
SetSpritePosition(20,xpos,150)
endif
if id =17
StartTextInput ( )
endif
if id=18
Stoptextinput ()
text$ = GetTextInput ( )
endif
if id=20
setspritedepth(20,20)
SetSpritePosition(20,-1500,200)
for i=1 to 16
SetTextPosition(i,-1500,200)
settextdepth(i,100)
next i
endif
xpos =(800*(ceil((xpos+400)/800)))
endif
///7200 here as there are 10 images/pages 0 thru 7200
if xpos>2400
xpos=2400
endif
// position the screen
SetviewOffset(xpos,0)
//GetCamImage()
sync()
loop
Any advice or refinements are welcome
Thanks
lmbeeee