Skip to content

Instantly share code, notes, and snippets.

@RafaelOliveira
Created January 9, 2017 15:16
Show Gist options
  • Save RafaelOliveira/dce7f8af5d82ec105ef523ce624a0689 to your computer and use it in GitHub Desktop.
Save RafaelOliveira/dce7f8af5d82ec105ef523ce624a0689 to your computer and use it in GitHub Desktop.
structInit
package;
import kha.Framebuffer;
import kha.Scheduler;
import kha.System;
import kha.Image;
@:enum
abstract T0(Int) {
var a = 0;
var b = 0;
var c = 0;
}
@:structInit
class T1 {
private var _image:Image;
private var _test:T0;
private var _t2:T2;
public inline function new(image:Image, test:T0, t2:T2) {
_image = image;
_test = test;
if(t2 == null) _t2 = {image: null, num: 0};
else _t2 = t2;
}
}
@:structInit
class T2 {
private var _image:Image;
private var _num:Int;
public inline function new(image:Image, num:Int = 0) {
_image = image;
_num = num;
}
}
class Project {
public function new() {
System.notifyOnRender(render);
Scheduler.addTimeTask(update, 0, 1 / 60);
var t1:T1 = {
image: null,
test: T0.a,
t2: {image: null}
}
}
function update(): Void {
}
function render(framebuffer: Framebuffer): Void {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment