UI windows

This commit is contained in:
2024-12-29 19:14:10 +01:00
parent e80843c9de
commit 4ac24fa03c
4 changed files with 68 additions and 9 deletions

View File

@@ -231,14 +231,14 @@ smooth_damp :: (current: float, target: float, current_velocity: *float, smooth_
change = clamp(change, -max_change, max_change);
target = current - change;
temp := (<<current_velocity + omega * change) * delta_time;
<<current_velocity = (<<current_velocity - omega * temp) * exp;
temp := (current_velocity.* + omega * change) * delta_time;
current_velocity.* = (current_velocity.* - omega * temp) * exp;
output := target + (change + temp) * exp;
// Prevent overshooting
if (original_to - current > 0.0) == (output > original_to) {
output = original_to;
<<current_velocity = (output - original_to) / delta_time;
current_velocity.* = (output - original_to) / delta_time;
}
return output;

View File

@@ -39,8 +39,8 @@ parray_add :: (using parray: *PArray, value: parray.Data_Type) -> parray.Handle_
// find the next empty index
for *val, i: indices {
if <<val == 0 {
<<val = index;
if val.* == 0 {
val.* = index;
handle = cast(Handle_Type)i + 1;
break;
}
@@ -66,8 +66,8 @@ parray_remove :: (using parray: *PArray, handle: parray.Handle_Type) {
data[index] = data[data.count-1];
for * indices {
if <<it == data.count {
<<it = index + 1;
if it.* == data.count {
it.* = index + 1;
break;
}
}
@@ -80,7 +80,7 @@ for_expansion :: (parray: *PArray, body: Code, flags: For_Flags) #expand {
#if flags & .POINTER {
`it := value;
} else {
`it := <<value;
`it := value.*;
}
#insert body;
}