Howdy, Stranger!

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

Command line

in General Posts: 2,690

Hi All, Ashamed to say it but - I have been using Codea for years now and never used the command line for querying variables whilst the project is running. So, my issue - not sure it’s a problem yet. I set up a routine to put integer values into a vec2 variable for screen positions. Inputting a print statement in the command line to print the vec2 values printed out the two values as real numbers. Is this as per design? Are vec2 variables real numbers? Or is this a feature of the command line print statement?

Oh and what’s the => NIL about?


  • dave1707dave1707 Mod
    Posts: 9,981

    @Bri_G As long as I can remember, printing a vec always printed a float. There's also other things that print as a float even though they contain an integer. Not sure about the => NIL. You've never used the command line before. If I would have known that I would have told you about it years ago.

  • SimeonSimeon Admin Mod
    Posts: 5,778

    @Bri_G vec2 values are floats internally. We'd need to support some sort of ivec2 type if we were to have integers

    But for screen positions I would recommend using floating point representation because, especially on retina displays, your actual real pixel boundaries can lie on fractional positions

    On an iPad you have pixels at integer positions and at 0.5 way between integer positions. On 3x iPhones you have them at 0.33 and 0.66

  • Posts: 2,690
    @dave1707 - didn't use the command line as found it more convenient to use or print(). Tried it recently to interrogate a table and surprised at how useful it can be. Thanks.

    @Simeon - thanks for the detail on screen definition. If Apple keep refining this it could get quite complicated programming for different screen types!!! Thsnks.
Sign In or Register to comment.