Merge pull request #880 from aaronfranke/struct
Use `struct` instead of `class` for core structures
This commit is contained in:
@@ -72,6 +72,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _NO_DISCARD_
|
||||
#define _NO_DISCARD_ [[nodiscard]]
|
||||
#endif
|
||||
|
||||
// Windows badly defines a lot of stuff we'll never use. Undefine it.
|
||||
#ifdef _WIN32
|
||||
#undef min // override standard definition
|
||||
|
||||
@@ -43,12 +43,7 @@
|
||||
|
||||
namespace godot {
|
||||
|
||||
class AABB {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ AABB {
|
||||
Vector3 position;
|
||||
Vector3 size;
|
||||
|
||||
|
||||
@@ -37,12 +37,7 @@
|
||||
|
||||
namespace godot {
|
||||
|
||||
class Basis {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Basis {
|
||||
Vector3 rows[3] = {
|
||||
Vector3(1, 0, 0),
|
||||
Vector3(0, 1, 0),
|
||||
|
||||
@@ -37,12 +37,7 @@ namespace godot {
|
||||
|
||||
class String;
|
||||
|
||||
class Color {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Color {
|
||||
union {
|
||||
struct {
|
||||
float r;
|
||||
|
||||
@@ -37,12 +37,7 @@
|
||||
|
||||
namespace godot {
|
||||
|
||||
class Plane {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Plane {
|
||||
Vector3 normal;
|
||||
real_t d = 0;
|
||||
|
||||
|
||||
@@ -39,18 +39,13 @@
|
||||
|
||||
namespace godot {
|
||||
|
||||
class AABB;
|
||||
class Plane;
|
||||
class Rect2;
|
||||
class Transform3D;
|
||||
class Vector2;
|
||||
struct AABB;
|
||||
struct Plane;
|
||||
struct Rect2;
|
||||
struct Transform3D;
|
||||
struct Vector2;
|
||||
|
||||
class Projection {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Projection {
|
||||
enum Planes {
|
||||
PLANE_NEAR,
|
||||
PLANE_FAR,
|
||||
|
||||
@@ -36,12 +36,7 @@
|
||||
|
||||
namespace godot {
|
||||
|
||||
class Quaternion {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Quaternion {
|
||||
union {
|
||||
struct {
|
||||
real_t x;
|
||||
|
||||
@@ -37,16 +37,11 @@
|
||||
|
||||
namespace godot {
|
||||
|
||||
class Rect2i;
|
||||
class String;
|
||||
class Transform2D;
|
||||
struct Rect2i;
|
||||
struct Transform2D;
|
||||
|
||||
class Rect2 {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Rect2 {
|
||||
Point2 position;
|
||||
Size2 size;
|
||||
|
||||
|
||||
@@ -37,15 +37,10 @@
|
||||
|
||||
namespace godot {
|
||||
|
||||
class Rect2;
|
||||
class String;
|
||||
struct Rect2;
|
||||
|
||||
class Rect2i {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Rect2i {
|
||||
Point2i position;
|
||||
Size2i size;
|
||||
|
||||
|
||||
@@ -39,12 +39,7 @@
|
||||
|
||||
namespace godot {
|
||||
|
||||
class Transform2D {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Transform2D {
|
||||
// Warning #1: basis of Transform2D is stored differently from Basis. In terms of columns array, the basis matrix looks like "on paper":
|
||||
// M = (columns[0][0] columns[1][0])
|
||||
// (columns[0][1] columns[1][1])
|
||||
|
||||
@@ -39,12 +39,7 @@
|
||||
|
||||
namespace godot {
|
||||
|
||||
class Transform3D {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Transform3D {
|
||||
Basis basis;
|
||||
Vector3 origin;
|
||||
|
||||
|
||||
@@ -37,14 +37,9 @@
|
||||
namespace godot {
|
||||
|
||||
class String;
|
||||
class Vector2i;
|
||||
struct Vector2i;
|
||||
|
||||
class Vector2 {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Vector2 {
|
||||
static const int AXIS_COUNT = 2;
|
||||
|
||||
enum Axis {
|
||||
|
||||
@@ -37,14 +37,9 @@
|
||||
namespace godot {
|
||||
|
||||
class String;
|
||||
class Vector2;
|
||||
struct Vector2;
|
||||
|
||||
class Vector2i {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Vector2i {
|
||||
static const int AXIS_COUNT = 2;
|
||||
|
||||
enum Axis {
|
||||
|
||||
@@ -36,17 +36,12 @@
|
||||
|
||||
namespace godot {
|
||||
|
||||
class Basis;
|
||||
class String;
|
||||
class Vector2;
|
||||
class Vector3i;
|
||||
struct Basis;
|
||||
struct Vector2;
|
||||
struct Vector3i;
|
||||
|
||||
class Vector3 {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Vector3 {
|
||||
static const int AXIS_COUNT = 3;
|
||||
|
||||
enum Axis {
|
||||
|
||||
@@ -37,14 +37,9 @@
|
||||
namespace godot {
|
||||
|
||||
class String;
|
||||
class Vector3;
|
||||
struct Vector3;
|
||||
|
||||
class Vector3i {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Vector3i {
|
||||
static const int AXIS_COUNT = 3;
|
||||
|
||||
enum Axis {
|
||||
|
||||
@@ -38,12 +38,7 @@ namespace godot {
|
||||
|
||||
class String;
|
||||
|
||||
class Vector4 {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Vector4 {
|
||||
static const int AXIS_COUNT = 4;
|
||||
|
||||
enum Axis {
|
||||
|
||||
@@ -37,14 +37,9 @@
|
||||
namespace godot {
|
||||
|
||||
class String;
|
||||
class Vector4;
|
||||
struct Vector4;
|
||||
|
||||
class Vector4i {
|
||||
_FORCE_INLINE_ GDNativeTypePtr _native_ptr() const { return (void *)this; }
|
||||
|
||||
friend class Variant;
|
||||
|
||||
public:
|
||||
struct _NO_DISCARD_ Vector4i {
|
||||
static const int AXIS_COUNT = 4;
|
||||
|
||||
enum Axis {
|
||||
|
||||
Reference in New Issue
Block a user