| I have some code that works okay in html5 but if I try it in iOS or GLFW it just blinks and then terminate. In X-code console there is no error shown. 
 Here is my code, its messy so just ignore that.
 
 
 
Import mojo 
Class ball
	Field ballI:Image
	Field ballX:Float
	Field ballY:Float
End
Class MyTouch Extends App
	Global touchX:Float
	Global touchY:Float
	Global SelectedBall:Int = -1
	Global touchedBall:Int = 0
	Global moveable:Int = 0
	Global startSet:Int = 0
	Global endSet:Int = 0
	Global oldX:Float
	Global oldY:Float
	Global newX:Float
	Global newY:Float
	Global moveX:Float
	Global moveY:Float
	Global speed:Float = 30.0
	Global AmigaBall:ball[]
	Global hitCounter:Int = 5
	Global direction:Int = 0
	Method OnCreate()
	
		AmigaBall[0] = New ball
		AmigaBall[1] = New ball
		
		AmigaBall[1].ballI = LoadImage("AmigaBall.png")
		AmigaBall[1].ballI.SetHandle(40, 40)
		
		AmigaBall[1].ballX = 200
		AmigaBall[1].ballY = 300
		SetUpdateRate 30
	End
	
	Method OnUpdate()
		touchX = TouchX(0)
		touchY = TouchY(0) 
		
		SelectedBall = FindImage(touchX, touchY)
		
		If TouchDown(0) And startSet = 1 And endSet = 0 And hitCounter = 0
			newX = touchX
			newY = touchY
			'** Den må flyttes
			moveable = 1
			'** Andet punkt er sat
			endSet = 1
			If newX > oldX Then direction = 2
			If newX < oldX Then direction = 1
		Endif
		If TouchDown(0) And endSet = 0 And startSet = 0 And SelectedBall > 0
			oldX = touchX
			oldY = touchY
			moveX = oldX
			moveY = oldY
			'** Sæt første punkt
			startSet = 1
			'** Sæt valgt ball som den ball som musen er hen over
			touchedBall = SelectedBall
		End If		
		If startSet = 1 And endSet = 0
			If hitCounter > 0 Then hitCounter -=1
		Endif
	End
	
	Method OnRender()
		Cls
		DrawImage AmigaBall[1].ballI, AmigaBall[1].ballX, AmigaBall[1].ballY
		DrawText "Touch=X" + touchX, 0, 10
		DrawText "TouchY=" + touchY, 0, 20
		DrawText "oldX=" + oldX, 0, 30
		DrawText "oldY=" + oldY, 0, 40
		DrawText "newX=" + newX, 0, 50
		DrawText "newY=" + newY, 0, 60
		DrawText "moveX=" + moveX, 0, 70
		DrawText "moveY=" + moveY, 0, 80
		DrawText "startSet=" + startSet, 0, 90
		DrawText "endSet=" + endSet, 0, 100
		DrawText "touchedBall=" + touchedBall, 0, 110
		DrawText "moveable=" + moveable, 0, 120
		DrawText "AmigaBall: " + SelectedBall, 0,130		
		If moveable = 1 And endSet = 1
			MoveBall(touchedBall)
		Endif
	End
	
	Method MoveBall(sBall:Int)
		'** Regn punkt y ud
		'** y = ((d-b)/(c-a)) * (x-a) + b
		moveY = ((newY-oldY)/(newX-oldX))*(moveX-oldX)+oldY
		AmigaBall[sBall].ballX = moveX
		AmigaBall[sBall].ballY = moveY
		If direction = 2
			moveX += (0.1 * speed)
			If moveX > newX
				moveable = 0
				touchedBall = 0
				startSet = 0
				endSet = 0
				moveX = 0
				moveY = 0
				oldX = 0
				oldY = 0
				newX = 0
				newY = 0
				hitCounter = 5
			Endif	
		Endif
		If direction = 1
			moveX -= (0.1 * speed)
			If moveX < newX
				moveable = 0
				touchedBall = 0
				startSet = 0
				endSet = 0
				moveX = 0
				moveY = 0
				oldX = 0
				oldY = 0
				newX = 0
				newY = 0
				hitCounter = 5
			Endif	
		Endif
	End
	
	Function FindImage:Int(xpos:Float, ypos:Float)
		
		Local x:Int
		For x=1 To AmigaBall.Length-1
			If xpos >= AmigaBall[x].ballX-40 And xpos <= AmigaBall[x].ballX+40 And ypos >= AmigaBall[x].ballY-40 And ypos <= AmigaBall[x].ballY+40
				Return x
			Endif
		Next
	End Function	
	
End
Function Main ()
	New MyTouch
End 
 I use array for my image. The reason I have two i that I cant see if I have selected number 0
 So I just create a new with number 0 and let it be.
 
 The image can be downloaded from here
 
 
 |