smack0007 / sdl_ts Goto Github PK
View Code? Open in Web Editor NEWSDL bindings for TypeScript. Currently running on deno.
License: MIT License
SDL bindings for TypeScript. Currently running on deno.
License: MIT License
brew install sdl2 sdl2_image sdl2_ttf
dir_path=sdl
if [ ! -d "$dir_path" ]; then
mkdir $dir_path
fi
projectPath=`pwd`
deno run --allow-net --allow-read="$projectPath" --allow-write="$projectPath" --import-map https://deno.land/x/[email protected]/imports.deno.json https://deno.land/x/[email protected]/init.ts "$projectPath"
sdl deno task start
// return
error: Uncaught (in promise) Error: Failed to load library "darwin/x64/libSDL2.a"
throw new SDLError(`Failed to load library "${libraryPath}"`, error);
^
at loadLibrary (https://deno.land/x/[email protected]/src/deno/_library.ts:25:11)
at Module.Init (https://deno.land/x/[email protected]/src/SDL/functions.ts:330:14)
at main (file:///Users/jonham/code/sdl2-deno/sdl/main.ts:4:7)
at file:///Users/jonham/code/sdl2-deno/sdl/main.ts:38:11
Caused by: Error: Could not open library: Could not open library: dlopen(darwin/x64/libSDL2.a, 0x0005): tried: 'darwin/x64/libSDL2.a' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OSdarwin/x64/libSDL2.a' (no such file), '/usr/lib/darwin/x64/libSDL2.a' (no such file, not in dyld cache), 'darwin/x64/libSDL2.a' (not a mach-o file), '/Users/jonham/code/sdl2-deno/sdl/darwin/x64/libSDL2.a' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/jonham/code/sdl2-deno/sdl/darwin/x64/libSDL2.a' (no such file), '/Users/jonham/code/sdl2-deno/sdl/darwin/x64/libSDL2.a' (not a mach-o file)
https://github.com/libsdl-org/setup-sdl
I think with a pull request or two to setup-sdl
which should be able to leverage their code to get SDL
installed.
When I clone the repo and attempt to run any of the demos from a windows powershell, I see the following:
PS C:\Users\andyb\src\SDL_ts> deno task run:doom-fire
Task run:doom-fire export SDL_TS_ENV_DIR=$INIT_CWD && cd ./examples/doom-fire && deno run --unstable --allow-env --allow-ffi --allow-read=../.. $DENO_FLAGS ./main.ts
Error: Failed to load library "SDL2" from ""
at Function.denoLoadLibrary [as loadLibrary] (file:///C:/Users/andyb/src/SDL_ts/src/deno/_library.ts:123:9)
at Module.Init (file:///C:/Users/andyb/src/SDL_ts/src/SDL/functions.ts:353:23)
at main (file:///C:/Users/andyb/src/SDL_ts/examples/doom-fire/main.ts:53:7)
at file:///C:/Users/andyb/src/SDL_ts/examples/doom-fire/main.ts:191:13
Caused by AggregateError
at Function.denoLoadLibrary [as loadLibrary] (file:///C:/Users/andyb/src/SDL_ts/src/deno/_library.ts:125:5)
at Module.Init (file:///C:/Users/andyb/src/SDL_ts/src/SDL/functions.ts:353:23)
at main (file:///C:/Users/andyb/src/SDL_ts/examples/doom-fire/main.ts:53:7)
at file:///C:/Users/andyb/src/SDL_ts/examples/doom-fire/main.ts:191:13
PS C:\Users\andyb\src\SDL_ts> ls
It seems the .env.windows file is not loading correctly. Any ideas? Let me know if you need more info.
Typescript provide FinalizationRegistry for cleanup after corresponding object is deleted. Maybe we can call SDL cleanup functions like SDL.DestroyWindow
in FinalizationRegistry.
According to https://wiki.libsdl.org/SDL2/SDL_PollEvent, this API return only two value 0
and 1
, seems to represent a pair of boolean value.
https://wiki.libsdl.org/SDL2/SDL_WaitEvent
Is it better to provide an async iterator for this API along with this blocking API? Or this api should be marked as non-blocking?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.