iop520p 2015-07-09 10:07 采纳率: 0%
浏览 1944

cocostudio导出的按钮响应的位置会偏左

最近在研究用cocostudio生成ui界面,但是生成的按钮响应位置在按钮图标的右边,百度无果,改界面framesize也没有效果。
想不通是什么原因。用的是cocos2d-x3.6 和cocostudio1.5.
下面是场景init函数的实现,回调的就是结束按钮。

 if (!Layer::init())
    {
        return false;
    }

    cocos2d::ui::Widget* layout = cocostudio::GUIReader::getInstance()->widgetFromJsonFile("MeanMenu_1.json");
    this->addChild(layout);

    Button *Close_Button = (Button*)(ui::Helper::seekWidgetByName(layout, "Close_Butten"));
    Close_Button->addTouchEventListener(this, toucheventselector(HelloWorld::menuCloseCallback));

然后是生成的json文件参数

 {
  "classname": null,
  "name": null,
  "animation": {
    "classname": null,
    "name": "AnimationManager",
    "actionlist": []
  },
  "dataScale": 1,
  "designHeight": 626,
  "designWidth": 900,
  "textures": [],
  "texturesPng": [
    "素材/01f404554c2e040000007cc228c84e.jpg",
    "Resources/CloseSelected.png",
    "Resources/CloseNormal.png"
  ],
  "version": "1.5.0.0",
  "widgetTree": {
    "classname": "Panel",
    "name": null,
    "children": [
      {
        "classname": "Button",
        "name": null,
        "children": [],
        "options": {
          "__type": "ButtonSurrogate:#EditorCommon.JsonModel.Component.GUI",
          "classname": "Button",
          "name": "Close_Butten",
          "ZOrder": 1,
          "actiontag": 55960646,
          "anchorPointX": 1,
          "anchorPointY": 0.5,
          "classType": "CocoStudio.EngineAdapterWrap.CSButton",
          "colorB": 255,
          "colorG": 255,
          "colorR": 255,
          "customProperty": "",
          "flipX": false,
          "flipY": false,
          "height": 40,
          "ignoreSize": true,
          "layoutParameter": null,
          "opacity": 255,
          "positionPercentX": 0.50444454,
          "positionPercentY": 0.23322688,
          "positionType": 0,
          "rotation": 0,
          "scaleX": 1,
          "scaleY": 1,
          "sizePercentX": 0.114444442,
          "sizePercentY": 0.0638977662,
          "sizeType": 0,
          "tag": 41,
          "touchAble": true,
          "useMergedTexture": false,
          "visible": true,
          "width": 40,
          "x": 454,
          "y": 146,
          "capInsetsHeight": 1,
          "capInsetsWidth": 1,
          "capInsetsX": 0,
          "capInsetsY": 0,
          "disabled": null,
          "disabledData": {
            "path": null,
            "plistFile": null,
            "resourceType": 0
          },
          "fontName": "微软雅黑",
          "fontSize": 14,
          "fontType": 0,
          "normal": null,
          "normalData": {
            "path": "Resources/CloseSelected.png",
            "plistFile": "",
            "resourceType": 0
          },
          "pressed": null,
          "pressedData": {
            "path": "Resources/CloseNormal.png",
            "plistFile": "",
            "resourceType": 0
          },
          "scale9Enable": false,
          "scale9Height": 40,
          "scale9Width": 40,
          "text": "",
          "textColorB": 255,
          "textColorG": 255,
          "textColorR": 255
        }
      }
    ],
    "options": {
      "__type": "PanelSurrogate:#EditorCommon.JsonModel.Component.GUI",
      "classname": "Panel",
      "name": "Panel_18",
      "ZOrder": 0,
      "actiontag": -1,
      "anchorPointX": 0,
      "anchorPointY": 0,
      "classType": "CocoStudio.EngineAdapterWrap.CSPanel",
      "colorB": 255,
      "colorG": 255,
      "colorR": 255,
      "customProperty": "",
      "flipX": false,
      "flipY": false,
      "height": 626,
      "ignoreSize": false,
      "layoutParameter": null,
      "opacity": 255,
      "positionPercentX": 0,
      "positionPercentY": 0,
      "positionType": 0,
      "rotation": 0,
      "scaleX": 1,
      "scaleY": 1,
      "sizePercentX": 1,
      "sizePercentY": 1,
      "sizeType": 0,
      "tag": 33,
      "touchAble": false,
      "useMergedTexture": false,
      "visible": true,
      "width": 900,
      "x": 0,
      "y": 0,
      "adaptScreen": false,
      "backGroundImage": null,
      "backGroundImageData": {
        "path": "素材/01f404554c2e040000007cc228c84e.jpg",
        "plistFile": "",
        "resourceType": 0
      },
      "backGroundScale9Enable": false,
      "bgColorB": 255,
      "bgColorG": 200,
      "bgColorOpacity": 0,
      "bgColorR": 150,
      "bgEndColorB": 255,
      "bgEndColorG": 200,
      "bgEndColorR": 150,
      "bgStartColorB": 255,
      "bgStartColorG": 255,
      "bgStartColorR": 255,
      "capInsetsHeight": 1,
      "capInsetsWidth": 1,
      "capInsetsX": 0,
      "capInsetsY": 0,
      "clipAble": false,
      "colorType": 1,
      "layoutType": 0,
      "vectorX": 0,
      "vectorY": -0.5
    }
  }
}

有大神能帮忙看看到底是什么问题

  • 写回答

2条回答 默认 最新

  • iop520p 2015-07-09 12:07
    关注

    我找到问题所在了,是没有调整好窗口分辨率,因为分辨率太大导致错位

    评论

报告相同问题?

悬赏问题

  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名