Core: Fix couldnt infer compound expression
This commit is contained in:
@@ -66,10 +66,6 @@ Add(&guys, {100, 100})
|
|||||||
// Error! Couldn't infer type of compound expression
|
// Error! Couldn't infer type of compound expression
|
||||||
// if Mode == 1 && colliding && IsMouseButtonPressed(MOUSE_BUTTON_LEFT) ;; MAP.CurrentMAP.actors.data[0].p = {x,y}
|
// if Mode == 1 && colliding && IsMouseButtonPressed(MOUSE_BUTTON_LEFT) ;; MAP.CurrentMAP.actors.data[0].p = {x,y}
|
||||||
|
|
||||||
// @compiler_todo: It's possible to have 2 definitions with same name. 1 global, 1 local
|
|
||||||
// Mode := 0
|
|
||||||
// main :: ()
|
|
||||||
// if IsKeyPressed(KEY_F1) ;; Mode := 0
|
|
||||||
|
|
||||||
#import "raylib.core"
|
#import "raylib.core"
|
||||||
#load "array.core"
|
#load "array.core"
|
||||||
@@ -102,6 +98,7 @@ MouseSelectionPivot: Vector2
|
|||||||
MouseSelectionBox: Rectangle
|
MouseSelectionBox: Rectangle
|
||||||
MouseSelectedActors: Array(*MAP.Actor) // @todo: ids
|
MouseSelectedActors: Array(*MAP.Actor) // @todo: ids
|
||||||
|
|
||||||
|
|
||||||
main :: (): int
|
main :: (): int
|
||||||
MAP.Init()
|
MAP.Init()
|
||||||
|
|
||||||
@@ -129,7 +126,6 @@ main :: (): int
|
|||||||
target_color.a = 255/2
|
target_color.a = 255/2
|
||||||
|
|
||||||
for !WindowShouldClose()
|
for !WindowShouldClose()
|
||||||
|
|
||||||
WinX = GetScreenWidth()
|
WinX = GetScreenWidth()
|
||||||
WinY = GetScreenHeight()
|
WinY = GetScreenHeight()
|
||||||
MouseX = GetMouseX()
|
MouseX = GetMouseX()
|
||||||
@@ -143,7 +139,7 @@ main :: (): int
|
|||||||
MouseSelecting = true
|
MouseSelecting = true
|
||||||
if IsMouseButtonPressed(MOUSE_BUTTON_LEFT)
|
if IsMouseButtonPressed(MOUSE_BUTTON_LEFT)
|
||||||
MouseSelectionPivot = MouseP
|
MouseSelectionPivot = MouseP
|
||||||
MouseSelectionBox = Rectangle{
|
MouseSelectionBox = {
|
||||||
MouseSelectionPivot.x,
|
MouseSelectionPivot.x,
|
||||||
MouseSelectionPivot.y,
|
MouseSelectionPivot.y,
|
||||||
MouseP.x - MouseSelectionPivot.x,
|
MouseP.x - MouseSelectionPivot.x,
|
||||||
@@ -176,14 +172,14 @@ main :: (): int
|
|||||||
BeginDrawing()
|
BeginDrawing()
|
||||||
ClearBackground(RAYWHITE)
|
ClearBackground(RAYWHITE)
|
||||||
|
|
||||||
map_rectangle: Rectangle = {0, 0, map.x->F32 * RectX, map.y->F32 * RectY}
|
map_rectangle := Rectangle{0, 0, map.x->F32 * RectX, map.y->F32 * RectY}
|
||||||
DrawRectangleRec(map_rectangle, LIGHTGRAY)
|
DrawRectangleRec(map_rectangle, LIGHTGRAY)
|
||||||
|
|
||||||
for x := 0, x < map.x, x += 1
|
for x := 0, x < map.x, x += 1
|
||||||
for y := 0, y < map.y, y += 1
|
for y := 0, y < map.y, y += 1
|
||||||
it := map.data + (x + y*map.x)
|
it := map.data + (x + y*map.x)
|
||||||
r: Rectangle = {x->F32 * RectX, y->F32 * RectY, RectX, RectY}
|
r := Rectangle{x->F32 * RectX, y->F32 * RectY, RectX, RectY}
|
||||||
r2: Rectangle = {r.x + 1, r.y + 1, r.width - 2, r.height - 2}
|
r2 := Rectangle{r.x + 1, r.y + 1, r.width - 2, r.height - 2}
|
||||||
|
|
||||||
colliding := CheckCollisionPointRec(MouseP, r)
|
colliding := CheckCollisionPointRec(MouseP, r)
|
||||||
color := RAYWHITE
|
color := RAYWHITE
|
||||||
@@ -195,7 +191,7 @@ main :: (): int
|
|||||||
Add(&ANI_SetTiles, {true, {x,y}})
|
Add(&ANI_SetTiles, {true, {x,y}})
|
||||||
if colliding && IsMouseButtonDown(MOUSE_BUTTON_RIGHT)
|
if colliding && IsMouseButtonDown(MOUSE_BUTTON_RIGHT)
|
||||||
Add(&ANI_SetTiles, {false, {x,y}})
|
Add(&ANI_SetTiles, {false, {x,y}})
|
||||||
if colliding == true ;; color = Color{a = 100}
|
if colliding == true ;; color = {a = 100}
|
||||||
|
|
||||||
DrawRectangleRec(r2, color)
|
DrawRectangleRec(r2, color)
|
||||||
|
|
||||||
@@ -217,7 +213,7 @@ main :: (): int
|
|||||||
wd := w - wt
|
wd := w - wt
|
||||||
hd := h - ht
|
hd := h - ht
|
||||||
|
|
||||||
r: Rectangle = {x + wd/2, y + hd/2, wt, ht}
|
r := Rectangle{x + wd/2, y + hd/2, wt, ht}
|
||||||
DrawRectangleRec(r, GRAY)
|
DrawRectangleRec(r, GRAY)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1285,7 +1285,7 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str
|
|||||||
assert(is_flag_set(node->flags, AST_STMT));
|
assert(is_flag_set(node->flags, AST_STMT));
|
||||||
Operand left = resolve_expr(node->left, AST_CANT_BE_NULL, 0, field_access_scope);
|
Operand left = resolve_expr(node->left, AST_CANT_BE_NULL, 0, field_access_scope);
|
||||||
if (!left.is_lvalue) compiler_error(node->pos, "Assigning to rvalue");
|
if (!left.is_lvalue) compiler_error(node->pos, "Assigning to rvalue");
|
||||||
Operand right = resolve_expr(node->right, AST_CANT_BE_NULL, 0, field_access_scope);
|
Operand right = resolve_expr(node->right, AST_CANT_BE_NULL, left.type, field_access_scope);
|
||||||
|
|
||||||
// @warning: Could be buggy, previously we strictly matched if types are exact
|
// @warning: Could be buggy, previously we strictly matched if types are exact
|
||||||
// need to test this with slices and stuff
|
// need to test this with slices and stuff
|
||||||
|
|||||||
Reference in New Issue
Block a user