Re: [AD] new GUI focus selection algorithm |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> But this computation is not going to be done more often than the user
> presses a key!
Sure, but times the number of objects on the screen.
> That said, we can avoid square roots by comparing the _squares_ of the
> (Euclidean) distances. It will be faster and not change the behavior.
I'm a big fan of the man who said: "If you can avoid a multiplication,
then... avoid it." :-)
> If our circles look like squares, then A and B have the same distance to
> C in this example:
>
> A B
>
>
> C
>
> So moving up from C could equally well move to A or B (or always to A,
> if it ends one pixel below B).
Well, it depends upon the orientation of the squares. Certainly we won't take
squares (or boxes) that are along the axes. See Shawn's original solution.
> That could make sense, although it will be tedious to implement because
> we want to swap the weights when moving horizontally vs vertically.
I can assure you that I've seen more tedious things :-)
--
Eric Botcazou