如何用纯代码生成一个纯色的sprite

想用代码生成一个纯白的sprite。翻了下代码,似乎没有可用的方法??

/**

  • Create a sprite with image path or frame name or texture or spriteFrame.
  • @constructs
  • @param {String|cc.Texture2D|cc.SpriteFrame} fileName The string which indicates a path to image file, e.g., “scene1/monster.png”.
  • @param {cc.Rect} rect Only the contents inside rect of pszFileName’s texture will be applied for this sprite.
  • @return {cc.Sprite} A valid sprite object
  • @example
  • 1.Create a sprite with image path and rect
  • var sprite1 = cc.Sprite.create(“res/HelloHTML5World.png”);
  • var sprite2 = cc.Sprite.create(“res/HelloHTML5World.png”,cc.rect(0,0,480,320));
  • 2.Create a sprite with a sprite frame name. Must add “#” before frame name.
  • var sprite = cc.Sprite.create(’#grossini_dance_01.png’);
  • 3.Create a sprite with a sprite frame
  • var spriteFrame = cc.spriteFrameCache.getSpriteFrame(“grossini_dance_01.png”);
  • var sprite = cc.Sprite.create(spriteFrame);
  • 4.Create a sprite with an exsiting texture contained in a CCTexture2D object
  •  After creation, the rect will be the size of the texture, and the offset will be (0,0).
    
  • var texture = cc.textureCache.addImage(“HelloHTML5World.png”);
  • var sprite1 = cc.Sprite.create(texture);
  • var sprite2 = cc.Sprite.create(texture, cc.rect(0,0,480,320));

*/

说下需求吧,就是《 别踩白块》 的菜单场景。只有简单的黑白方块,没有必要再去弄个图片加载进来。
刚接触 js版本,求实现

找到了 setTextureRect

你也可以用cc.draw直接画上。js-test 里面有例子

不错好用 谢谢