{SOLVED} MKR IOT Carrier as a game console

The thing has a cool colour display. It has five buttons. And a tilt sensor. And a piezo buzzer. That's enough for a cool game console, isn't it? I started with this Breakout game:

Tilt the device to move the paddle.
At the moment, the ball doesn't bounce off the objects in the middle. I expected to find a getPixel() function, but there isn't one. There appears to be a getPixelColor() function, at least the syntax highlightning says so, but the compiler doesn't recognise that either.

So without a getPixel() function it is a bit hard to do collision detection. Another thing missing is using full colour (well, 16 bit colour) sprites. I might be able to draw full colour bitmaps from the SD card to the screen. But from memory I can only draw monochrome bitmaps. I guess there are ways to read and write to some screen memory, but if that is possible, I find it strange that the library doesn't have C/C++ functions for that. One has to write functions of one's own.

getPixel() can be performed on a bitmap, but not on the screen. So I created the ful colour bitmap as a GFXcanvas16 object. This can be used as a sprite and instead of reading pixels on the screen, I read the correponding pixels from the bitmap. I do the corresponding drawing directly to the bitmap and then I draw the bitmap to the screen with drawRGBBitmap().

I show a playable version of the game in another thread. The code is still in its spaghetti stage, but I could share it in the other thread.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.