aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elymas/lib/ffi/sdl.ey20
-rw-r--r--elymas/lib/sys/so.ey2
-rw-r--r--examples/working-shared/sdl.ey15
3 files changed, 26 insertions, 11 deletions
diff --git a/elymas/lib/ffi/sdl.ey b/elymas/lib/ffi/sdl.ey
index 605e6e3..96f43fe 100644
--- a/elymas/lib/ffi/sdl.ey
+++ b/elymas/lib/ffi/sdl.ey
@@ -3,13 +3,23 @@
"/usr/lib/x86_64-linux-gnu/libSDL2.so" :dlopen --
- 32 ==:SDL_INIT_VIDEO
+ 32 ==:INIT_VIDEO
- { -0021 :resolveFunction -01 deffd }' "->" deffd
+ { _ "SDL_" -01 cat -1032 :resolveFunction -01 deffd }' "->" deffd
- "i" "i32" ->SDL_Init
- "" "s" ->SDL_GetError
- "siiiii" "p" ->SDL_CreateWindow
+ "" "" ->SetMainReady
+ "i" "i32" ->Init
+ "" "" ->Quit
+ "" "s" ->GetError
+
+ "siiiii" "p" ->CreateWindow
+ "p" "" ->DestroyWindow
+ "p" "i32" ->UpdateWindowSurface
+ "p" "p" ->GetWindowSurface
+ "pbi" "i32" ->FillRect
+ { 0 -201 } /SDL_FillRect "pii" "i32" :resolveFunction ; /Fill deffd
+
+ SetMainReady
> /sdl ffi .defv
# vim: syn=elymas
diff --git a/elymas/lib/sys/so.ey b/elymas/lib/sys/so.ey
index 4a0632f..274a4e3 100644
--- a/elymas/lib/sys/so.ey
+++ b/elymas/lib/sys/so.ey
@@ -262,7 +262,7 @@
{
[
- { rets "v" streq }' { }
+ { rets "" streq }' { }
{ rets "s" streq }' {
/rax :pushqReg
/rcx /rcx :xorqRegReg
diff --git a/examples/working-shared/sdl.ey b/examples/working-shared/sdl.ey
index 23d2e79..52a22b5 100644
--- a/examples/working-shared/sdl.ey
+++ b/examples/working-shared/sdl.ey
@@ -3,13 +3,18 @@
ffi .sdl ":" via
-:SDL_INIT_VIDEO :SDL_Init {
- :SDL_GetError dump
- "SDL_Init failed" die
+:INIT_VIDEO :Init {
+ :GetError dump
+ "Init failed" die
} rep
-"Ohai!" 0 0 800 600 0 :SDL_CreateWindow
+"Ohai!" 0 0 800 600 0 :CreateWindow ==w
-"done" die
+w :GetWindowSurface ==s
+s 255 :Fill dump
+w :UpdateWindowSurface
+
+1 sys .out .read dump
+:Quit
# vim: syn=elymas