Improving multimedia, trying to add a single c library mode

This commit is contained in:
Krzosa Karol
2022-10-02 12:53:29 +02:00
parent 5baff3585e
commit e098663d82
9 changed files with 152 additions and 100 deletions

View File

@@ -8,14 +8,14 @@ AnyArguments :: (values: []Any)
Assert(*(values[0].data->*S64) == 10)
Assert(*(values[1].data->*S64) == 20)
printf :: #foreign (string: *char, args: ..): int
// printf :: #foreign (string: *char, args: ..): int
main :: (): int
a := 10
b := 20
values := []Any{a, b}
printf("Test %d", {a})
// printf("Test %d", {a})
for values
Assert(it.type == S64)

View File

@@ -1,11 +1,12 @@
// We can bind module to a name
M :: #import "Multimedia.core"
// We can bind a struct to a name
Mu :: M.Mu
// You can bind struct to a name
MU :: M.MU
// We can bind a lambda to a name
Start :: M.StartMultimedia
Update :: M.UpdateMultimedia
// Other example of binding a lambda to a name
SomeOtherLambda :: () ;; pass
@@ -33,7 +34,7 @@ main :: (): int
#Assert(NewInt == int)
#Assert(StrictInt != int)
mu: Mu = Start(x = 1280, y = 720)
Assert(mu.x == 1280 && mu.y == 720)
Start(x = 1280, y = 720)
Update()
return 0

View File

@@ -3,9 +3,8 @@
WinMain :: (hInstance: HINSTANCE, hPrevInstance: HINSTANCE, lpCmdLine: LPSTR, nShowCmd: int): int
StartMultimedia(title = "Hello, people!")
for UpdateMultimedia()
if Mu.key[Key.Escape].is_down
Mu.quit = true
if Mu.key[Key.Escape].down ;; Mu.quit = true
for y := 0, y < Mu.y, y+=1
for x := 0, x < Mu.x, x+=1
Mu.scrn[x + y*Mu.x] = 0xFFFFFF00
for y := 0, y < Mu.window.y, y+=1
for x := 0, x < Mu.window.x, x+=1
Mu.screen[x + y*Mu.window.x] = 0xFFFFFF00