Coordinate system

Forum for alternative clients, mods & discussions on the same.

Coordinate system

Postby nixilus » Wed Mar 29, 2017 6:29 pm

Hi guys!
Could you please explain me what Coord and Coord2d are, and how does rc and sc of Gob are connected with each other?
And what the difference between w9's coordinate system and w10's in general?
For example, here's old version of a method which finds a nearest gob to the point by the given resname.

Code: Select all
  public Gob findNearestObjectToPoint(int radius, Coord coord, String... names) {
        Coord my = coord;
        double min = radius*11;
        Gob nearest = null;
        synchronized (ui().sess.glob.oc) {
            for (Gob gob :ui().sess.glob.oc) {
                double dist = gob.rc.dist(my);
                if (dist < min) {
                    boolean matches = false;
                    for (String name : names) {
                        if (gob.getres()!=null) {
                            if (gob.getres().name.contains(name)) {
                                matches = true;
                                break;
                            }
                        }
                    }
                    if (matches) {
                        min = dist;
                        nearest = gob;
                    }
                }
            }
        }
        return nearest;
    }


How I'll need to change it to get it work with w10 coord system?
nixilus
 
Posts: 9
Joined: Fri Apr 08, 2016 1:21 am

Re: Coordinate system

Postby shubla » Wed Mar 29, 2017 8:29 pm

I think that only difference with coord and Coord2d is that Coord2d uses floats or something. I also think that they are both only used to store locations of points in two dimensional space. They also include some useful quick functions to modify these values.

I think only difference that has recently been made to coordinate system was to use floats instead of ints. Though clients still use the old integer one for many things as theres no really need for float values in stuff such as locations of ui things on the screen.
Image
I'm not sure that I have a strong argument against sketch colors - Jorb, November 2019
http://i.imgur.com/CRrirds.png?1
Join the moderated unofficial discord for the game! https://discord.gg/2TAbGj2
Purus Pasta, The Best Client
User avatar
shubla
 
Posts: 13043
Joined: Sun Nov 03, 2013 11:26 am
Location: Finland

Re: Coordinate system

Postby nixilus » Wed Mar 29, 2017 9:12 pm

shubla wrote:I think that only difference with coord and Coord2d is that Coord2d uses floats or something. I also think that they are both only used to store locations of points in two dimensional space. They also include some useful quick functions to modify these values.

I think only difference that has recently been made to coordinate system was to use floats instead of ints. Though clients still use the old integer one for many things as theres no really need for float values in stuff such as locations of ui things on the screen.


I see. So, the wdgmsg arguments format for clicking/interacting/etc hasn't changed? No new arguments is necessary?
nixilus
 
Posts: 9
Joined: Fri Apr 08, 2016 1:21 am

Re: Coordinate system

Postby Paradoxs » Fri Mar 31, 2017 7:00 am

nixilus wrote:
shubla wrote:I think that only difference with coord and Coord2d is that Coord2d uses floats or something. I also think that they are both only used to store locations of points in two dimensional space. They also include some useful quick functions to modify these values.

I think only difference that has recently been made to coordinate system was to use floats instead of ints. Though clients still use the old integer one for many things as theres no really need for float values in stuff such as locations of ui things on the screen.


I see. So, the wdgmsg arguments format for clicking/interacting/etc hasn't changed? No new arguments is necessary?


No the arguments haven changed, post update my client still clicks where it should.
User avatar
Paradoxs
 
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am


Return to The Wizards' Tower

Who is online

Users browsing this forum: No registered users and 3 guests