very wonky movement implementation

This commit is contained in:
cat 2025-05-28 18:57:21 +10:00
parent d2155bf27e
commit 0fc07ac95e
6 changed files with 74 additions and 13 deletions

17
sdl.c Normal file
View file

@ -0,0 +1,17 @@
#include <SDL3/SDL.h>
#include "dat.h"
#include "fns.h"
int
in_bounds(Image *i, int x, int y, SDL_Rect *bounds)
{
SDL_Rect r;
SDL_Rect irect = { x, y, i->w, i->h };
if (SDL_GetRectUnion(&irect, bounds, &r) == false) {
shit("rect union math fail: %s", SDL_GetError());
return false;
}
return SDL_RectsEqual(&irect, &r);
}