mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-13 14:27:14 -04:00
Replace tail call recursion in gui.zig with a standard while loop.
This brings us one tiny step closer to overlapping with the set of supported features of the x86 backend.
This commit is contained in:
parent
4bdf1240b8
commit
39fe3bd1a7
@ -505,16 +505,18 @@ pub fn secondaryButtonReleased() void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn updateWindowPositions() void {
|
pub fn updateWindowPositions() void {
|
||||||
var wasChanged: bool = false;
|
var wasChanged: bool = true;
|
||||||
for(windowList.items) |window| {
|
while(wasChanged) {
|
||||||
const oldPos = window.pos;
|
wasChanged = false;
|
||||||
window.updateWindowPosition();
|
for(windowList.items) |window| {
|
||||||
const newPos = window.pos;
|
const oldPos = window.pos;
|
||||||
if(vec.lengthSquare(oldPos - newPos) >= 1e-3) {
|
window.updateWindowPosition();
|
||||||
wasChanged = true;
|
const newPos = window.pos;
|
||||||
|
if(vec.lengthSquare(oldPos - newPos) >= 1e-3) {
|
||||||
|
wasChanged = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(wasChanged) @call(.always_tail, updateWindowPositions, .{}); // Very efficient O(n²) algorithm :P
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn updateAndRenderGui() void {
|
pub fn updateAndRenderGui() void {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user