Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Drawing a filled image

in Bugs Posts: 2,261

Hi All,

Ran into this today, not sure if this is a true error or me being stupid. Ran following on iOS 10.1 on iPad Pro 9.7".

displayMode(OVERLAY) -- Use this function to perform your initial setup function setup() test = image(500,500) tw, th = spriteSize(test) setContext(test) rectMode(CENTER) fill(221, 32, 32, 255) rect(WIDTH/2, HEIGHT/2, tw, th) -- background(255, 0, 4, 255) setContext() print(tw, th) end -- This function gets called once every frame function draw() -- This sets a dark background color background(40, 40, 50) -- This sets the line thickness strokeWidth(0) fill(228, 184, 55, 255) rect(WIDTH/2, HEIGHT/2, tw, th) spriteMode(CENTER) sprite(test, WIDTH/2, HEIGHT/2) end

I expect to get a square red sprite centred on the screen, but I see a small red rectangle with a bigger yellow square behind. If I use a red background on the sprite I get the sprite I need with none of the yellow rectangle showing. Can someone please confirm this and tell me what I am doing wrong?




  • Posts: 2,261


    Please ignore this, found the problem the rectangle written to the sprite uses the screen centre point coordinates not that of the sprite !!

    Doh!!! Late night, need sleeeeep !!!!



  • dave1707dave1707 Mod
    Posts: 9,279

    @Bri_G Don't worry about it. I do things like that even after a good nights sleep. Sometimes it's hard to keep track of the default settings.

Sign In or Register to comment.