-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Box2D support #40
Comments
Hi @thomz12,
Yeah that's the approach I used before, just decompile with any tool and
replace Retyped with H5.core
I've two packages in my todo list for a while, let's see if I manage to do
the three over this weekend.
Cheers,
Rafael
…On Fri, Apr 16, 2021, 5:47 PM thomz12 ***@***.***> wrote:
In my project I'd like to use Box2D. Is it possible to port that over from
Retyped.box2d?
Is that something I can look into? Are you decompiling the Retyped
packages for that?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#40>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACDCOA3JQOZUE62C2XHDZWLTJBL2TANCNFSM43BY2YJQ>
.
|
Thanks for the info! I had I look just now and was able to decompile and get it to compile with my project. |
Perfect! If you wanna submit the code as a PR I can publish it as a Nuget
package as well
…On Fri, Apr 16, 2021, 7:18 PM thomz12 ***@***.***> wrote:
Thanks for the info! I had I look just now and was able to decompile and
get it to compile with my project.
Had a quick test that still didn't quite work, but I'll figure that out
tomorrow. :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#40 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACDCOA5LQME5GVGKWRVBQG3TJBWNTANCNFSM43BY2YJQ>
.
|
So unfortunatly the original package used for Retpyed.box2d is used just for node applications. (I failed to notice that before) Do you have any ideas? |
To be honest my personal experience with Retyped isn't very good - for all the libraries we use, we just ended up writing our own wrapper classes - much easy to get a consistency experience than the autogenerated one from the typescript definition files used by Retyped. I'm not familiar with Box2D, but if their API is not too crazy might be worth giving it a try. It's usually as simple as writing a C# method and directly call the javascript code with something like this: public class MyLib
{
public int DoSomething(string par1, int par2)
{
return Script.Write<int>("myLib.doSomething({0}, {1}", par1, par2);
}
} The trick is that the compiler will emit directly the parameter variables in the final javascript, so that becomes: return myLib.doSomething(par1, par2); If you need more complex data types, you can create lightweight classes using the [ObjectLiteral] attribute. These classes are compiled to plain javascript objects without any of the C# extra code. |
Obviously, use static methods if it's a static library, or create an instance of the library and store it locally in the wrapper class if needed |
Thanks again for the tips! Would you like to make a nuget package for it? (p2) If you do, I'll open a PR tomorrow. |
If you can that would be great!
…On Sat, Apr 17, 2021, 5:28 PM thomz12 ***@***.***> wrote:
Thanks again for the tips!
I ended up using p2.js instead, and decompiled the retyped package for
that. That seems to work now!
Would you like to make a nuget package for it? (p2) If you do, I'll open a
PR tomorrow.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#40 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACDCOA52JV3EF3I6RC3ERJDTJGSJXANCNFSM43BY2YJQ>
.
|
Cool! I wanted to push a new branch, but it it looks like I'm not allowed to.
|
I think you've to fork first, push to your fork and then open a PR
…On Sun, Apr 18, 2021, 4:30 AM thomz12 ***@***.***> wrote:
Cool! I wanted to push a new branch, but it it looks like I'm not allowed
to.
remote: Permission to theolivenbaum/h5.git denied to thomz12.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#40 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACDCOA467VNZN4QEESOQ4FTTJI757ANCNFSM43BY2YJQ>
.
|
Oh duh! |
did that mistake in the past too 😄 Just merged the code, thanks for contributing! For future reference, I'm leaving these two regexs that I used for cleaning the decompiled code:
The final package should be published on nuget soon! |
In my project I'd like to use Box2D. Is it possible to port that over from Retyped.box2d?
Is that something I can look into? Are you decompiling the Retyped packages for that?
The text was updated successfully, but these errors were encountered: