Godot 中的使用 Lambda

static struct AAA {
	static void foo(bool some_val)  {
		if (some_val) {
		    print_line("bar called true", some_val);
		} else {
		    print_line("bar called false", some_val);
		}
	}
	static void bar()  {
		print_line("bar called");
	}
};
button1->connect("toggled", callable_mp_static(&AAA::foo));
button2->connect("pressed", callable_mp_static(&AAA::bar));

Godot 中使用 函数指针

// core/io/image.h
static void (*_image_compress_bc_func)(Image *, UsedChannels p_channels);
static void (*_image_compress_bptc_func)(Image *, UsedChannels p_channels);
static void (*_image_compress_etc1_func)(Image *);
static void (*_image_compress_etc2_func)(Image *, UsedChannels p_channels);
static void (*_image_compress_astc_func)(Image *, ASTCFormat p_format);

函数指针