This commit is contained in:
cat 2025-06-05 16:38:39 +10:00
parent 0fc07ac95e
commit cf5334fb66
3 changed files with 18 additions and 3 deletions

View file

@ -26,11 +26,11 @@ samply_step(State *st)
x++;
babble("bounds %d %d %d %d", st->bounds.x, st->bounds.y,
st->bounds.w, st->bounds.h);
babble("img %d %d %d %d", x, y, st->sam->tx->w, st->sam->tx->h);
babble("img %d %d %d %d", x, y, st->sam->tx->w / 4, st->sam->tx->h);
// if (in_bounds(st->sam->tx, x, y, &st->bounds) == false) {
if (st->bounds.w - st->sam->tx->w < x) {
if (st->bounds.w - st->sam->tx->w / 4 < x) {
st->sam->tx = st->sam->idle;
x = st->bounds.w - st->sam->tx->w;
x = st->bounds.w - st->sam->tx->w / 4;
babble("*bonk*");
}
if (SDL_SetWindowPosition(st->win, x, y) == false)
@ -53,6 +53,8 @@ put_samply_to_bed(Samply *sam)
free_image(sam->walka);
babble("free samply walk b!!");
free_image(sam->walkb);
babble("free samply woozy!!");
free_image(sam->error);
babble("good night, samply!!");
SDL_free(sam);
}
@ -94,6 +96,14 @@ wake_samply_up(State *st)
return NULL;
}
babble("samply woozy!!");
sam->error = load_image(st->ren, "samply/SamplyERROR.png");
if (!sam->error) {
fuck("samply would rather stay in bed. too bad!");
put_samply_to_bed(sam);
return NULL;
}
sam->tx = sam->idle;
return sam;