This commit is contained in:
Krzosa Karol
2023-04-14 21:13:38 +02:00
parent 542f2e0297
commit fdcdc8ea86
4 changed files with 14 additions and 4 deletions

1
.gitignore vendored
View File

@@ -20,3 +20,4 @@ backup*
start.bat
__pycache__
build/examples/arms_race
raylib.py

View File

@@ -5,5 +5,5 @@ bld --dont_compile_core
cd build
core_main.exe examples/game2d.core
bld --dont_compile_core --link=vendor/raylib/windows/raylibdll.lib
rem a.exe
rem build\generated_main.exe
cd ..

View File

@@ -61,6 +61,9 @@ Add :: (a: *Array($T), item: T)
a.data = realloc(a.data, SizeOf(T) * a.cap->U64)
a.data[a.len++] = item
Memes :: (a: S32, ...)
pass
main :: (): int
guys: Array(Guy)
Add(&guys, {pos = {100, 100}})
@@ -69,6 +72,7 @@ main :: (): int
SetTargetFPS(60)
for !WindowShouldClose()
Y := GetScreenHeight()
g := guys.data
if IsKeyDown(KEY_W);; g.pos.y -= 2
if IsKeyDown(KEY_S);; g.pos.y += 2
@@ -77,8 +81,10 @@ main :: (): int
BeginDrawing()
ClearBackground({100})
ClearBackground(RAYWHITE)
DrawFPS(0, 0)
DrawText("Testing and stuff", 100, 100, 20, RAYWHITE)
DrawCube({0,0,0}, 10, 10, 10, BLACK)
for i := 0, i < guys.len, i += 1
it := guys.data + i
DrawCircleV(it.pos, 16, MAROON)

View File

@@ -14,10 +14,13 @@ ClearBackground :: #foreign (color: Color)
DrawCircle :: #foreign (centerX: int, centerY: int, radius: F32, color: Color)
DrawCircleV :: #foreign (center: Vector2, radius: F32, color: Color)
DrawCube :: #foreign (position: Vector3, width: F32, height: F32, length: F32, color: Color)
DrawFPS :: #foreign (posX: int, posY: int)
DrawText :: #foreign (text: *char, posX: int, posY: int, fontSize: int, color: Color)
GetScreenWidth :: #foreign (): int
GetScreenHeight :: #foreign (): int
IsKeyDown :: #foreign (key: int): Bool
IsKeyPressed :: #foreign (key: int): Bool