Files
RP412/MUNGA/RECT2D.h
T
CydandClaude Opus 4.8 4abbf8879f Initial import of Red Planet v4.10 Win32 source
Imports the current Win32 source for the pod-racing game 'Red Planet',
built on the MUNGA engine and its L4 (Win32/DirectX) platform layer:

- MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend
- RP / RP_L4: Red Planet game logic and Win32 application
- DivLoader, Setup1: asset loader and installer project
- lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies

Removed stale Subversion metadata and added .gitignore/.gitattributes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 07:59:51 -05:00

49 lines
1.0 KiB
C++

#pragma once
#include "vector2d.h"
// Note that the coordinate system used here is such that
// (0,0) is in the lower left corner.
class Rectangle2D SIGNATURED
{
public:
Vector2DOf<int> bottomLeft, topRight;
Rectangle2D();
Rectangle2D(Vector2DOf<int> bl, Vector2DOf<int> tr);
Rectangle2D(int x1, int y1, int x2, int y2);
~Rectangle2D() {}
Logical operator==(const Rectangle2D& r) const
{
return ((bottomLeft == r.bottomLeft) && (topRight == r.topRight));
}
Logical operator!=(const Rectangle2D& r) const
{
return ((bottomLeft != r.bottomLeft) || (topRight != r.topRight));
}
void Union(const Rectangle2D& r1, const Rectangle2D& r2);
void Intersection(const Rectangle2D& r1, const Rectangle2D& r2);
void MakeEmpty()
{
Check(this);
bottomLeft.x = 1;
topRight.x = 0;
}
Logical IsEmpty() const
{
return ((bottomLeft.x > topRight.x) || (bottomLeft.y > topRight.y));
}
friend std::ostream& operator<<(std::ostream& stream, const Rectangle2D& r);
Logical TestInstance() const;
static Logical TestClass();
};