Osx App Bundle Resource Path

简介 用于在OSX的.app程序中得到Resources文件夹的绝对路径,来正确载入资源文件 只需链接CoreFoundation即可,代码来自SFML论坛[0] 代码 #if defined(__APPLE__) #include <CoreFoundation/CoreFoundation.h> #endif std::string ResourcePath() { #if defined(__APPLE__) CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef resourcesURL...

Creating a Cylinder

简介 使用代码生成圆柱体,可用来表示Spot Light的凸包围体 当圆柱体的某一端闭合时,会产生重复顶点。 可参考Assimp[0]的做法,来剔除潜在重复顶点。 实现 void CreateCylinder(const std::string &name, float topR, float bottomR, float height, int segH, int segV)...

Simple Gradiant Script For Unity

简介 用于Unity的UI的简易渐变效果脚本 支持渐变方向选择,支持单独设置Alpha using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; public class Gradiant : BaseVertexEffect { public Color32 from...

Perfect Forwarding And Piecewise Construct

简介 完美转发与分段构造用例 #include <map> #include <functional> #include <typeinfo> #include <typeindex> #include <iostream> class MyClass { public: int a; int b;...

Unity Console

用法 输入一段类似下面的命令: Namespace.Class.Method(10, 12.5, true, "hello there") 按下回车键两次。 若运行时存在这个类型,并且存在这个需要上述参数的函数。 程序就会调用这个函数,并且将函数的返回值打印出来。 该系统有简单的错误判断机制,若分析过程中出现错误的语法,会抛出异常。 实现 通过Lexer.Analysis得到词语列表: List<Token> tokens = Lexer.Analysis(cmd); 接下来,将词语列表传入语法分析器中,将得到三个输出数据: 完整的类型名称 函数名称...