mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 11:17:05 -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 {
|
||||
var wasChanged: bool = false;
|
||||
for(windowList.items) |window| {
|
||||
const oldPos = window.pos;
|
||||
window.updateWindowPosition();
|
||||
const newPos = window.pos;
|
||||
if(vec.lengthSquare(oldPos - newPos) >= 1e-3) {
|
||||
wasChanged = true;
|
||||
var wasChanged: bool = true;
|
||||
while(wasChanged) {
|
||||
wasChanged = false;
|
||||
for(windowList.items) |window| {
|
||||
const oldPos = window.pos;
|
||||
window.updateWindowPosition();
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user