This commit is contained in:
nub31
2025-09-28 22:53:09 +02:00
parent c489f23c41
commit 48a2dc0ee7
2 changed files with 13 additions and 3 deletions

View File

@@ -427,7 +427,7 @@ public sealed class TypeChecker
case BinaryOperatorSyntax.LogicalOr:
{
var left = CheckExpression(expression.Left);
if (left.Type is not NubIntType or NubFloatType)
if (left.Type is not NubIntType and not NubFloatType)
{
throw new TypeCheckerException(Diagnostic.Error("Logical operators must must be used with int or float types").At(expression.Left).Build());
}
@@ -453,7 +453,7 @@ public sealed class TypeChecker
case BinaryOperatorSyntax.Modulo:
{
var left = CheckExpression(expression.Left);
if (left.Type is not NubIntType or NubFloatType)
if (left.Type is not NubIntType and not NubFloatType)
{
throw new TypeCheckerException(Diagnostic.Error("Math operators must be used with int or float types").At(expression.Left).Build());
}
@@ -492,7 +492,7 @@ public sealed class TypeChecker
case UnaryOperatorSyntax.Negate:
{
var operand = CheckExpression(expression.Operand);
if (operand.Type is not NubIntType { Signed: false } or NubFloatType)
if (operand.Type is not NubIntType { Signed: false } and not NubFloatType)
{
throw new TypeCheckerException(Diagnostic.Error("Negation operator must be used with signed integer or float types").At(expression).Build());
}

View File

@@ -28,6 +28,16 @@ extern "main" func main(args: []cstring): i64
}
raylib::EndDrawing()
if x + width > raylib::GetScreenWidth()
{
direction.x = -direction.x
}
if y + height > raylib::GetScreenHeight()
{
direction.y = -direction.y
}
x = x + @floatToInt(i32, direction.x)
y = y + @floatToInt(i32, direction.y)
}