Stewid Iriot

Hi All,

Ever had one of those days when you feel you can’t get anything right. I started a new project yesterday and wrote quite a bit of code before testing it. When I ran it I had a problem - everything I had drawn seemed to be offset? Wierd, tried for hours changeing my parameters etc but to no avail. In the end I stripped it down and started with a minimal skeleton. Still the same problem. Decided my pad had a problem, display mode seemed to change. Then I looked back at my code ---- STEWID IRIOTI!!!

Look at this minimum code and try it out:

-- Use this function to perform your initial setup
function setup()
    --
    midX = WIDTH/2
    midY = HEIGHT/2
    Loff = (WIDTH-600)/2
    Hoff = (HEIGHT-600)/2   
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    displayMode(FULLSCREEN)       
    background(0, 0, 0, 255)
    -- This sets the line thickness
    stroke(249, 53, 16, 255)
    strokeWidth(5)
    -- Do your drawing here
    rect(Loff, Hoff, WIDTH-2*Loff, HEIGHT-2*Hoff)    
end

Mind you I would never have expected this, as long as my pad was held in a fixed orientation.

Back to school and Dunce cap in the corner.

Bri_G

:slight_smile:

Had similar issues namely with adjusting my parameters. For some reason no matter which program Im using when I adjust my parameters Codea crashes. This wont be an immediate crash? It wil happen whenever I try to max one out?

Hi @Anonycode,

Have you tried posting some of your code? Without seeing the code people can’t make judgements, just give you generalities which are helpful but, I find rarely help. Much better if you can get down to the nitty gritty.

If you have a small program post it here. Bigger ones would need github or dropbox for posts.

Everyone has these problems - it’s easier writing code than it is removing the bugs!!!

Bri_G

:slight_smile:

Is this a problem you are having now; or is this a demo problem for others to figure out?

displayMode(FULLSCREEN) needs to be in your setup() function, before values are set based on WIDTH and HEIGHT. Otherwise, WIDTH and HEIGHT are set to the dimensions of the screen BEFORE the debug panel goes away.

This had me in the same mindset as you for a couple minutes.

Hi @scatterbraincc,

It’s kinda of a - look what this noob’s done. It took me ages to find the problem and I thought other users would appreciate seeing the effect. Better armed with the knowledge then it’s easier to recognise.

Thanks,

Bri_G

:slight_smile: