Hey all,
How does the Adruboy make decisions when displaying “uneven” graphics? I’ve created a sketch that loads a bitmap with an uneven width (49 pixels wide) and an uneven height (51 pixels) to the “centre” of the screen.
Firstly, I created this function:
//The drawCentre function.
int drawCentre(int width,int height,int graphic, int colour)
{
//Set up a central display.
int x = 0.5WIDTH - 0.5width;
int y = 0.5HEIGHT - 0.5height;
arduboy.drawBitmap(x,y,graphic,width,height,colour);
}
During the loop, I call it as so:
//Draw the graphic.
drawCentre(uuWidth,uuHeight,uuGraphic,WHITE);
So here’s the thing: 0.5WIDTH is 64, and 0.5width (the sprite’s width of 49 pixels) is 24.5. 0.5WIDTH + 0.5width equals 88.5, meaning that I’m drawing the graphic from the 88.5th pixel on the screen, right? What is actually happening here? I’ve uploaded a photo of the graphic to this thread and you can see that it’s drawn very clearly.
How does the Arduboy choose where to draw a graphic that starts at a position like 88.5 pixels on the x axis? Please keep in mind that I’m a real novice.
Thanks!