User Tools

Site Tools


built_in:glview

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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 ===== 
-<code>glview = app.CreateGLView( width, height, options );</code> 
  
-===== Methods ===== 
-Some controls use the same methods.\\ 
-For examples of the **[[same methods]]** look here. 
-^ Method                                                                                                   ^ Description  ^ 
-| GLView.CreateImage( image, options )                                                                                  | 
-| GLView.DrawImage(img, X, Y, width, height, angle)                                                        |              | 
-| GLView.SetOnTouch(callback)                                                                              |              | 
-| GLView.DrawSprite(image, srcStartX, srcStartY, srcWidth, srcHeight,destX, destY, destWidth, destHeight)  |              | 
- 
-===== 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 = app.CreateGLView( 1, 1, "Fast2d" );   
-glview.SetOnTouch(glview_OnTouch); 
- 
-glImg = glview.CreateImage( "/Sys/Img/Hello.png", StartRendering ); 
- 
-glImgX = 0.1; 
-glImgY = 0.1; 
-glImgW = 0.25; 
-glImgH = 0.25; 
- 
-.... 
- 
-glview.DrawImage(glImg, glImgX, glImgY, glImgW, glImgH, 0); 
- 
-... 
- 
-function glview_OnTouch(ev) 
-{ 
-  if(ev.action=="Up") 
-  { 
-    if( (ev.X >= glImgX) && (ev.X <= glImgX+glImgW) && 
-        (ev.Y >= glImgY) && (ev.Y <= glImgY+glImgH) ) 
-    { 
-      app.ShowPopup("glImg Touched"); 
-    } 
-  } 
-}</code> 
built_in/glview.txt · Last modified: 2016/09/02 02:49 (external edit)