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 | |
| parent | f732cdaf7374fde737b503ec6966fb8cd8f4c32b (diff) | |
| download | therapy-2e66b27372b3547ea98ec914974c4fcdedd08053.tar.gz therapy-2e66b27372b3547ea98ec914974c4fcdedd08053.tar.bz2 therapy-2e66b27372b3547ea98ec914974c4fcdedd08053.zip | |
Map editor widget now starts out centered
| -rw-r--r-- | tools/mapedit/src/frame.cpp | 1 | ||||
| -rw-r--r-- | tools/mapedit/src/widget.cpp | 17 | ||||
| -rw-r--r-- | tools/mapedit/src/widget.h | 1 |
3 files changed, 12 insertions, 7 deletions
| diff --git a/tools/mapedit/src/frame.cpp b/tools/mapedit/src/frame.cpp index b8b4326..cc45c29 100644 --- a/tools/mapedit/src/frame.cpp +++ b/tools/mapedit/src/frame.cpp | |||
| @@ -341,6 +341,7 @@ MapeditFrame::MapeditFrame(World* world) : wxFrame(NULL, wxID_ANY, "Map Editor") | |||
| 341 | dontSelectMap = false; | 341 | dontSelectMap = false; |
| 342 | 342 | ||
| 343 | SetStartposLabel(); | 343 | SetStartposLabel(); |
| 344 | mapEditor->SetUpZoom(2); | ||
| 344 | } | 345 | } |
| 345 | 346 | ||
| 346 | void MapeditFrame::OnExit(wxCloseEvent& event) | 347 | void MapeditFrame::OnExit(wxCloseEvent& event) |
| 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 |
| diff --git a/tools/mapedit/src/widget.h b/tools/mapedit/src/widget.h index b019088..c1bff31 100644 --- a/tools/mapedit/src/widget.h +++ b/tools/mapedit/src/widget.h | |||
| @@ -30,6 +30,7 @@ class MapeditWidget : public wxScrolledCanvas { | |||
| 30 | MapeditWidget(); | 30 | MapeditWidget(); |
| 31 | MapeditWidget(wxWindow* parent, wxWindowID winid, Map* map, TileWidget* tileWidget, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); | 31 | MapeditWidget(wxWindow* parent, wxWindowID winid, Map* map, TileWidget* tileWidget, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); |
| 32 | 32 | ||
| 33 | void SetUpZoom(int zoom); | ||
| 33 | void ZoomIn(); | 34 | void ZoomIn(); |
| 34 | void ZoomOut(); | 35 | void ZoomOut(); |
| 35 | void SetEditMode(EditMode editMode); | 36 | void SetEditMode(EditMode editMode); |
