Hi, I’d like to buffer my inputs as an array of bitmasks, so that I can take the maximum value once all the buttons are released. So for example giving my function an array [ X, Y, X + Y ] , I can return X+Y.
But there doesn’t seem to be a way to create an array of bitmasks. Is it possible some other way, or using C++?
Thanks. The workflow where you mark an enum as a bitmask was throwing me off. For some reason a 0 value bitmask int is 256 and I take it you can’t use them in arrays as they take up a lot of memory?
I decided to do basically as you said for now, but instead of bitwise operations on ints I used a byte and add/subtract powers of two.
Adding and subtracting powers of two kind of works, but it is so easy to add twice same power, and you can get strange errors in code. It is better to use bitwise OR.
For this function you need to set masks in same order you made enums.
Better (less prone to bugs) is to give results with (switch on enum), that is more readable.
Function is set to be “pure”