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

Update Box2D to version 2.4.1 #67

Merged
merged 2 commits into from
Nov 26, 2021
Merged

Conversation

marmichalski
Copy link
Contributor

@marmichalski marmichalski commented Nov 20, 2021

This should be fine, but would be great if someone could run the premake build. I am creating a cmake build env and that's where I have tested these changes. There is quite a few whitelines changes in touched files, I did not try to resolve them in any way, as unified line endings are my preference :P

Edit: or actually I probably forgot to update premake. I'll update in a few.

Done. It compiles & runs. I have not updated the Visual Studio project as I have no way to test the changes - maybe just updating the files list should be enough 🤔

image

@marmichalski marmichalski marked this pull request as draft November 20, 2021 21:51
@marmichalski marmichalski marked this pull request as ready for review November 21, 2021 01:13
make -C third_party/Box2D/Build config=release_x86_64 -j$(CPUS)


wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta1/premake-5.0.0-beta1-linux.tar.gz && \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated premake also 🤷

rm premake-5.0.0-alpha14-linux.tar.gz)

box2d: premake
.build/premake5 --file=third_party/Box2D/premake5.lua gmake
Copy link
Contributor Author

Choose a reason for hiding this comment

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

box has moved to cmake

@@ -569,7 +569,7 @@ void PhysicsManager::HandleCollision_ObjectWithMap(b2Fixture* objectFixture, b2F
float height = gGameMap.GetHeightAtPosition(gameObject->mPhysicsBody->GetPosition());
int mapLayer = (int) (Convert::MetersToMapUnits(height) + 0.5f);

b2FixtureData_map fxdata = mapFixture->GetUserData();
b2FixtureData_map fxdata = (b2FixtureData_map*) mapFixture->GetUserData().pointer;
Copy link

Choose a reason for hiding this comment

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

Suggested change
b2FixtureData_map fxdata = (b2FixtureData_map*) mapFixture->GetUserData().pointer;
b2FixtureData_map fxdata = static_cast<b2FixtureData_map*>(mapFixture->GetUserData().pointer);

@@ -505,59 +505,59 @@ bool PhysicsManager::ShouldCollide_ObjectWithMap(b2Contact* contact, b2Fixture*

// todo: this is temporary implementation

b2FixtureData_map fxdata = mapFixture->GetUserData();
b2FixtureData_map fxdata = (b2FixtureData_map*) mapFixture->GetUserData().pointer;
Copy link

Choose a reason for hiding this comment

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

Suggested change
b2FixtureData_map fxdata = (b2FixtureData_map*) mapFixture->GetUserData().pointer;
b2FixtureData_map fxdata = static_cast<b2FixtureData_map*>(mapFixture->GetUserData().pointer);

@codenamecpp
Copy link
Owner

Oh, I didn't expect that. Nice work, thanks, @marmichalski !

As for 'static_cast' over 'c-style' cast, I haven't decided yet what I prefer more, usually I'm too lazy to write ***_cast<> etc but in general, I don't mind.

@marmichalski
Copy link
Contributor Author

marmichalski commented Nov 25, 2021

Oh, I didn't expect that. Nice work, thanks, @marmichalski !

As for 'static_cast' over 'c-style' cast, I haven't decided yet what I prefer more, usually I'm too lazy to write ***_cast<> etc but in general, I don't mind.

Hey, no problem. I have updated the visual studio project for box2d, the src dir is needed in the additional include paths because there is, I believe, not correctly included file in one of the source files. I will open up a PR in Box2D and see what they think - if it will be accepted, the additional include path could be removed, if not, will have to stay with us :P

I am not updating the casts, because I see no reason to. I can do that, if that's what you prefer, @codenamecpp, but I see you don't mind too :)

Edit: Said box2d PR - erincatto/box2d#702

@codenamecpp codenamecpp merged commit 4a05799 into codenamecpp:master Nov 26, 2021
@marmichalski marmichalski deleted the box2d branch December 1, 2021 19:47
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