Annoying Codea glitch :P

Sup all,

I’m having a weird issue using displayMode(FULLSCREEN) and setContext()
Basically, it seems that the non fullscreen value are used for the WIDTH/HEIGHT constants when using setContext() to reset drawing to the screen.
It’s fixed when “reseting” the program during runtime.

I’ve wasted a good few hours trying to find a fix but seeing it’s still glitching when using the simplest code, I’m starting to think maybe it’s not my fault ^^

So, is this a glitch to be reported or am I doing something wrong ?

function setup()
    displayMode(FULLSCREEN)
    img = image(WIDTH, HEIGHT)
    setContext(img)
    sprite("Small World:Church", WIDTH/2, HEIGHT/2, WIDTH, HEIGHT)
    -- not needed I believe, but doesn't change anything
    setContext()
end

function draw()
    background(0,0,0,255)
    -- specifying the WIDTH/HEIGHT isn't needed, but either way, not working
    sprite(img, WIDTH/2, HEIGHT/2, WIDTH, HEIGHT)
end

Cheers,

Xavier

@Xavier it could be that WIDTH and HEIGHT are not updated immediately after a call to displayMode() in setup(). In fact, I think this issue came up once before (and I thought I had fixed it). Try moving the displayMode(FULLSCREEN) call outside of your setup() function into global scope at the top of your Main file.

hah never thought of that :slight_smile:

problem fixed, thank you :stuck_out_tongue:

Xavier