Skip to content
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

C# wrapper #286

Open
Renari opened this issue May 2, 2024 · 1 comment
Open

C# wrapper #286

Renari opened this issue May 2, 2024 · 1 comment
Labels
enhancement New feature or request phantom camera Related to PhantomCamera nodes

Comments

@Renari
Copy link

Renari commented May 2, 2024

Project Type

2D, 3D

Feature Description

It would be nice if phantom camera included a C# wrapper to ease use with C#.

Use Cases

Currently to call phantom camera methods in C# you have to do something like this:

var cameraActive = (bool)GetNode("PhantomCamera2D").Call("is_active");

This is prone to causing runtime issues, for example if phantom camera changed the is_active method to active this would still compile but cause runtime issues.

(Optional) Proposed Solution

Better terrain could ship a C# wrapper that would prevent the above from happening.

One such example:
https://github.com/Portponky/better-terrain/blob/main/addons/better-terrain/BetterTerrain.cs

The above example could then be changed to:

var cameraActive = GetNode<PhantomCamera>("PhantomCamera2D").is_active();

Upon such an update where is_active is changed to active this would then cause a compile error, this also integrates better with IDE.

@ramokz
Copy link
Owner

ramokz commented May 2, 2024

This was also mentioned in this issue, so am exploring adding that in.

@ramokz ramokz added enhancement New feature or request phantom camera Related to PhantomCamera nodes labels May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request phantom camera Related to PhantomCamera nodes
Projects
Status: No status
Development

No branches or pull requests

2 participants