Giter VIP home page Giter VIP logo

cocostudio-ui-libgdx's Introduction

让CocoStudio变成libgdx的UI编辑器

##交流Q群:341972448

###移植案例,更多请看WIKI!

###目前已知还存在的问题

  • 只支持绝对布局,其他布局也不打算支持.
  • 对ScrollPane的属性不是很了解,所以回弹属性存在问题,如果设置不回弹则无法拖拽.滚动区域的设置也无效
  • 部分控件的裁剪属性无效,例如ScrollPane
  • LoadingBar的实现只是个Image
  • Panel的渐变色不了解.目前不支持
  • 复选框在cocostudio里面最起码得有2个属性,底图资源和选中资源.是控制选中资源是否显示.但是在libgdx里面则是选中和未选中2个图片.是控制两个图片显示哪个.
  • 滑动条,数字标签,列表容器,翻动页面 这4个控件还未支持.
  • 动作编辑器编辑出来的效果比编辑器里面看到的效果运行得慢,不清楚是否正常?还没去确定这事.动作编辑器的功能还没去具体测试各项功能.
  • TextField使用ttf 还存在一些问题,另外如果设置了锚点大于0 位置会产生偏差,还未确定原因.

###更新记录

2014.2.12

  • 更新demo.zip,展示了如何使用CocoStudioUIEditor 创建一个界面,如何获取控件 添加事件.

2014.2.13

  • 整合的Demo项目,内有多种使用场景和案例,后续也会继续更新demo.
  • 处理了UIEditor 的一些BUG.
  • 添加了ScrollPane 支持
  • 添加问答wiki
  • 添加CheckBox支持,CheckBox只有选中和未选中2个图片.
  • 修复了锚点问题,现在坐标已经能完全对齐
  • 修复渲染层级问题,能正常的根据渲染层级进行zindex排序
  • 暂时去掉了Touchable属性,还没能很好解决不同控件覆盖事件传递等问题
  • 修改了demo项目,按任意键来切换查看不同场景
  • 移植了 UI编辑器示例项目:DemoHead_UI,DemoLogin,DemoMap,DemoShop,SampleChangeEquip. 部分项目还未完全移植成功
  • 修复了TextField的MessageText属性

2014.2.14

  • 添加了动画模式的解析,增加了对应demo SampleUIAnimation,但是还不清楚为什么实际动作比编辑器里面看到的动作慢半拍.
  • 重构了代码
  • 添加了LoadingBar控件,暂时使用Image代替实现...也就是说LoadingBar就是一个图片.仅此而已.
  • CocoStuido的全部Demo移植完毕.一共6个.

2014.2.15

  • 修复Touchable属性
  • 修复渲染层级问题
  • 修复字体颜色问题
  • Panel添加填充颜色属性,不支持渐变色

2014.2.18

  • 修改WidgetParser 下父控件与子控件的属性关系

2014.3.2

  • 修复Label位置问题 以及使用ttf字体 修改Text 显示不了文字问题.TextField也是使用ttf字体 也会同样的这种问题,还未修复
  • 添加默认字体参数,当找不到字体.例如微软雅黑,就去尝试使用默认字体创建文本.
  • CCLabel的实现采用TTFLabel继承了libgdx的Label,只是添加了字体大小等属性
  • CCPanel的背景图片图纸恢复成为剧中显示而不是平铺,与编辑器显示保持一致,避免因为图片大小和Panel大小不一致产生错误的错觉.

2014.3.3

  • @爆发的妞 提供.9图片支持

2014.3.4

  • 修复CheckBox显示问题

2014.3.4

  • wiki添加重写/添加控件实现的方法
  • 添加数字标签控件的实现,目前只支持0-9的数字,首字符设置也无效.
  • 包重命名

2014.3.14

  • 修正Label标签文本对齐错误

2014.6.27

  • @xiaozc 提供读取资源文件兼容方式.

2015.2.14

  • 上传cocostudio-ui-libgdx2 项目. 这个项目是针对cocostudio v2.1版本的ui解析库. cocostudio-ui-libgdx 项目对应编辑器v1.x 版本.目前最新的为v1.6

为什么会有这个新项目.原因:编辑器1.x不再维护,并且本人在使用v1.6版本的时候遇到了一个莫名其妙又无法解决的bug.并且编辑器v2.1版本支持导出json格式的ui结构.

cocostudio-ui-libgdx2和前一版本使用方法一致,部分细节可能会有不同.

2版本新特性: 增加了新控件! CCLayer = LayerObjectData = Group CCNode = SingleNodeObjectData = Group CCSpriteView = SpriteObjectData = Image

支持回调函数! 在编辑器的高级属性-回调特性里面 当设置通过Click方式或者Touch方式回调某个函数的时候. 会在控件加上 监听器 去回调对应方法. 注意.回调方法必须写着控件所在的 Stage 上,并且方法名称一致并且不带参数(目前为了极致简化不传参)

如果编辑器方法名那里不填,会默认调用控件名称同名的方法!.例如的看下回调实现就应该能理解了. @see BaseWidgetParser.addCallback

目前已知的问题: 1.锚点无效问题,这个似乎是编辑器原因. 因为锚点在编辑器里面表现就是有问题的.

cocostudio-ui-libgdx's People

Contributors

121077313 avatar htynkn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cocostudio-ui-libgdx's Issues

TTFLabel的setText 有严重性能问题

解决方案已有:
package org.freyja.libgdx.cocostudio.ui.widget;

import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import org.freyja.libgdx.cocostudio.ui.util.FontUtil;

import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.scenes.scene2d.ui.Label;

/**

  • 让Label支持TTF,使用ttf后Label的font不会发生变化,每次修改Text的时候重新创建font

  • @author i see

  • */
    public class TTFLabel extends Label {

    public TTFLabel(CharSequence text, TTFLabelStyle ttfLabelStyle) {
    super(text, ttfLabelStyle);
    LabelStyle style = getStyle();
    style.font = createFont((TTFLabelStyle) style, FreeTypeFontGenerator.DEFAULT_CHARS);
    super.setStyle(style);
    }

    public int labelAlign;

    public int lineAlign;

    @OverRide
    public void setAlignment(int labelAlign, int lineAlign) {
    this.labelAlign = labelAlign;
    this.lineAlign = lineAlign;
    super.setAlignment(labelAlign, lineAlign);
    }

    @OverRide
    public void setStyle(LabelStyle style) {
    style.font = createFont((TTFLabelStyle) style, "" + getText());

    super.setStyle(style);
    

    }

    BitmapFont createFont(TTFLabelStyle ttfStyle, String text) {
    return FontUtil.createFont(ttfStyle.getFontFileHandle(), text,
    ttfStyle.getFontSize());
    }
    }

Maybe change language?

Hello, the project looks very interesting and promising (judging by the screenshots...). I would like to use it (and contribute, if I am able to), however, being the project in the language it is (what is it btw? japanese? chinese? not aware of how to tell apart different asian languages :P) many people will find it hard to use.

I would suggest moving it to english, which is quite the standard in the IT world

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.