Closed varadig closed 5 years ago
Here is the extended sample:
View.hx
package;
import starling.display.*;
import starling.textures.RenderTexture;
import starling.events.*;
import starling.core.Starling;
class View extends Sprite {
private var quad:Quad;
private var renderTexture:RenderTexture;
public function new() {
super();
this.quad= new Quad(100,100,0xFF0000);
renderTexture= new RenderTexture(100,100);
var image:Image = new Image(renderTexture);
renderTexture.draw(quad);
this.addChild(image);
Starling.current.stage.addEventListener(TouchEvent.TOUCH,function(event:TouchEvent):Void{
var touch:Touch = event.getTouch(this,TouchPhase.BEGAN);
if(touch==null) return;
this.quad.x =touch.getLocation(this).x;
this.quad.y =touch.getLocation(this).y;
this.renderTexture.draw(this.quad);
});
}
}
This is working on HTML5 with the current version of Starling 2, sorry for the delay, but glad to see it working :smile:
Thre render textureing is not work properly under html5 target. On flash is working. with rendertexture.draw on touch is working I made a simple test to represent the issue:
Main.hx:
View.hx
project.xml
html5 screenshot: https://www.dropbox.com/s/i40lw6nphoxcue9/Screenshot%202018-07-20%2013.40.55.png?dl=0
flash screenshot: https://www.dropbox.com/s/kt50ixc2bgmjw74/Screenshot%202018-07-20%2013.41.24.png?dl=0