代码之家  ›  专栏  ›  技术社区  ›  Fgblanch

在MT4J中更改场景的背景色而不清除

  •  0
  • Fgblanch  · 技术社区  · 15 年前

    我在MT4J MultTouple Java库的例子中,在“Advest.Digice”示例中,我试图改变绘制场景的背景颜色。因为它已将setclear设置为false,所以我无法使用clearcolor选项进行此操作。还有其他想法吗?谢谢

    1 回复  |  直到 15 年前
        1
  •  0
  •   Fgblanch    15 年前

    在Nuigroup论坛的帮助下,我找到了一种方法。可以添加具有填充颜色的mtrectangle,然后将绘图示例的scenetexture添加到该矩形。我把这段代码作为参考:

    final MTSceneTexture sceneTexture = new MTSceneTexture(mtApplication,0, 0, mtApplication.width, mtApplication.height, drawingScene);
        sceneTexture.getFbo().clear(true, 255, 255, 255, 0, true);        
        sceneTexture.setStrokeColor(new MTColor(155,155,155));
    
        //Background
        MTRectangle background = new MTRectangle(0,0,mtApplication.width, mtApplication.height , mtApplication);
        background.setFillColor(new MTColor(255,244,150,255));
    
        //Add the scene texture as a child of the background rectangle so the scene texture is drawn in front
        background.addChild(sceneTexture);
        frame.addChild(background);