the-world-engine
Version:
three.js based, unity like game engine for browser
27 lines (26 loc) • 591 B
JavaScript
import { b2MakeArray } from "./b2_settings.js";
export class b2GrowableStack {
constructor(t) {
this.m_stack = [];
this.m_count = 0;
this.m_stack = b2MakeArray(t, (t => null));
this.m_count = 0;
}
Reset() {
this.m_count = 0;
return this;
}
Push(t) {
this.m_stack[this.m_count] = t;
this.m_count++;
}
Pop() {
this.m_count--;
const t = this.m_stack[this.m_count];
this.m_stack[this.m_count] = null;
return t;
}
GetCount() {
return this.m_count;
}
}