sq / JSIL

CIL to Javascript Compiler
http://jsil.org/
Other
1.73k stars 240 forks source link

Uh, wow... #138

Closed Mike-E-angelo closed 11 years ago

Mike-E-angelo commented 11 years ago

... I simply cannot believe this project and am in utter awe. I'm curious if the samples that are used on the site are available from the repo. I'd love to pick em apart. :)

Also, just to clarify: is the compilation being done by Mono or native .NET? If native .NET, is 4.5 supported?

I'm also curious if extension methods are supported.

Completely blown away by this...

kg commented 11 years ago

Most of the samples are available on the internet, but aren't checked into the repo. the jsil.org\demos folder in the repo contains the configuration files used to build them.

https://github.com/kevingadd/XnaMannux is Mannux https://github.com/ttocs7/tetris is Tetris Platformer and RPG are the Platformer and RPG Starter Kits from the XNA website. I don't know if you can get them anymore, Microsoft loves breaking everything. Raytracer and Try JSIL's source code are checked into the repo.

JSIL uses your existing compiler - it takes compiled .NET executables as input (dll or exe) and then converts those into JavaScript. It accepts .sln files as input in order to do things for you like automatically convert XNA content or include files that are tagged as 'copy to output directory' in your project.

Extension methods work because they end up being just normal calls once you're compiled.

.NET 4.5 should work but hasn't been tested in any real capacity (the automated tests pass but that's about it)

Mike-E-angelo commented 11 years ago

Completely amazing. I am speechless. Just curious... have you (or anyone) tried decompiling WPF? Is it technically possible to run WPF in a browser using this magic?

kg commented 11 years ago

The main obstacles to that are that it's not legal to redistribute a decompiled version of WPF, and that cross-compiling the entirety of WPF would produce something approaching dozens (or hundreds) of megabytes of javascript.

It is technically possible, but would probably require various degrees of cleverness.

Mike-E-angelo commented 11 years ago

Wow. I'm absolutely beside myself. Obstacles aside, it would still mean a presentation framework that (theoretically) works on every device in the marketplace... And for Windows Application developers it would mean completely circumventing the long engendered mire that is script-based application development.

Totally mind-blowing.

Mike-E-angelo commented 11 years ago

Bear with me as I wrap my head around this newfound toy. I'm not that familiar with XNA, but to me it seems like it provides a rendering engine/surface, correct? Might it be possible to render Silverlight controls on it?

Something like this: http://www.c-sharpcorner.com/uploadfile/iersoy/using-xaml-user-controls-in-xna/

kg commented 11 years ago

Unfortunately that example is simply hosting WPF in the same Win32 window (hwnd) that the XNA graphics device draws to; the two interact only because Windows (specifically GDI and User32, etc) does the work to make the two co-operate.

XNA provides access to a rendering surface, graphics APIs, content management, input, etc. You can think of it as a more complex equivalent to what SDL does.

Mike-E-angelo commented 11 years ago

Hmmm... OK. But no user interface controls or anything of that nature (in XNA land)? This is going to take some thought. :)

Mike-E-angelo commented 11 years ago

Still thinking of possibilities here. From what I'm seeing/understanding, you're intercepting the XNA rendering pipeline and rendering the results in an HTML5 canvas, correct? I'm wondering if the same technique could be used using the Silverlight rendering pipeline?

kg commented 11 years ago

Yes, you could apply the same technique to the Silverlight rendering pipeline to emulate it using Canvas or WebGL (most likely WebGL; if memory serves Silverlight's rendering pipeline is built around Direct3D)

Mike-E-angelo commented 11 years ago

Whoa... now we're talking. I can start looking into that.

Final question (for now, smile)... I can't tell by the description on the main page, but is JSIL cross-platform? It mentions "cross-browser" ... but does that browser have to be on a Windows machine in order to work? That is, does JSIL work on iOS and Droid platforms?

kg commented 11 years ago

If your device's browser can actually run HTML5 games, JSIL will probably work. Right now HTML5 performance is generally miserable on mobile but I've tested JSIL stuff on Android phones and it gets like 15fps, so that's something.

Mike-E-angelo commented 11 years ago

That's bad for gaming... but perfect for business applications. :)

If there's a Computer Science Award of the Century, you deserve it, man. This is just righteous technology!