That was quick. Good work.
Now I see your source I have a few things I’d like to point out.
You’re not supposed to include
.cpp files because it can upset the compiler.
See this StackOverflow question for more details:
It probably seems a bit odd if you aren’t used to C++,
but when you realise that
#include basically does a copy and paste instead of something more intelligent and that
.cpp files are compiled regardless of whether they are included, it makes sense why including
.cpp files would cause errors (by breaking the ‘one definition’ rule).
Most people use
&& instead of
|| instead of
or only exist for historical reasons (specifically for keyboards that didn’t have a
You don’t need your
Arduboy2 has a
justPressed function (though you must remember to call
arduboy.pollButtons(); once each frame for it to work).
One or two of your functions are lacking their
void return type.
(I think it’s just
And if you’re passing string literals directly to print, wrap them in the
F macro puts the string in progmem and uses the overload of
print that can print strings that are stored in progmem.
There’s probably various other improvements that can be made, but those are the most glaring ones.
One last thing, I see you’re doing
posX >> 8 and
posY >> 8 and
* 256 (which is actually equivalent to
does that mean you’re using fixed points for coordinates?