Why is this rect only half the size of the canvas when using the Draw Pixels extension? (SOLVED)

Very new to defold & trying to get the hang of things. I’m using the drawpixels asset. In troubleshooting something else, I noticed that the things I was drawing weren’t in the place they’re supposed to be.

Here’s a stripped down example: It’s the stock drawpixels example scene, except the game window is 1024x1024. I adjusted the size of the backing image to 1024x1024 as well, and set the width & height of the buffer_info to 1024.

At the end of initialization, I then call

drawpixels.filled_rect(self.buffer_info, 0,0, 1024,1024, 255,0,0, 255)

which I think should draw a red rect that takes up the whole screen, but it only draws it in the lower left quarter of the screen. What am I doing wrong?

oh whoops. I don’t know how to edit my post and I forgot to include the sample.

repro.zip (8.0 MB)

The first two coordinates you provide are not bottom left corner but actually the center of the rect. So in your case it should look like this:

drawpixels.filled_rect(self.buffer_info, 512,512, 1024,1024, 255,0,0, 255)
1 Like

:man_facepalming: oh of course. I can’t believe I overlooked that. Thank you, I probably would’ve lost at least another day before figuring that out.

3 Likes