The new color for screen drawing was chosen to be easier to distinguish
from the 2D viewport limits.
This also makes lines less opaque when the Camera2D has the Current
property enabled. The increased line width is enough to spot the
camera easily, and the increased opacity on top of that felt obnoxious.
(cherry picked from commit 8e2a7fff1d)
Decide whether half offset should be added based on the value used for calculating the return value of this method.
(cherry picked from commit f1420c7cbf)
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.
There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.
Backport of #48239.
When AnimatedSprite2D::play() was called before SpriteFrames has been initialized, a crach occurred (issue #46013).
Modification : An error message on null check test has been added to prevent crash.
Fix#46013.
(cherry picked from commit 324ab63844)
The logic for internal process and internal physics process in Camera2D was very buggy and convoluted for historical reasons.
This is a cleanup to make the logic simpler and easier to follow.
More work is needed to make sure that those options actually solve users' issues, so we prefer to remove the options for 3.2.4 and revisit for a future release.
If true, collision shapes are shown in the editor and at run-time.
Requires Visible Collision Shapes to be enabled in the Debug menu,
for collision shapes to be visible at run-time.
When one of the bodies exited the tree, the corresponding node path was
reset instead of just resetting the joint from the physics server. That
was causing the node path to be reset on scene switch when one of the
bodies is under the joint in the scene tree.
The rendering/quality/2d section of project settings is becoming considerably expanded in 3.2.4, and arguably was not the correct place for settings that were not really to do with quality.
3.2.4 is the last sensible opportunity we will have to move these settings, as the only existing one likely to break compatibility in a small way is `pixel_snap`, and given that the whole snapping area is being overhauled we can draw attention to the fact it has changed in the release notes.
Class reference is also updated and slightly improved.
`pixel_snap` is renamed to `gpu_pixel_snap` in the project settings and code to help differentiate from CPU side transform snapping.
Two common problems have emerged as a result of transform snapping:
1) Camera jitter with a camera following a snapped object
2) Pixel gaps between e.g. a platform and a player, where a platform rounds down and a player rounds up
Using round seems to greatly reduce problems due to camera jitter. It also may prove better for pixel gaps because pixel art is often designed on a grid, so whole numbers are too expected, which are unstable with floor().
Having white or strongly desaturated debug collision shape color
setting would make it harder to visualize enabled / disabled state.
This change makes it easier to visualize enabled / disabled state
by reducing the alpha color by half when disabled.
(cherry picked from commit 0c4594f6c9)
- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile` by the new `SafeFlag`
- Platform-specific implementations no longer needed
Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
- Based on C++11's `mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
- `BinaryMutex` added for special cases as the non-recursive version
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.