summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/io/logger.cpp11
-rw-r--r--core/math/transform_2d.cpp12
-rw-r--r--core/math/transform_2d.h11
-rw-r--r--core/project_settings.cpp35
-rw-r--r--core/variant.h9
5 files changed, 36 insertions, 42 deletions
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 48aebeda3d..ad0cc81023 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -34,17 +34,6 @@
#include "core/os/os.h"
#include "core/print_string.h"
-// va_copy was defined in the C99, but not in C++ standards before C++11.
-// When you compile C++ without --std=c++<XX> option, compilers still define
-// va_copy, otherwise you have to use the internal version (__va_copy).
-#if !defined(va_copy)
-#if defined(__GNUC__)
-#define va_copy(d, s) __va_copy((d), (s))
-#else
-#define va_copy(d, s) ((d) = (s))
-#endif
-#endif
-
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
#define sprintf sprintf_s
#endif
diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp
index 97a9216a5a..ed95baa233 100644
--- a/core/math/transform_2d.cpp
+++ b/core/math/transform_2d.cpp
@@ -70,6 +70,18 @@ void Transform2D::rotate(real_t p_phi) {
*this = Transform2D(p_phi, Vector2()) * (*this);
}
+real_t Transform2D::get_skew() const {
+
+ real_t det = basis_determinant();
+ return Math::acos(elements[0].normalized().dot(SGN(det) * elements[1].normalized())) - Math_PI * 0.5;
+}
+
+void Transform2D::set_skew(float p_angle) {
+
+ real_t det = basis_determinant();
+ elements[1] = SGN(det) * elements[0].rotated((Math_PI * 0.5 + p_angle)).normalized() * elements[1].length();
+}
+
real_t Transform2D::get_rotation() const {
real_t det = basis_determinant();
Transform2D m = orthonormalized();
diff --git a/core/math/transform_2d.h b/core/math/transform_2d.h
index fa43762aa4..459ceed7a9 100644
--- a/core/math/transform_2d.h
+++ b/core/math/transform_2d.h
@@ -70,7 +70,10 @@ struct Transform2D {
void set_rotation(real_t p_rot);
real_t get_rotation() const;
+ real_t get_skew() const;
+ void set_skew(float p_angle);
_FORCE_INLINE_ void set_rotation_and_scale(real_t p_rot, const Size2 &p_scale);
+ _FORCE_INLINE_ void set_rotation_scale_and_skew(real_t p_rot, const Size2 &p_scale, float p_skew);
void rotate(real_t p_phi);
void scale(const Size2 &p_scale);
@@ -184,6 +187,14 @@ void Transform2D::set_rotation_and_scale(real_t p_rot, const Size2 &p_scale) {
elements[0][1] = Math::sin(p_rot) * p_scale.x;
}
+void Transform2D::set_rotation_scale_and_skew(real_t p_rot, const Size2 &p_scale, float p_skew) {
+
+ elements[0][0] = Math::cos(p_rot) * p_scale.x;
+ elements[1][1] = Math::cos(p_rot + p_skew) * p_scale.y;
+ elements[1][0] = -Math::sin(p_rot + p_skew) * p_scale.y;
+ elements[0][1] = Math::sin(p_rot) * p_scale.x;
+}
+
Rect2 Transform2D::xform_inv(const Rect2 &p_rect) const {
Vector2 ends[4] = {
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 63b52661b4..8829181489 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -362,40 +362,29 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
// We need to test both possibilities as extensions for Linux binaries are optional
// (so both 'mygame.bin' and 'mygame' should be able to find 'mygame.pck').
- bool found = false;
-
String exec_dir = exec_path.get_base_dir();
String exec_filename = exec_path.get_file();
String exec_basename = exec_filename.get_basename();
- // Try to load data pack at the location of the executable
- // As mentioned above, we have two potential names to attempt
-
- if (_load_resource_pack(exec_dir.plus_file(exec_basename + ".pck")) ||
- _load_resource_pack(exec_dir.plus_file(exec_filename + ".pck"))) {
- found = true;
- } else {
- // If we couldn't find them next to the executable, we attempt
- // the current working directory. Same story, two tests.
- if (_load_resource_pack(exec_basename + ".pck") ||
- _load_resource_pack(exec_filename + ".pck")) {
- found = true;
- }
- }
+ // Attempt with PCK bundled into executable
+ bool found = _load_resource_pack(exec_path);
#ifdef OSX_ENABLED
- // Attempt to load PCK from macOS .app bundle resources
if (!found) {
- if (_load_resource_pack(OS::get_singleton()->get_bundle_resource_dir().plus_file(exec_basename + ".pck"))) {
- found = true;
- }
+ // Attempt to load PCK from macOS .app bundle resources
+ found = _load_resource_pack(OS::get_singleton()->get_bundle_resource_dir().plus_file(exec_basename + ".pck"));
}
#endif
- // Attempt with PCK bundled into executable
if (!found) {
- if (_load_resource_pack(exec_path)) {
- found = true;
+ // Try to load data pack at the location of the executable
+ // As mentioned above, we have two potential names to attempt
+ found = _load_resource_pack(exec_dir.plus_file(exec_basename + ".pck")) || _load_resource_pack(exec_dir.plus_file(exec_filename + ".pck"));
+
+ if (!found) {
+ // If we couldn't find them next to the executable, we attempt
+ // the current working directory. Same story, two tests.
+ found = _load_resource_pack(exec_basename + ".pck") || _load_resource_pack(exec_filename + ".pck");
}
}
diff --git a/core/variant.h b/core/variant.h
index a832f7ccf8..1ae09ad82f 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -67,13 +67,6 @@ typedef Vector<Vector2> PackedVector2Array;
typedef Vector<Vector3> PackedVector3Array;
typedef Vector<Color> PackedColorArray;
-// Temporary workaround until c++11 alignas()
-#ifdef __GNUC__
-#define GCC_ALIGNED_8 __attribute__((aligned(8)))
-#else
-#define GCC_ALIGNED_8
-#endif
-
class Variant {
public:
// If this changes the table in variant_op must be updated
@@ -211,7 +204,7 @@ private:
PackedArrayRefBase *packed_array;
void *_ptr; //generic pointer
uint8_t _mem[sizeof(ObjData) > (sizeof(real_t) * 4) ? sizeof(ObjData) : (sizeof(real_t) * 4)];
- } _data GCC_ALIGNED_8;
+ } _data alignas(8);
void reference(const Variant &p_variant);
void clear();