Is Rect.Centered() Correct ?

About Monkey 2 Forums Monkey 2 Development Is Rect.Centered() Correct ?

This topic contains 7 replies, has 2 voices, and was last updated by  Diffrenzy 2 years, 6 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #4265

    Diffrenzy
    Keymaster

    Gives what I expect to be the result, which in turn would make Rect.Centered (based on CenterThis) :

    #4266

    Diffrenzy
    Keymaster

    .

    #4312

    Mark Sibly
    Keymaster

    I think it’s right – centering a rect doesn’t change its size, just it’s location.

    #4313

    Diffrenzy
    Keymaster

    which is why it need to return r’s size not Self.Width and Height I think

    #4314

    Mark Sibly
    Keymaster

    That *would* change self’s size though, it’d change it to r’s size!

    #4319

    Diffrenzy
    Keymaster

    Same size, but wrong location!

    Print r1.Left  ( this should be 100 + (40-20)/2  = 110 but is 10 )
    Print r1.Top ( this should be 100 + (60-30)/2  = 115 but is 15 )

    [EDITED]

    #4411

    Mark Sibly
    Keymaster

    > Same size, but wrong location!

    Ha, yes! Will fix.

    #4412

    Diffrenzy
    Keymaster

    Great, thanks 🙂

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.