diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2020-04-19 16:07:21 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2020-04-19 16:07:21 -0700 |
commit | 308d0ee789659778210662ca9156981944452ccc (patch) | |
tree | 1e2021b57e96c25f0f69326e9f1cfac73dc1a347 /src/bb2f.h | |
parent | c068006e340c83fe7099b0e63daf33dbd94b9432 (diff) |
src: implement a game for Blender 2020
The theme of this Blender was:
Monkeys / Rescuing / Between Realities
With all the COVID-19 stuff going on, it seemed like a fun way
to lighten things up a bit to make something where a monkey runs
around trying to rescue child monkeys from coronaviruses moving
across the playfield. In keeping with the theme, to rescue the
helpless monkeys you take them to a different reality by carrying
them off the window/screen. As infections increase the field
becomes crowded with viruses until your player becomes infected
through contact, ending your game.
This was written quickly kamikaze style overnight. Some
scaffolding bits came from past projects of mine like the vector
headers, shader and texture node building blocks, and the plasma
effect has been used a few times now and originally was derived
from some gpu programming tutorial if memory serves. I just
wanted to put something in the background for this strange
reality.
This is the first time I've used libplay, in fact, it was
basically slapped together last night at the start of this to
avoid having to do all that SDL initialization all over again.
The unique meat of this work is in game.c, there isn't really all
that much to this game though. It's not pretty code, but it
works well enough and this task served as a useful exercise of
trying to get some quick game dev done using this collection of
facilities.
Most the heavy lifting comes from my reused libraries which are
slowly evolving into something somewhat effective for simple game
development.
Enjoy, and happy hacking!
Diffstat (limited to 'src/bb2f.h')
-rw-r--r-- | src/bb2f.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/bb2f.h b/src/bb2f.h new file mode 100644 index 0000000..dc0a765 --- /dev/null +++ b/src/bb2f.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2018-2020 - Vito Caputo - <vcaputo@pengaru.com> + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _BB2F_H +#define _BB2F_H + +#include "v2f.h" + +typedef struct bb2f_t { + v2f_t min, max; +} bb2f_t; + + +/* linearly interpolate between a and b by t */ +static inline bb2f_t bb2f_lerp(const bb2f_t *a, const bb2f_t *b, float t) +{ + bb2f_t bb2f; + + bb2f.min = v2f_lerp(&a->min, &b->min, t); + bb2f.max = v2f_lerp(&a->max, &b->max, t); + + return bb2f; +} + +#endif |