This shows you the differences between two versions of the page.
built_in:glview [2015/09/07 07:39] 82.204.40.82 [Table] |
built_in:glview [2016/09/02 02:49] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== GLView ====== | ||
- | ===== Create ===== | ||
- | < | ||
- | ===== Methods ===== | ||
- | Some controls use the same methods.\\ | ||
- | For examples of the **[[same methods]]** look here. | ||
- | ^ Method | ||
- | | GLView.CreateImage( image, options ) | ||
- | | GLView.DrawImage(img, | ||
- | | GLView.SetOnTouch(callback) | ||
- | | GLView.DrawSprite(image, | ||
- | |||
- | ===== Sample ===== | ||
- | (Sample code by Chris Hopkin taken from the DroidScript Google Group) | ||
- | |||
- | If you need to want to simulate OnTouch for a GLView Image, you will need to keep track of the position, width and height that it has been drawn with. Then use the GLView OnTouch event to determine if the touch coordinates are within the GLView Image yourself. Something like this: | ||
- | |||
- | <code javascript> | ||
- | glview.SetOnTouch(glview_OnTouch); | ||
- | |||
- | glImg = glview.CreateImage( "/ | ||
- | |||
- | glImgX = 0.1; | ||
- | glImgY = 0.1; | ||
- | glImgW = 0.25; | ||
- | glImgH = 0.25; | ||
- | |||
- | .... | ||
- | |||
- | glview.DrawImage(glImg, | ||
- | |||
- | ... | ||
- | |||
- | function glview_OnTouch(ev) | ||
- | { | ||
- | if(ev.action==" | ||
- | { | ||
- | if( (ev.X >= glImgX) && (ev.X <= glImgX+glImgW) && | ||
- | (ev.Y >= glImgY) && (ev.Y <= glImgY+glImgH) ) | ||
- | { | ||
- | app.ShowPopup(" | ||
- | } | ||
- | } | ||
- | }</ |