Files
volaTile/quokka_gfx/utils/Coords.h

38 lines
792 B
C++

#pragma once
#include <SDL3/SDL.h>
namespace quokka_gfx
{
//--------------------------------------------------------------
struct Size
{
int w = 0;
int h = 0;
};
//--------------------------------------------------------------
struct FSize
{
float w = 0.0f;
float h = 0.0f;
};
//--------------------------------------------------------------
struct Pos
{
int x = 0;
int y = 0;
};
//--------------------------------------------------------------
struct FPos
{
float x = 0.0f;
float y = 0.0f;
[[nodiscard]] bool isInBox(const FPos &boxPos, const FSize &boxSize) const
{
return x >= boxPos.x && y >= boxPos.y && x < boxPos.x + boxSize.w && y < boxPos.y + boxSize.h;
}
};
//--------------------------------------------------------------
} // namespace quokka_gfx