raze/source/common/utility/intrect.h
Christoph Oelckers c2fc7577db - cleanup of 3D viewport code.
Removes all the hackery that Polymost needed and now uses a sane struct to store the info.
2022-08-05 17:04:45 +02:00

61 lines
593 B
C

#pragma once
struct IntRect
{
int left, top;
int width, height;
void Offset(int xofs, int yofs)
{
left += xofs;
top += yofs;
}
void AddToRect(int x, int y)
{
if (x < left)
left = x;
if (x > left + width)
width = x - left;
if (y < top)
top = y;
if (y > top + height)
height = y - top;
}
int Left() const
{
return left;
}
int Top() const
{
return top;
}
int Right() const
{
return left + width;
}
int Bottom() const
{
return top + height;
}
int Width() const
{
return width;
}
int Height() const
{
return height;
}
};