Pan, zoom, and mouse-to-gridsquare translation that I can be proud of. Cleanup required, though
This commit is contained in:
parent
b0ef1d2303
commit
a4b6c2c428
3 changed files with 115 additions and 99 deletions
|
|
@ -29,14 +29,16 @@ public:
|
|||
Grid(int gx, int gy, int gs, int _x, int _y, int _w, int _h);
|
||||
int grid_x, grid_y; // rectangle map size (integer - sprites)
|
||||
int grid_size; // pixel size of 1 sprite
|
||||
float zoom, center_x, center_y; // center in fractional sprites
|
||||
float zoom;
|
||||
int center_x, center_y; // center in 1.0x Pixels
|
||||
|
||||
std::vector<GridPoint> points; // grid visible contents
|
||||
void render(sf::RenderWindow&); // draw to screen
|
||||
GridPoint& at(int, int);
|
||||
bool inBounds(int, int);
|
||||
void screenToGrid(int, int, int&, int&);
|
||||
GridPoint* atScreenPixel(int, int, int*, int*);
|
||||
|
||||
|
||||
void renderPxToGrid(int, int, int&, int&);
|
||||
void gridToRenderPx(int, int, int&, int&);
|
||||
void integerGrid(float, float, int&, int&);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue