Comments (3)
Now there is a different problem, _emscripten_set_main_loop issue is solved with this https://github.com/gen2brain/raylib-go/blob/master/raylib/external/scripts/emcc-generate-js.sh#L15 .
Function that is set with SetMainLoop(somefunc, 0, true) is running in loop as it should, but doesn't render anything on screen, first frame is visible and then just gray background.
http://81.4.106.254/raylib-go/
from raylib-go.
I have a clue now what is wrong. The only working functions in raylib_js.go for now are the one that doesn't return or accept structs, like InitWindow() for example, the others should be called like this, via ccall http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#interacting-with-code-call-javascript-from-native and http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html#ccall.
Something like this in GopherJS:
// LoadWaveEx is used, not _LoadWaveEx name that is exported
js.Global.Get("Module").Call("ccall", "LoadWaveEx", "array",
[]string{"array", "number", "number", "number", "number"},
[]interface{}{data, sampleCount, sampleRate, sampleSize, channels})
But then, there is again problem for all functions that work with structs passed by value. Structs can be converted to []byte
with unsafe
or encodings/binary
, so GopherJS pass it as TypedArray
, argument type from emscripten side is then array
, but return type can not be array
, only number
or string
, emscripten complains then, because it can not know size.
I will look more what can be done with http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/WebIDL-Binder.html#webidl-binder and http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/embind.html#embind , results can be complete bindings to raylib in javascript, example is box2d here https://github.com/kripken/box2d.js , that can than be easily used from GopherJS .
Edit: embind example here emscripten-core/emscripten#3083 (comment)
from raylib-go.
Closing for now, don't have time for this, I tried to use embind but it is not so easy.
from raylib-go.
Related Issues (20)
- Inconsistency in Return Type of ExportImage Function in raylib-go HOT 1
- Request to Expose Additional Compute Shader and SSBO Management Functions in raylib-go HOT 4
- Question (not issue) - Should there not be a link to the Raylib Discord in the Readme? HOT 1
- Try to use raylib gui but go fail to buid HOT 4
- `raygui.TextBox()` does not update text HOT 1
- `raygui.TextBox()` space character not working properly HOT 1
- Android build failing, undefined symbol: internal_storage_path & asset_manager HOT 6
- [IMPORTANT] GLFW error and wrong (0,0) position HOT 11
- WASM HOT 1
- Building for Android arm64 HOT 2
- Intermittent SIGBUS: bus error When uploading a custom mesh to gpu HOT 1
- log android HOT 2
- how get jni acces? HOT 9
- cannot locate symbol "internal_storage_path" HOT 12
- Dear IMGUI support HOT 1
- 2 or 3 second build times? HOT 2
- Misleading use of color type RGBA. HOT 2
- No function for `GuiLoadIcons` HOT 1
- Cross compiling error HOT 6
- Can't debug via go-delve on M1 MacOS. (missing rodata struct member) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raylib-go.