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

bug with Rectangle() #19

Closed
Augusto-Fadanelli opened this issue Jun 5, 2021 · 5 comments
Closed

bug with Rectangle() #19

Augusto-Fadanelli opened this issue Jun 5, 2021 · 5 comments

Comments

@Augusto-Fadanelli
Copy link

when i use and compile:
this.teste = new Rectangle(0.0f, 0.0f, 64.0f, 64.0f);

I receive this:

BattleTank.java:54: error: no suitable constructor found for Rectangle(float,float,float,float)
this.teste = new Rectangle(0.0f, 0.0f, 64.0f, 64.0f);
^
constructor Rectangle.Rectangle() is not applicable
(actual and formal argument lists differ in length)
constructor Rectangle.Rectangle(long) is not applicable
(actual and formal argument lists differ in length)
constructor Rectangle.Rectangle(Pointer) is not applicable
(actual and formal argument lists differ in length)
1 error

i didn't build jaylib and i running it in windows 7 x64

@electronstudio
Copy link
Owner

The helper class for Rectangle was added here so I think it's not in the released jar. c2546ad

You could copy and paste the code from there into your project, or you could wait until I release a new jar.

@electronstudio
Copy link
Owner

actually if you're copy and pasting, use this version https://github.com/electronstudio/jaylib/blob/master/src/com/raylib/Jaylib.java

@Augusto-Fadanelli
Copy link
Author

the file "com/raylib/Raylib.java" does not exist, do I need to create it to build? How I do it? thanks for your patience

@electronstudio
Copy link
Owner

I'm currently thinking the best way is just to do:

    this.teste = new Rectangle().x(0.0f).y(0.0f).width(64.0f).height(64.0f);

To discuss if it would be better to use helper classes go to #1

@electronstudio
Copy link
Owner

I'm thinking the helpers are not actually a good idea, because they make it easy to think you're dealing with Java objects, when actually these are chunks of memory allocated on the native heap. The GC behaviour is different and the JVM won't be able to do boxing, escape analyse, etc, optimizations on them. The unusual syntax helps to remind me of that.

But anyway the helpers are still there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants