I've had a look at the AWT class for Rectangle, but that is far too
complex for what we need, and it has lots of overhead associated with
it. Although it does use Point objects in some situations, if you used
it thoughout your code, and combined it with the Rectangle class, there
would be a lot of overhead from removing the X and Y coordinates from
the Point objects to use in a Rectangle object elsewhere, and then
recreating the Point object again unnecessarily.
This is because the Rectangle class does not store its X and Y
coordiantes in a Point object, nor does it store Width and Height values
in a Size object (is there a better name, such as Magnitude?).
I propose that we do recreate these classes in a simplified AWT style,
as has been suggested, but make various improvements that would be
better suited to the scenario of game development.
What I am proposing is the following class hierarchy:
SDLPoint:
int x
int y
constuctor(int x, int y): ...
int getX()
int getY()
SDLSize:
int width
int height
constuctor(int width, int height): ...
int getWidth()
int getHeight()
SDLRect:
SDLPoint topLeft
SDLSize size
constuctor(SDLSize): x = 0, y = 0, ...
constuctor(SDLPoint, SDLSize): ...
SDLPoint getTopLeft()
SDLPoint setTopLeft()
SDLPoint getTopRight()
SDLPoint getBottomLeft()
SDLPoint getBottomRight()
SDLPoint getCenter()
SDLPoint setCenter()
SDLSize getSize()
If you have anything to comment on this hierarchy, then please do so.
Anything additional can be integrated, or added at a later time. This is
just a small proposal.
Regards,
Chris
--
|>>>
Dessimat0r /`\ |
"We cannot turn back time, but we can _ _|_ _
move it forwards with our own hands." |;|_|;|_|;|
\\. . /
[www: http://codeknight.net ] \\: . /
[e-mail: des...@nt... ] ||: U | /`\
[icq: 21477909 ] ||:. |
[msn: des...@nt... ] \,/ ||: U.|
||: | \,/
||: , |
____--`~--- '--~~__ __ ----~ - ~`---,
-~--~ ~---__ ,--~' ~~----___
|