diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-18 00:08:56 -0400 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-18 00:08:56 -0400 |
| commit | 2e66b27372b3547ea98ec914974c4fcdedd08053 (patch) | |
| tree | 0af7d57c0c0c57aa45bdbfe55cbbdb17b772dcbb /tools/mapedit/src/widget.cpp | |
| parent | f732cdaf7374fde737b503ec6966fb8cd8f4c32b (diff) | |
| download | therapy-2e66b27372b3547ea98ec914974c4fcdedd08053.tar.gz therapy-2e66b27372b3547ea98ec914974c4fcdedd08053.tar.bz2 therapy-2e66b27372b3547ea98ec914974c4fcdedd08053.zip | |
Map editor widget now starts out centered
Diffstat (limited to 'tools/mapedit/src/widget.cpp')
| -rw-r--r-- | tools/mapedit/src/widget.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
| diff --git a/tools/mapedit/src/widget.cpp b/tools/mapedit/src/widget.cpp index c74b194..aaebd38 100644 --- a/tools/mapedit/src/widget.cpp +++ b/tools/mapedit/src/widget.cpp | |||
| @@ -38,17 +38,20 @@ void MapeditWidget::Init() | |||
| 38 | 38 | ||
| 39 | this->FitInside(); | 39 | this->FitInside(); |
| 40 | this->SetScrollRate(5, 5); | 40 | this->SetScrollRate(5, 5); |
| 41 | 41 | } | |
| 42 | SetVirtualSize(EDITOR_WIDTH, EDITOR_HEIGHT); | 42 | |
| 43 | 43 | void MapeditWidget::SetUpZoom(int zoom) | |
| 44 | int cW, cH; | 44 | { |
| 45 | int cW, cH, vXX, vXY; | ||
| 45 | GetClientSize(&cW, &cH); | 46 | GetClientSize(&cW, &cH); |
| 47 | GetScrollPixelsPerUnit(&vXX, &vXY); | ||
| 48 | |||
| 46 | mousePos.x = cW / 2; | 49 | mousePos.x = cW / 2; |
| 47 | mousePos.y = cH / 2; | 50 | mousePos.y = cH / 2; |
| 48 | 51 | ||
| 49 | // Scroll(GAME_WIDTH*1.5-mousePos.x, GAME_HEIGHT*1.5-mousePos.y); | 52 | scale = zoom; |
| 50 | 53 | SetVirtualSize(EDITOR_WIDTH * scale, EDITOR_HEIGHT * scale); | |
| 51 | SetZoomSize(2); | 54 | Scroll((EDITOR_WIDTH*scale-cW)/2/vXX, (EDITOR_HEIGHT*scale-cH)/2/vXY); |
| 52 | } | 55 | } |
| 53 | 56 | ||
| 54 | wxSize MapeditWidget::DoGetBestSize() const | 57 | wxSize MapeditWidget::DoGetBestSize() const |
