分类目录归档:Haxe

HXCPP

Table of Contents

1. Build
2. Metas
3. build.Xml

3.1. ${var} 支持下边前缀
3.2. Print Information and Error Handling
3.3. Define Variables
3.4. Conditional Attributes

3.4.1. if
3.4.2. unless
3.4.3. IfExists

3.5. Grouping Configurations and Including[......]

Read more

Neko多线程

Table of Contents

1. 创建线程
2. 消息共享与堵塞

2.1. readMessage
2.2. Deque
2.3. 自定义共享数据类型

1 创建线程

var t1 = Thread.create(sendMsgs);
var t2 = Thread.create(getMsgs);

create后立即执行,且与主线程时序无关

2 消息共享与堵塞

2.1 readMessage[......]

Read more

Haxe CFFI

Table of Contents

1. 简述
2. cpp端

2.1. 编写
2.2. 编译为ndll

3. haxe端

1 简述

cffi全称 C Foreign Function Interface,相当于jni之于java

2 cpp端

2.1 编写

需要在头部加上
#define IMPLEMENT_API
#include <hx/CFFI.h>

若希望支持[......]

Read more

Haxe Metadata

Table of Contents

1. Compiler Metadata

1.1. General metadata

1.1.1. @:require(xxx)
1.1.2. @:final
1.1.3. @:hack
1.1.4. @:native("my.real.Path")
1.1.5. @:coreApi
1.1.6. @:fakeEnum(Type)
1.1.7. @:macro and @:build
1.1.8. @:k[......]

Read more

Haxe毛刺解决记录

1、target flash时外部加载后显示100%进度条
解决:编辑ApplicationMain(old)或lime.app.Preloader(new),添加
update (Lib.current.loaderInfo.bytesLoaded, Lib.current.loaderInfo.bytesTotal);
if (Lib.current.loaderInfo.bytesLoaded >= Lib.current.loaderInfo.bytesTotal) {[......]

Read more

Haxe宏函数

Haxe宏方法是一种特殊方法,它的生命周期处于且仅处于编译期。

包含宏的代码编译分三个阶段,首先根据有效代码生成Abstract Syntax Tree,然后找到宏方法并执行(会执行上下文中相关的代码,所以需要将宏方法隔离),最后宏方法变成haxe代码。

在宏方法中,所有对象都是Expr,加macro关键字可以使得表达式不立即执行,而是作为结果代码置入目标位置,该表达式不能直接与任何外部变量交互,类似lisp的',传入的变量必须以Context.makeExpr(x, Context.cur[......]

Read more

Haxe抽象类

haxe中的抽象类是可以被实例化的,它更像一个已有类的包装,用于重载被包装类的赋值、取值、操作符等 例如:

//被包装类为Array<String> @:from对应的方法生成的结果赋值给该类的实例
abstract StringSplitter(Array<String>) {
inline function new(a:Array<String>)
this = a;

@:from static p[......]

Read more