[Request] display.translate(int dx, int dy)

This function would shift all draw operations by the dx and dy offsets. Love2d has this and it is incredible useful for many different things. Unsure if Pokittos API has anything similar, if so please point it out for me! :slight_smile:

This is how the love2d wiki described it:

When this function is called with two numbers, dx, and dy, all the following drawing operations take effect as if their x and y coordinates were x+dx and y+dy.

just have 2 camera variables you add to all your draw calls prety easy to do
or just a function/class you can make yourself

translate is part of a set of functions in love2D like scale, rotate, push and pop
but those are a bit heavy on calculations

sneak this in a header somewhere :stuck_out_tongue:

int cameraX, cameraY;
void translate(int x, int y){ cameraX += x; cameraY += y; }

void drawSprite(int16_t x, int16_t y, const uint8_t * bitmap, uint8_t rotation, uint8_t flip){
    game.display.drawBitmap(cameraX+x ,cameraY+y , bitmap, rotation, flip);
void pop(){cameraX = 0; cameraY = 0;}
1 Like

This would actually work just fine. Thanks!

This is actually a pretty cool idea. I could implement it so that you can choose whether this feature is on or off with a compile switch. Then you can either use it (some computational overhead) or not use it (maximum drawing performance).

Thanks @trelemar for a really good idea

1 Like

well that sound not very intuitive, cant we just put this into an extended library (like a community driven single header file)

1 Like

You have a point. We need to think about this.