Hacker News new | past | comments | ask | show | jobs | submit login

libsdl and GLFW are very similar! I ended up using GLFW because it's closer to what I wanted to do with Skia and WebGL, and I didn't need the 2D functionality of SDL.

Note that Window.js does not expose GLFW directly; it exposes APIs that are more similar to the web, for familiarity to web devs.

For example, GLFW has this for mouse input:

https://www.glfw.org/docs/latest/input_guide.html#input_mous...

But Window.js wraps that in window.addEventListener and "mousedown" events:

https://windowjs.org/doc/window#window.addEventListener https://windowjs.org/doc/window#event-mousedown

If you give it a try to build a game then keep in mind that it doesn't have a sound API yet, though that's part of the future plans.

Finally, is there something specific in libsdl that you'd like to have and Window.js doesn't support?




Awesome! I hadn't heard of GLFW before. My main use case is wanting gamepad support which it looks like GLFW has.

From all my user research, it looks like nothing beats up, down, left, right, confirmation and cancellation actions, so that's all I really need.

Are those gamepad events accessible through addEventListener?


Not right now. I've just filed an issue to track this:

https://github.com/windowjs/windowjs/issues/19

Window.js replicates web APIs where it makes sense, so I'd look into duplicating the Gamepad API:

https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API

Does that make sense to you?


100%. Sticking close to web APIs will guarantee the longest shelf life of code written against it. I'm a big fan of Deno rather than Node for the same reasons.

Thanks for building a cool project, I'll definitely be tracking along.

I've been working on something that should be fairly compatible, but I'll need to do a little tweaking on my end for windowjs: https://thelanding.page/tag/

It's basically a reactive client-side library that aims to decouple the necessary UI things like state management and event delegation from the DOM. It's tiny (~300 lines of code iirc). No external dependencies besides a lazy loaded Virtual DOM library that wouldn't be needed in a windowjs environment.

instead of an html function that renders when state changes, i can create a function that can draw on the windowjs canvas, probably on requestAnimationFrame.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: