Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 88851

用Canvas绘制的方式在原生平台上不适用吗?望大神指教

$
0
0

@657373877 写道:

基于canvas绘制图形的方式只支持于web平台,有什么替代方案能够支持原生平台的绘制吗?cc.Graphics貌似支持的不完善..
HTMLCanvasElement、CanvasRenderingContext2D等都不适用于native平台,望大神指教下

this.spriteCanvas = document.createElement("canvas");
this.spriteCanvas.width = this.canvas.width;
this.spriteCanvas.height = this.canvas.height;
this.spriteContext = this.spriteCanvas.getContext('2d');
this.spriteTexture = new cc.Texture2D();
this.spriteTexture.releaseTexture();
this.spriteTexture.initWithElement(this.spriteCanvas);
this.spriteTexture.handleLoadedTexture();
this.sprite.spriteFrame = new cc.SpriteFrame(this.spriteTexture);

帖子: 7

参与者: 1

阅读整个主题


Viewing all articles
Browse latest Browse all 88851

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>