src/proto2/Terrain.hh
changeset 150 5e032b540af3
parent 149 ce4d8f12373a
child 151 9fc900fbfa79
equal deleted inserted replaced
149:ce4d8f12373a 150:5e032b540af3
    46      * Get pixel location of a point that is in "real" units.
    46      * Get pixel location of a point that is in "real" units.
    47      *
    47      *
    48      * @param point Point in "real" units
    48      * @param point Point in "real" units
    49      * @return Int vector
    49      * @return Int vector
    50      */
    50      */
    51     Vector getPixelLocation(Vector point);
    51     Vector getPixelLocation(Vector point) const;
    52 
    52 
    53     /**
    53     /**
    54      * Scale parameter to "pixels"
    54      * Scale parameter to "pixels"
    55      *
    55      *
    56      * @param x Scaled value
    56      * @param x Scaled value
    57      * @return Corresponding value in pixels
    57      * @return Corresponding value in pixels
    58      */
    58      */
    59     uint16_t scale(float x);
    59     uint16_t scale(float x) const;
    60 
    60 
       
    61  public:
       
    62 
       
    63     // TODO: This should be private.
    61     /**
    64     /**
    62      * Return the type of terrain at given position. Returns ROCK if
    65      * Return the type of terrain at given position. Returns ROCK if
    63      * given point is not inside terrain area.
    66      * given point is not inside terrain area.
    64      *
    67      *
    65      * @param x X coordinate
    68      * @param x X coordinate
    66      * @param y Y coordinate
    69      * @param y Y coordinate
    67      * @return Terrain type
    70      * @return Terrain type
    68      */
    71      */
    69     TerrainType getType(uint16_t x, uint16_t y);
    72     TerrainType getType(int32_t x, int32_t y) const;
    70 
    73 
    71 public:
       
    72     /**
    74     /**
    73      * Constructor.
    75      * Constructor.
    74      *
    76      *
    75      * @param scale The "real" width and height of the terrain.
    77      * @param scale The "real" width and height of the terrain.
    76      */
    78      */
    90      */
    92      */
    91     Terrain(const Terrain &t);
    93     Terrain(const Terrain &t);
    92     /**
    94     /**
    93      * Destructor
    95      * Destructor
    94      */
    96      */
    95     ~Terrain();
    97     ~Terrain() {}
    96 
    98 
    97     /**
    99     /**
    98      * Check if given point has some terrain.
   100      * Check if given point has some terrain.
    99      *
   101      *
   100      * @param point Point that is in scaled units.
   102      * @param point Point that is in scaled units.
   112      * Remove a circular area from terrain.
   114      * Remove a circular area from terrain.
   113      *
   115      *
   114      * @param pos Circle center
   116      * @param pos Circle center
   115      * @param r Circle radius
   117      * @param r Circle radius
   116      */ 
   118      */ 
   117     void removeGround(Vector pos, float r);
   119     void removeGround(const Vector &pos, const float &r);
   118 
   120 
   119     /**
   121     /**
   120      * Return normal for the given point.
   122      * Return normal for the given point.
   121      *
   123      *
   122      * @param point Point for which the normal is calculated.
   124      * @param point Point for which the normal is calculated.
   134     /**
   136     /**
   135      * Draw the terrain for given graphicscontext.
   137      * Draw the terrain for given graphicscontext.
   136      *
   138      *
   137      * @param gc CL_GraphicContext
   139      * @param gc CL_GraphicContext
   138      */
   140      */
   139     void draw(CL_GraphicContext *gc) const;
   141     void draw(CL_GraphicContext *gc);
   140     /**
   142     /**
   141      * Draw part of the terrain for given graphiscontext.
   143      * Draw part of the terrain for given graphiscontext.
   142      *
   144      *
   143      * @param gc CL_GraphicContext
   145      * @param gc CL_GraphicContext
   144      * @param center Center of the rectangle drawn.
   146      * @param center Center of the rectangle drawn.
   145      * @param dimension Dimensions of the rectangle.
   147      * @param dimension Dimensions of the rectangle.
   146      */
   148      */
   147     void draw(CL_GraphicContext &gc, Vector center, Vector dimensions);
   149     //void draw(CL_GraphicContext &gc, Vector center, Vector dimensions);
   148 
   150 
   149     /**
   151     /**
   150      * Set terrain.
   152      * Set terrain.
   151      *
   153      *
   152      * @param terrain Terrain.
   154      * @param terrain Terrain.