-
-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add (F)Rect.collidecircle()
#2886
base: main
Are you sure you want to change the base?
Changes from 11 commits
914e763
1976400
c1280ad
0d7fbd2
d2bae76
d86cb27
b137ddf
98412a9
6d1250a
6534ffb
5b8ef8d
87fab92
31c59ad
d27deb0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,6 +192,12 @@ typedef struct pg_bufferinfo_s { | |
#define import_pygame_base() IMPORT_PYGAME_MODULE(base) | ||
#endif /* ~PYGAMEAPI_BASE_INTERNAL */ | ||
|
||
#ifndef PYGAMEAPI_GEOMETRY_INTERNAL | ||
|
||
#define import_pygame_geometry() IMPORT_PYGAME_MODULE(geometry) | ||
|
||
#endif /* ~PYGAMEAPI_GEOMETRY_INTERNAL */ | ||
|
||
typedef struct { | ||
PyObject_HEAD SDL_Rect r; | ||
PyObject *weakreflist; | ||
|
@@ -204,35 +210,42 @@ typedef struct { | |
|
||
#define pgRect_AsRect(x) (((pgRectObject *)x)->r) | ||
#define pgFRect_AsRect(x) (((pgFRectObject *)x)->r) | ||
|
||
#ifndef PYGAMEAPI_RECT_INTERNAL | ||
#define pgRect_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(rect, 0)) | ||
|
||
#define pgRect_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(geometry, 0)) | ||
|
||
#define pgRect_Check(x) ((x)->ob_type == &pgRect_Type) | ||
#define pgRect_New (*(PyObject * (*)(SDL_Rect *)) PYGAMEAPI_GET_SLOT(rect, 1)) | ||
#define pgRect_New \ | ||
(*(PyObject * (*)(SDL_Rect *)) PYGAMEAPI_GET_SLOT(geometry, 1)) | ||
|
||
#define pgRect_New4 \ | ||
(*(PyObject * (*)(int, int, int, int)) PYGAMEAPI_GET_SLOT(rect, 2)) | ||
(*(PyObject * (*)(int, int, int, int)) PYGAMEAPI_GET_SLOT(geometry, 2)) | ||
|
||
#define pgRect_FromObject \ | ||
(*(SDL_Rect * (*)(PyObject *, SDL_Rect *)) PYGAMEAPI_GET_SLOT(rect, 3)) | ||
(*(SDL_Rect * (*)(PyObject *, SDL_Rect *)) PYGAMEAPI_GET_SLOT(geometry, 3)) | ||
|
||
#define pgRect_Normalize (*(void (*)(SDL_Rect *))PYGAMEAPI_GET_SLOT(rect, 4)) | ||
#define pgRect_Normalize \ | ||
(*(void (*)(SDL_Rect *))PYGAMEAPI_GET_SLOT(geometry, 4)) | ||
|
||
#define pgFRect_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(rect, 5)) | ||
#define pgFRect_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(geometry, 5)) | ||
|
||
#define pgFRect_Check(x) ((x)->ob_type == &pgFRect_Type) | ||
#define pgFRect_New \ | ||
(*(PyObject * (*)(SDL_FRect *)) PYGAMEAPI_GET_SLOT(rect, 6)) | ||
(*(PyObject * (*)(SDL_FRect *)) PYGAMEAPI_GET_SLOT(geometry, 6)) | ||
|
||
#define pgFRect_New4 \ | ||
(*(PyObject * (*)(float, float, float, float)) PYGAMEAPI_GET_SLOT(rect, 7)) | ||
#define pgFRect_New4 \ | ||
(*(PyObject * (*)(float, float, float, float)) \ | ||
PYGAMEAPI_GET_SLOT(geometry, 7)) | ||
|
||
#define pgFRect_FromObject \ | ||
(*(SDL_FRect * (*)(PyObject *, SDL_FRect *)) PYGAMEAPI_GET_SLOT(rect, 8)) | ||
#define pgFRect_FromObject \ | ||
(*(SDL_FRect * (*)(PyObject *, SDL_FRect *)) \ | ||
PYGAMEAPI_GET_SLOT(geometry, 8)) | ||
|
||
#define pgFRect_Normalize (*(void (*)(SDL_FRect *))PYGAMEAPI_GET_SLOT(rect, 9)) | ||
#define pgFRect_Normalize \ | ||
(*(void (*)(SDL_FRect *))PYGAMEAPI_GET_SLOT(geometry, 9)) | ||
|
||
#define import_pygame_rect() IMPORT_PYGAME_MODULE(rect) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we consider just replacing all calls to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't do that as I didn't know if doing that would cause too many internal changes, but I initially wanted to rename it, and I can do it if it's needed. Update me if you think I should change it, maybe based on some other contributor's opinion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not essential to this PR IMHO, I guess we'll see how everyone else feels about moving Rect/Frect and shimming. |
||
#define import_pygame_rect() IMPORT_PYGAME_MODULE(geometry) | ||
#endif /* ~PYGAMEAPI_RECT_INTERNAL */ | ||
|
||
/* | ||
|
@@ -500,12 +513,6 @@ typedef struct pgColorObject pgColorObject; | |
#define import_pygame_math() IMPORT_PYGAME_MODULE(math) | ||
#endif /* PYGAMEAPI_MATH_INTERNAL */ | ||
|
||
#ifndef PYGAMEAPI_GEOMETRY_INTERNAL | ||
|
||
#define import_pygame_geometry() IMPORT_PYGAME_MODULE(geometry) | ||
|
||
#endif /* ~PYGAMEAPI_GEOMETRY_INTERNAL */ | ||
|
||
/* | ||
* Window module | ||
*/ | ||
|
@@ -531,7 +538,6 @@ typedef struct { | |
*/ | ||
#ifdef PYGAME_H | ||
PYGAMEAPI_DEFINE_SLOTS(base); | ||
PYGAMEAPI_DEFINE_SLOTS(rect); | ||
PYGAMEAPI_DEFINE_SLOTS(joystick); | ||
PYGAMEAPI_DEFINE_SLOTS(display); | ||
PYGAMEAPI_DEFINE_SLOTS(surface); | ||
|
@@ -545,7 +551,6 @@ PYGAMEAPI_DEFINE_SLOTS(window); | |
PYGAMEAPI_DEFINE_SLOTS(geometry); | ||
#else /* ~PYGAME_H */ | ||
PYGAMEAPI_EXTERN_SLOTS(base); | ||
PYGAMEAPI_EXTERN_SLOTS(rect); | ||
PYGAMEAPI_EXTERN_SLOTS(joystick); | ||
PYGAMEAPI_EXTERN_SLOTS(display); | ||
PYGAMEAPI_EXTERN_SLOTS(surface); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a newline here.