Created
March 24, 2015 19:16
-
-
Save triplefox/a052f52b11b664cce31f to your computer and use it in GitHub Desktop.
Snippets from Urobo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Urobo, a videogame engine. Strength through self-reference. | |
* By James Walter Hofmann. | |
*/ | |
/*********** | |
ENUMS | |
***********/ | |
enum AttributeType | |
{ | |
/* core engine stuff */ | |
ATNone; | |
ATEntity; | |
ATTween; | |
ATViz; | |
ATButton; | |
ATBoxedRect; | |
ATTransform; | |
ATTextData; | |
ATVertBuf; | |
/* stuff for gameplay */ | |
ATRoom; | |
ATPiece; | |
ATMonster; | |
ATHero; | |
ATHUD; | |
} | |
enum EntityArchetype | |
{ | |
EAGeneric; | |
EAItem; | |
EAMonster; | |
EAHero; | |
} | |
/***************************** | |
DYNAMIC DATA STRUCTURES | |
*****************************/ | |
/* The entity system is designed for zero runtime allocation, or as close as I can get it. | |
We preallocate all entities. Each entity contains some number of attributes, | |
and an archetype describing the entity's purpose. | |
Entity attributes simply point towards the indexing structures containing the actual data. | |
For example, we store all the Vizibles in a single array so that we can iterate over them in one swoop. | |
An entity that wants to "contain" a Vizible spawns an attribute pointing to the desired instance. | |
As an optimization, we give most data optional backreferences to a containing entity. | |
(This adds dependencies, but is important for efficient lookups in our use case.) | |
*/ | |
class Entity | |
{ | |
public static inline var ATTRMAX = 32; | |
public var i : Int; public var z : Bool; | |
public var a : Array<Attribute>; | |
public var t : EntityArchetype; | |
public function new(i0) { i = i0; z = false; a = [for (i in 0...ATTRMAX) new Attribute(ATNone, -1)]; } | |
public function spawnAttribute(t, i) { for (a0 in this.a) { if (a0.t == ATNone) { a0.t = t; a0.i = i; return; } } | |
throw "too many attributes on entity!"; // JWH: linear search might be a factor in slow entity spawns. | |
} | |
public function concat(a0 : AttributeBuf) { for (i0 in 0...(a0.c + 1)) spawnAttribute(a0.a[i0].t, a0.a[i0].i); } | |
} | |
class Attribute { | |
public var t : AttributeType; | |
public var i : Int; /* index of attribute */ | |
public function new(t, i) { this.t = t; this.i = i; } | |
public function toString() : String { return Std.string(i) + ": " + Std.string(t); } | |
} | |
/* a buffer of attributes that we prepare in the intermediate stages of constructing entities. */ | |
/* (this may just get folded into Entity) */ | |
class AttributeBuf { | |
public var a : Array<Attribute>; | |
public var c : Int; /* current attribute */ | |
public function new() { this.a = [for (i0 in 0...Entity.ATTRMAX) new Attribute(ATNone, -1)]; this.c = 0; } | |
public function write(t, i) { if (c >= a.length) throw "overflow on AttributeBuf!"; a[c].t = t; a[c].i = i; c += 1; } | |
public function clear() { c = 0; } | |
public function concat(a0 : AttributeBuf) { for (i0 in 0...(a0.c + 1)) write(a0.a[i0].t, a0.a[i0].i); } | |
} | |
/* we use a convention of "i" as the self index position, "z" as the liveliness, "e" as the containing entity | |
* (if applicable). */ | |
class Vizible | |
{ | |
public var i : Int; public var z : Bool; public var e : Int; | |
public var v : Bool; /* visible? */ | |
public var vizi : Int; /* viz graphic index */ | |
public var vizf : Int; /* frame of graphic, or index of textdata, or index of VertBuf */ | |
public var vzrt : Int; /* viz rect */ | |
public var cnrt : Int; /* input collision rect */ | |
public var stpy : Int; /* sort priority */ | |
public var hit : Bool; /* hit */ | |
public var pass : Bool; /* passthrough hits to underlying stuff */ | |
public function new(i0) { i = i0; z = false; stpy = 0; hit = false; pass = false; vizi = 0; vizf = 0; | |
vzrt = -1; cnrt = -1; v = true; } | |
} | |
class Transform | |
{ | |
public static inline var PANIC = 10000; | |
public var i : Int; public var z : Bool; public var e : Int; | |
public var d : Point; /* the point data */ | |
public var p : Int; /* parent transform, if any (-1 if not) */ | |
public var c : Int; /* number of children remaining (refcount) */ | |
public function new(i0) { i = i0; z = false; d = new Point(); p = -1; c = 0; } | |
public function toString() { return [Std.string(i), Std.string(d), Std.string(p)].join(","); } | |
public function addChildT(t0 : Transform) { c += 1; t0.p = this.i; if (c > PANIC) doPanic(); } | |
public function addChildR(r0 : BoxedRect) { c += 1; r0.p = this.i; if (c > PANIC) doPanic(); } | |
public function doPanic():Void | |
{ | |
throw "transform has over " + Std.string(PANIC) + " children!"; | |
} | |
} | |
class BoxedRect | |
{ | |
public var i : Int; public var z : Bool; public var e : Int; | |
public var r : Rectangle; /* the rectangle data */ | |
public var p : Int; /* parent transform, if any (-1 if not) */ | |
public function new(i0) { i = i0; z = false; r = new Rectangle(); p = -1; } | |
public function toString() { return [Std.string(i), Std.string(r)].join(","); } | |
} | |
/**************************** | |
STATIC DATA STRUCTURES | |
****************************/ | |
class Sheet | |
{ | |
public var i : Int; | |
public var b : BitmapData; | |
public function new() {} | |
} | |
class Atlas | |
{ | |
public var i : Int; | |
public var s : Int; /* sheet */ | |
public var r : Rectangle; | |
public var n : String; /* name */ | |
public function new() { } | |
public function toString() { return [Std.string(i),Std.string(s),Std.string(r),n].join(","); } | |
} | |
class RectRender | |
{ | |
public var i : Int; | |
public var r : Rectangle; | |
public var f : UInt; /* foreground color */ | |
public var b : UInt; /* background color */ | |
public var n : String; /* name */ | |
public function new() {} | |
public function toString() { return [Std.string(i),Std.string(r),n].join(","); } | |
} | |
class Graphic | |
{ | |
public var i : Int; | |
public var t : GraphicType; /* which kind of asset we look up */ | |
public var f : Array<Int>; /* frames of graphic */ | |
public var n : String; /* name */ | |
public function new() {} | |
public function toString() { return [Std.string(i),Std.string(t),Std.string(f),n].join(","); } | |
} | |
/************ | |
ENGINE | |
************/ | |
class Game | |
{ | |
public static var spawnI : Int; /* the last index we spawned to - a cheap way to help hasten spawns */ | |
public static var mony : StatInt; /* money */ | |
public static var enty : Array<Entity>; /* entity */ | |
public static var pece : Array<Piece>; /* piece */ | |
public static var room : Array<Room>; /* room */ | |
public static var vizl : Array<Vizible>; /* vizible */ | |
public static var vizp : Array<Vizible>; /* vizible, priority sorted */ | |
public static var shet : Array<Sheet>; /* sheet */ | |
public static var atls : Array<Atlas>; /* atlas */ | |
public static var rctr : Array<RectRender>; /* rectrender */ | |
public static var rect : Array<BoxedRect>; /* rectangle */ | |
public static var rectI : Int; /* rectangle spawn index */ | |
public static var trfm : Array<Transform>; /* transform */ | |
public static var trfmI : Int; /* transform spawn index */ | |
public static var grhc : Array<Graphic>; /* graphic */ | |
public static var grhn : Map<String, Graphic>; /* graphic (by name) */ | |
public static var twen : Array<Tween>; /* tween */ | |
public static var txtd : Array<TextData>; /* text data */ | |
public static var txts : Array<TextStyle>; /* text style */ | |
public static var vbuf : Array<VertBuf>; /* vertex buffers */ | |
public static var vuni : Array<VertUniform>; /* vertex uniform */ | |
public static var mstr : Array<Monster>; /* monster */ | |
public static var hroe : Array<Hero>; /* hero */ | |
public static var hudy : Array<HUD>; /* HUD */ | |
public static var hud : Int; /* hud entity */ | |
public static var butn : Array<Button>; | |
public static var cameraT : Transform; /* general camera */ | |
public static var cameraTween : Tween; /* general camera tween */ | |
public static var cameraTweenFrom : Transform; /* general camera tween from */ | |
public static var cameraTweenTo : Transform; /* general camera tween to */ | |
public static var surf : BitmapData; /* draw surface */ | |
public static var sbmp : Bitmap; /* draw surface container */ | |
public static var sprt : Sprite; /* draw surface sprite */ | |
public static var tmr0 : Rectangle = new Rectangle(); /* temporary rectangle */ | |
public static var tmr1 : Rectangle = new Rectangle(); /* temporary rectangle */ | |
public static var tmp0 : Point = new Point(); /* temporary point */ | |
public static var tmp1 : Point = new Point(); /* temporary point */ | |
public static var mouse : MouseFrame; /* mouse pointer */ | |
public static var mousep : MouseFrame; /* previous mouse pointer */ | |
public static var prevT : Float; /* raw previous time */ | |
public static var curT : Float; /* raw current time */ | |
public static var dT : Float; /* raw delta time */ | |
public static inline var SIMTICK = 1000 / 20.; /* time between simulation ticks (default = 20hz) */ | |
public static var tickD : Float; /* current delay before ticking simulation */ | |
public static var curFloor : Float; /* current(topmost) dungeon floor viewed. Governs scroll. */ | |
public static inline var WIDTH = 568; | |
public static inline var HEIGHT = 320; | |
public static function start() | |
{ | |
shet = new Array(); | |
atls = new Array(); | |
rctr = new Array(); | |
txts = new Array(); | |
grhc = new Array(); | |
grhn = new Map(); | |
vuni = new Array(); | |
spawnI = 0; | |
surf = new BitmapData(WIDTH, HEIGHT, false, 0); | |
sbmp = new Bitmap(surf); | |
sprt = new Sprite(); | |
flash.Lib.current.stage.addChild(sbmp); | |
for (ev in [MouseEvent.CLICK, MouseEvent.MOUSE_MOVE, MouseEvent.MOUSE_DOWN, MouseEvent.MOUSE_UP, | |
MouseEvent.MOUSE_OUT, MouseEvent.MOUSE_WHEEL]) | |
Lib.current.stage.addEventListener(ev, onMouse); | |
for (ev in [KeyboardEvent.KEY_DOWN, KeyboardEvent.KEY_UP]) | |
Lib.current.stage.addEventListener(ev, onKey); | |
Lib.current.stage.addEventListener(Event.ENTER_FRAME, onFrame); | |
... | |
loadSheet(Assets.getBitmapData("img/jerom-fantasy-tileset-32.png"), 32, 32, | |
rn32); | |
loadGraphicAtlas(["weapon0000"], "sword"); | |
loadGraphicAtlas(["scroll0000"], "scroll"); | |
loadGraphicAtlas(["chestclosed0000"], "chestclosed"); | |
loadGraphicAtlas(["chestopen0000"], "chestopen"); | |
loadGraphicAtlas(["door0000"], "door0000"); | |
loadGraphicAtlas(["wall0000","wall0001","wall0002","wall0003"], "wall"); | |
loadGraphicAtlas(["shade0000", "shade0001", "shade0002", "shade0003", "shade0004", "shade0005", | |
"shade0006","shade0007"], "shade"); | |
loadGraphicAtlas(["floor0000"], "floor"); | |
loadGraphicAtlas(["stairdown0000"], "stairdown"); | |
loadGraphicAtlas(["npc0000"], "npc0000"); | |
loadGraphicAtlas(["hero0000"], "hero0000"); | |
loadRectRender("room0000", 64, 64, 0xFF888888, 0x88000000); | |
loadGraphicRectRender(["room0000"], "room"); | |
... | |
} | |
public static function loadGraphicAtlas(a0 : Array<String>, n0 : String) | |
{ | |
var g0 = new Graphic(); | |
g0.f = [for (name in a0) findAtlas(name)]; | |
g0.n = n0; | |
g0.t = GTAtlas; | |
_loadGraphic(g0); | |
return g0; | |
} | |
public static function reset() | |
{ | |
mony = 0; | |
enty = [for (i0 in 0...1024) new Entity(i0)]; | |
pece = [for (i0 in 0...32) new Piece(i0)]; | |
room = [for (i0 in 0...12) new Room(i0)]; | |
vizl = [for (i0 in 0...64) new Vizible(i0)]; | |
vizp = [for (v0 in vizl) v0]; | |
twen = [for (i0 in 0...64) new Tween(i0)]; | |
txtd = [for (i0 in 0...64) new TextData(i0)]; | |
vbuf = [for (i0 in 0...64) new VertBuf(i0)]; | |
mstr = [for (i0 in 0...64) new Monster(i0)]; | |
hroe = [for (i0 in 0...64) new Hero(i0)]; | |
rect = [for (i0 in 0...64) new BoxedRect(i0)]; | |
rectI = 0; | |
trfm = [for (i0 in 0...256) new Transform(i0)]; | |
trfmI = 0; | |
eevt = [for (i0 in 0...256) new EngineEvent(None, -1)]; | |
eevtc = 0; | |
butn = [for (i0 in 0...16) new Button(i0)]; | |
hudy = [for (i0 in 0...1) new HUD(i0)]; | |
mouse = new MouseFrame(); | |
mousep = new MouseFrame(); | |
prevT = Lib.getTimer(); | |
curT = Lib.getTimer(); | |
dT = 0.; | |
tickD = 0.; | |
curFloor = 0; | |
... | |
} | |
public static function genericSpawn(ar : Array<Dynamic>, fail : String) : Dynamic { | |
// tries to spawn things against a global counter - by lowering traversals, helps startup times, albeit | |
// it hurts the locality of the branchy code at runtime. | |
// we may want to replace with a counter per spawnable, Someday. | |
var i0 = 0; | |
while (i0 < ar.length) | |
{ | |
var i1 = (i0 + spawnI) % ar.length; | |
if (!ar[i1].z) { spawnI = i0 + spawnI; ar[i1].z = true; return ar[i1]; } | |
i0 += 1; | |
} | |
throw "out of "+fail+"!"; | |
} | |
public static function spawnEntity() : Entity { var e0 : Entity = genericSpawn(enty, "entities"); | |
for (a0 in e0.a) a0.t = ATNone; return e0; } | |
public static function spawnTween() : Tween { var t0 : Tween = genericSpawn(twen, "tweens"); | |
t0.twox = 0.; t0.twoy = 0.; t0.twix = 0.; t0.twiy = 0.; t0.twpx = 0.; t0.twpy = 0.; t0.smox = false; t0.smoy = false; | |
return t0; | |
} | |
public static function spawnViz() : Vizible { var v0 : Vizible = genericSpawn(vizl, "visibles"); | |
v0.v = true; v0.hit = false; v0.pass = false; v0.stpy = 999999999; v0.cnrt = -1; return v0; } | |
public static function spawnPiece() : Piece { var p0 : Piece = genericSpawn(pece, "pieces"); p0.w = -1; return p0; } | |
public static function spawnRoom() : Room { return genericSpawn(room, "rooms"); } | |
public static function spawnTextData() : TextData { return genericSpawn(txtd, "textdatas"); } | |
public static function spawnButton() : Button { var b0 : Button = genericSpawn(butn, "buttons"); | |
b0.onPush.t = None; | |
b0.onRelease.t = None; | |
b0.onOut.t = None; | |
return b0; | |
} | |
public static function spawnVertBuf() : VertBuf { var b0 : VertBuf = genericSpawn(vbuf, "vertbufs"); b0.clear(); return b0; } | |
public static function spawnMonster() : Monster { var m0 : Monster = genericSpawn(mstr, "monsters"); return m0; } | |
public static function spawnHero() : Hero { var m0 : Hero = genericSpawn(hroe, "heroes"); return m0; } | |
public static function spawnHUD() : HUD { var h0 : HUD = genericSpawn(hudy, "HUDs"); return h0; } | |
public static function spawnRectangle() : BoxedRect { | |
var i0 = 0; | |
while (i0 < rect.length) | |
{ | |
var i1 = (i0 + rectI) % rect.length; | |
if (!rect[i1].z) { rectI = i1; rect[i1].z = true; rect[i1].p = -1; return rect[i1]; } | |
i0 += 1; | |
} | |
throw "out of rectangles!"; | |
} | |
public static function attachTween(e0 : Entity, t0 : Tween) { e0.spawnAttribute(ATTween, t0.i); t0.e = e0.i; } | |
public static function attachViz(e0 : Entity, t0 : Vizible) { e0.spawnAttribute(ATViz, t0.i); t0.e = e0.i; } | |
public static function attachVertBuf(e0 : Entity, t0 : VertBuf) { e0.spawnAttribute(ATVertBuf, t0.i); } | |
public static function attachPiece(e0 : Entity, t0 : Piece) { e0.spawnAttribute(ATPiece, t0.i); t0.e = e0.i; } | |
public static function attachButton(e0 : Entity, t0 : Button) { e0.spawnAttribute(ATButton, t0.i); t0.e = e0.i; } | |
public static function attachRoom(e0 : Entity, t0 : Room) { e0.spawnAttribute(ATRoom, t0.i); t0.e = e0.i; } | |
public static function attachRectangle(e0 : Entity, t0 : BoxedRect) { e0.spawnAttribute(ATBoxedRect, t0.i); t0.e = e0.i; } | |
public static function attachTransform(e0 : Entity, t0 : Transform) { e0.spawnAttribute(ATTransform, t0.i); t0.e = e0.i; } | |
public static function attachMonster(e0 : Entity, m0 : Monster) { e0.spawnAttribute(ATMonster, m0.i); m0.e = e0.i; } | |
public static function attachHero(e0 : Entity, m0 : Hero) { e0.spawnAttribute(ATHero, m0.i); m0.e = e0.i; } | |
public static function attachHUD(e0 : Entity, h0 : HUD) { e0.spawnAttribute(ATHUD, h0.i); h0.e = e0.i; } | |
public static function attachTextData(e0 : Entity, t0 : TextData) { e0.spawnAttribute(ATTextData, t0.i); } | |
public static function attachEntity(e0 : Entity, a0 : Entity) { e0.spawnAttribute(ATEntity, a0.i); } | |
... | |
public static function spawnMonsterEnt(room : Int) : Entity | |
{ | |
var e0 = spawnEntity(); e0.t = EAMonster; | |
// rect data | |
var c0 = spawnRectangle(); | |
c0.r.width = 32; | |
c0.r.height = 32; | |
// vizible data | |
var v0 = spawnViz(); | |
var g0 = findGraphic("npc0000"); | |
v0.vizi = g0.i; | |
v0.vizf = 0; | |
v0.cnrt = c0.i; | |
v0.vzrt = c0.i; | |
v0.stpy = 10; | |
// collision transform data | |
var t0 = spawnTransform(); | |
t0.d.x = 32.; t0.d.y = 0.; | |
var t1 = spawnTransform(); | |
t1.d.x = 32.; t1.d.y = 0.; | |
var t2 = spawnTransform(); | |
t2.d.x = 32.; t2.d.y = 0.; | |
// piece data | |
var p0 = spawnPiece(); | |
p0.r = room; | |
p0.v = v0.i; | |
p0.c = c0.i; | |
// camera transform | |
cameraT.addChildR(c0); | |
// tween data | |
var w0 = spawnTween(); | |
w0.p = TTTransform; | |
w0.twd0 = t0.i; | |
w0.twd1 = t1.i; | |
w0.t = t2.i; | |
p0.w = w0.i; | |
// monster data | |
var m0 = spawnMonster(); | |
m0.hp = 3; | |
// bind entity | |
attachPiece(e0, p0); | |
attachRectangle(e0, c0); | |
attachViz(e0, v0); | |
attachTransform(e0, t0); | |
attachTransform(e0, t1); | |
attachTransform(e0, t2); | |
attachTween(e0, w0); | |
attachMonster(e0, m0); | |
syncPieceRender(p0); | |
return e0; | |
} | |
public static function entMonsterPiece(e0 : Int) { return pece[enty[e0].a[0].i]; } | |
public static function entMonsterRectangle(e0 : Int) { return rect[enty[e0].a[1].i]; } | |
public static function entMonsterViz(e0 : Int) { return vizl[enty[e0].a[2].i]; } | |
public static function entMonsterRoomPosPrev(e0 : Int) { return trfm[enty[e0].a[3].i]; } | |
public static function entMonsterRoomPos(e0 : Int) { return trfm[enty[e0].a[4].i]; } | |
public static function entMonsterRoomPosTweened(e0 : Int) { return trfm[enty[e0].a[5].i]; } | |
public static function entMonsterTween(e0 : Int) { return twen[enty[e0].a[6].i]; } | |
public static function entMonsterMonster(e0 : Int) { return mstr[enty[e0].a[7].i]; } | |
... | |
public static function despawn(e0 : Entity) | |
{ | |
e0.z = false; | |
for (a0 in e0.a) | |
{ | |
switch(a0.t) | |
{ | |
case ATNone: | |
case ATEntity: var e0 = enty[a0.i]; if (e0.z) despawn(e0); | |
case ATButton: butn[a0.i].z = false; | |
case ATPiece: pece[a0.i].z = false; | |
case ATRoom: room[a0.i].z = false; | |
case ATTween: twen[a0.i].z = false; | |
case ATViz: vizl[a0.i].z = false; | |
case ATBoxedRect: var r0 = rect[a0.i]; r0.z = false; | |
if (r0.p != -1) trfm[r0.p].c -= 1; | |
case ATTransform: var t0 = trfm[a0.i]; t0.z = false; if (t0.p != -1) trfm[t0.p].c -= 1; | |
case ATVertBuf: vbuf[a0.i].z = false; | |
case ATTextData: txtd[a0.i].z = false; | |
case ATMonster: mstr[a0.i].z = false; | |
case ATHero: hroe[a0.i].z = false; | |
case ATHUD: hudy[a0.i].z = false; | |
} | |
} | |
} | |
... | |
public static function onFrame(ev : Event) { | |
curT = Lib.getTimer(); | |
dT = curT - prevT; | |
main(); | |
prevT = curT; | |
} | |
public static function main() | |
{ | |
/* update simulation as many times as asked for */ | |
tickD -= dT; | |
while (tickD <= 0.) | |
{ | |
tickD += SIMTICK; | |
tickSimulation(); | |
clearEvents(); | |
} | |
var tweenest = 1 - (tickD / SIMTICK); | |
/* render tweens, interpolating from the previous tick into the next */ | |
for (t0 in twen) | |
{ | |
if (t0.z) | |
{ | |
switch(t0.p) | |
{ | |
case TTRectangle: | |
var v0 = rect[t0.t].r; | |
var twr0 = rect[t0.twd0].r; var twr1 = rect[t0.twd1].r; | |
var tx = lerp(t0.twox, t0.twpx, tweenest); var ty = lerp(t0.twoy, t0.twpy, tweenest); | |
if (t0.smox) tx = smootherstep(tx); | |
if (t0.smoy) ty = smootherstep(ty); | |
v0.left = lerp(twr0.left, twr1.left, tx); | |
v0.right = lerp(twr0.right, twr1.right, tx); | |
v0.bottom = lerp(twr0.bottom, twr1.bottom, ty); | |
v0.top = lerp(twr0.top, twr1.top, ty); | |
case TTTransform: | |
var v0 = trfm[t0.t].d; | |
var twp0 = trfm[t0.twd0].d; var twp1 = trfm[t0.twd1].d; | |
var tx = lerp(t0.twox, t0.twpx, tweenest); var ty = lerp(t0.twoy, t0.twpy, tweenest); | |
if (t0.smox) tx = smootherstep(tx); | |
if (t0.smoy) ty = smootherstep(ty); | |
v0.x = lerp(twp0.x, twp1.x, tx); | |
v0.y = lerp(twp0.y, twp1.y, ty); | |
} | |
} | |
} | |
} | |
/* garbage collect: update the reference counts on parent transforms that died; orphan the children */ | |
for (t0 in trfm) | |
{ | |
if (t0.z) | |
{ | |
if (t0.p != -1) | |
{ | |
if (!trfm[t0.p].z) | |
{ | |
trfm[t0.p].c -= 1; | |
trfm[t0.p].p = -1; | |
} | |
} | |
} | |
} | |
/* manual resync of piece coordinates (we may sometimes sync against the room physics, but not always) */ | |
for (p0 in pece) | |
{ | |
if (p0.z) | |
syncPieceRender(p0); | |
} | |
/* update the HUD text */ | |
renderHUD(); | |
/* clear screen */ | |
surf.fillRect(surf.rect, 0xFF882222); | |
/* draw vizibles */ | |
ArraySort.sort(vizp,sortViz); | |
for (v0 in vizp) | |
{ | |
if (v0.z && v0.v) | |
draw(v0); | |
} | |
/* flush input */ | |
mousep.x = mouse.x; | |
mousep.y = mouse.y; | |
mousep.down = mouse.down; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment