Almost every source file utilizes 2 integers (x and y) to represent cartesian coordinates in functions and more. Implementing a coordinate struct would tie x and y components together and make the code more readable.
Some source files do implement a 2D-vector type struct, such as ball.c. However, these structs define the vector as being comprised of 2 float components, not integers.
Modifying functions parameters and changing the arguments in which they're passed should not be too complicated. Additionally, this will decrease the number of arguments needed in function calls.
static void DrawTheTink(Display *display, Window window, int x, int y);A function prototype from gun.c using 2 integers for location as opposed to a coordinate struct
By implementing a simple coordinate struct, such as the one defined below, we can simplify our function parameters.
Description
Almost every source file utilizes 2 integers (x and y) to represent cartesian coordinates in functions and more. Implementing a coordinate struct would tie x and y components together and make the code more readable. Some source files do implement a 2D-vector type struct, such as ball.c. However, these structs define the vector as being comprised of 2 float components, not integers.
2-component floating-point vector struct from ball.c
typedef struct { float x, y; } vector_t;
Proposed Implementation
Modifying functions parameters and changing the arguments in which they're passed should not be too complicated. Additionally, this will decrease the number of arguments needed in function calls.
static void DrawTheTink(Display *display, Window window, int x, int y);
A function prototype from gun.c using 2 integers for location as opposed to a coordinate structBy implementing a simple coordinate struct, such as the one defined below, we can simplify our function parameters.
static void DrawTheTink(Display *display, Window window, Coord location);