cocos2d-x lua中使用协程的坑
coroutine.resume 会使用coroutine.create创建的lua_state进行执行,导致to_lua的绑定代码的L会混乱。一些回调函数的执行会破坏参数。
要使用协程,建议coroutine.create中的逻辑无任何to_lua的绑定代码执行。
coroutine.resume 会使用coroutine.create创建的lua_state进行执行,导致to_lua的绑定代码的L会混乱。一些回调函数的执行会破坏参数。
要使用协程,建议coroutine.create中的逻辑无任何to_lua的绑定代码执行。
sudo spctl --master-disable
sudo xattr -rd com.apple.quarantine /Applications/xxx.app
sudo codesign --force --deep --sign - (应用路径)
需求:自动打包文件夹下的所有图片,如果超单纹理大小,自动拆分为多个文件。
TexturePacker --multipack --texture-format png --format cocos2d --max-width 2048 --max-height 2048 --data {n}.plist --sheet {n}.png /target/rootDirOfPng
注意:rootDirOfPng不会被加入帧名,旗下的二级目录会加入。
2D 中 (C)
参考:https://www.cnblogs.com/yushuo/p/9304218.html
//点PCx,PCy到线段PAx,PAy,PBx,PBy的距离
double GetNearestDistance(double PAx, double PAy,double PBx, double PBy,double PCx, double PCy)
{
double a,b,c;
a=getDistanceBtwP(PAy,PAx,PBy,PBx);//经纬坐标系中求两点的距离公式
b=getDistanceBtwP(PBy,PBx,PCy,PCx);//经纬坐标系中求两点的距离公式
c=getDistanceBtwP(PAy,PAx,PCy,PCx);//经纬坐标系中求两点的距离公式
if(b*b>=c*c+a*a)return c;
if(c*c>=b*b+a*a)return b;
double l=(a+b+c)/2; //周长的一半
double s=sqrt(l*(l-a)*(l-b)*(l-c)); //海伦公式求面积
return 2*s/a;
}
3D 中(C#)
参考:https://www.jianshu.com/p/8ba826e6208a
public static float distancePoint2Line(Vector3 point, Vector3 linePoint1, Vector3 linePoint2)
{
float fProj = Vector3.Dot(point - linePoint1, (linePoint1 - linePoint2).normalized);
return Mathf.Sqrt((point - linePoint1).sqrMagnitude - fProj * fProj);
}
/etc/netplan/50-cloud-init.yaml
network:
version: 2
renderer: networkd
ethernets:
ens3:
addresses:
- 154.204.42.134/24
gateway4: 154.204.42.254
match:
macaddress: fa:16:3e:b9:65:3b
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
set-name: ens3
应用修改
sudo netplan apply
GList的setVirtualAndLoop之后,顺序有问题,可如下修正。但是循环滚动位置错乱的问题没有定位到原因。
void GList::removeChildrenToPool(int beginIndex, int endIndex)
{
if (endIndex < 0 || endIndex >= _children.size())
endIndex = (int)_children.size() - 1;
#if 1
// fix item order: returnToPool() use push, and getObject() use pop, the order will broken
for (int i = endIndex; i >= beginIndex; --i)
removeChildToPoolAt(i);
#else
// backup old codes
for (int i = beginIndex; i <= endIndex; ++i)
removeChildToPoolAt(beginIndex);
#endif
}
支持JS脚本插件,存放路径:
C:/Users/<USER>/AppData/Local/Tiled/extensions/
~/Library/Preferences/Tiled/extensions/
~/.config/tiled/extensions/
示例插件:https://github.com/mapeditor/tiled-extensions
官方说明: https://doc.mapeditor.org/en/stable/reference/scripting/