Core Compiler: Fix type incomplete polymorph, work on RTS
This commit is contained in:
@@ -71,51 +71,24 @@ Add(&guys, {100, 100})
|
||||
|
||||
|
||||
#import "raylib.core"
|
||||
MA :: #import "Arena.core"
|
||||
#load "array.core"
|
||||
#load "map.core"
|
||||
|
||||
V2I :: struct
|
||||
x: int
|
||||
y: int
|
||||
|
||||
Map_Tile :: int
|
||||
Map :: struct
|
||||
data: *Map_Tile
|
||||
x: int
|
||||
y: int
|
||||
|
||||
Actor :: struct
|
||||
p: V2I
|
||||
target_p: V2I
|
||||
|
||||
WinX := 1280
|
||||
WinY := 720
|
||||
|
||||
MouseX := 0
|
||||
MouseY := 0
|
||||
MouseP: Vector2
|
||||
|
||||
Mode := 0
|
||||
RectX :: 16
|
||||
RectY :: 16
|
||||
|
||||
GuyP: V2I
|
||||
|
||||
main :: (): int
|
||||
|
||||
|
||||
MAP_X :: 60
|
||||
MAP_Y :: 40
|
||||
map_data: [MAP_X*MAP_Y]int
|
||||
map: Map = {data = &map_data[0], x = MAP_X, y = MAP_Y}
|
||||
|
||||
actors: Array(Actor)
|
||||
Reserve(&actors, 4)
|
||||
|
||||
Add(&actors, {{4, 4}, {8, 8}})
|
||||
Assert(Contains(&actors, actors.data) == true)
|
||||
OrderedRemove(&actors, actors.data)
|
||||
Assert(Contains(&actors, actors.data) == false)
|
||||
MAP_Init()
|
||||
|
||||
// InitAudioDevice()
|
||||
// sound := LoadSound("catune - Pass the town, and to the C.mp3")
|
||||
@@ -138,6 +111,8 @@ main :: (): int
|
||||
BeginDrawing()
|
||||
ClearBackground(RAYWHITE)
|
||||
|
||||
|
||||
map := &MAP_CurrentMap
|
||||
for x := 0, x < map.x, x += 1
|
||||
for y := 0, y < map.y, y += 1
|
||||
it := map.data + (x + y*map.x)
|
||||
@@ -147,7 +122,7 @@ main :: (): int
|
||||
colliding := CheckCollisionPointRec(MouseP, r)
|
||||
|
||||
if Mode == 0 && colliding && IsMouseButtonDown(MOUSE_BUTTON_LEFT) ;; *it = 1
|
||||
if Mode == 0 && colliding && IsMouseButtonPressed(MOUSE_BUTTON_RIGHT) ;; GuyP = V2I{x,y}
|
||||
// if Mode == 0 && colliding && IsMouseButtonPressed(MOUSE_BUTTON_RIGHT) ;; GuyP = V2I{x,y}
|
||||
|
||||
color := GREEN
|
||||
if *it == 1 ;; color = RED
|
||||
@@ -155,8 +130,8 @@ main :: (): int
|
||||
|
||||
DrawRectangleRec(r2, color)
|
||||
|
||||
for i := 0, i < actors.len, i += 1
|
||||
it := actors.data + i
|
||||
for i := 0, i < map.actors.len, i += 1
|
||||
it := map.actors.data + i
|
||||
r := Rectangle{it.p.x->F32 * RectX, it.p.y->F32 * RectY, RectX, RectY}
|
||||
target_r := Rectangle{it.target_p.x->F32 * RectX, it.target_p.y->F32 * RectY, RectX, RectY}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user