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

bound platform movement #39

Merged
merged 4 commits into from
Nov 29, 2023
Merged

bound platform movement #39

merged 4 commits into from
Nov 29, 2023

Conversation

cattabiani
Copy link
Contributor

@cattabiani cattabiani commented Nov 18, 2023

Atm the platform can move out of the canvas. Let's add some bounds!

Also if someone wants to tell me why there is fmin and fmax (I thought they were for floats) but not min/max I would gladly add this to the docs too

EDIT: I also increased the speed of the platform. I cannot keep up with the ball!

Atm the platform can move out of the canvas. Let's add some bounds! 

Also if someone wants to tell me why there is fmin and fmax (I thought they were for floats) but not min/max I would gladly add this to the docs too
Copy link
Contributor

@bates64 bates64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea bounding movement, and I agree with increasing the speed. We definitely need to explain why we're using fmin/fmax over the STL functions.. did std::min/std::max not work? Perhaps @yuri91 can provide some insight here

@yuri91
Copy link
Member

yuri91 commented Nov 22, 2023

What is the error that is shown if std::min is used?

@cattabiani
Copy link
Contributor Author

cattabiani commented Nov 22, 2023

Atm I moved on and cannot try with the exact configuration I had before. I tried to add it to my current project and it is working. I amso checked the inputs I was using and they were all ints. I can tell you only that it could not find the function and suggested to use fmin/fmax instead. Since I just wanted to see if it was working, I moved on without recording the error.

EDIT: I have found it. I forgot to start with std:: and it suggested me to use fmin instead.
EDIT2: But I still have problems in case it is in a jsgeneric tagged function:

Cannot call function 'min<int>'  with attribute 'wasm' from function 'draw_rect' with attribute 'genericjs', because parameter '__b' is a reference to a basic type
    radius = ((float) std::min(w, h));

there is also the error for __a obv.

@cattabiani
Copy link
Contributor Author

added the discord explanation in the file.

Copy link
Contributor

@bates64 bates64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks guys. A small edit then LGTM. Also please run pnpm format so that CI passes :)

src/content/docs/cheerp/01-tutorials/03-pong.md Outdated Show resolved Hide resolved
@bates64 bates64 merged commit e49d346 into leaningtech:main Nov 29, 2023
4 of 5 checks passed
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

Successfully merging this pull request may close these issues.

3 participants