summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-03-17 15:58:02 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-03-17 15:58:02 -0400
commit5c6d5cf1b4a22ae6d35b9c081bf34afec263ba63 (patch)
treec5df24939a0678abf14e0e79fd2d5b0bfe17328f
parent90ae982fc2bfdf2f4c049db747ce9516debb148a (diff)
downloadtherapy-5c6d5cf1b4a22ae6d35b9c081bf34afec263ba63.tar.gz
therapy-5c6d5cf1b4a22ae6d35b9c081bf34afec263ba63.tar.bz2
therapy-5c6d5cf1b4a22ae6d35b9c081bf34afec263ba63.zip
Made some nice changes to the map editor widget
Center the map edit widget
Map edit zooming in should happen around the cursor
Disallow editing outside the mapedit widget
Add some scroll space around the mapedit widget
-rw-r--r--maps/bigmap.txt25
-rw-r--r--maps/cozy.txt25
-rw-r--r--maps/embarass.xml28
-rw-r--r--maps/second.xml26
-rw-r--r--maps/smoothmap.pyxelbin3330 -> 0 bytes
-rw-r--r--res/maps.xml (renamed from maps/maps.xml)98
-rw-r--r--tools/mapedit/src/frame.cpp4
-rw-r--r--tools/mapedit/src/widget.cpp95
-rw-r--r--tools/mapedit/src/widget.h6
-rw-r--r--tools/mapedit/src/world.cpp2
10 files changed, 127 insertions, 182 deletions
diff --git a/maps/bigmap.txt b/maps/bigmap.txt deleted file mode 100644 index ebc021d..0000000 --- a/maps/bigmap.txt +++ /dev/null
@@ -1,25 +0,0 @@
1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2XXXXXXXXXXXXXXXXXXXXXXXXX XX
3XXXXXXXXXXXXXXXXXXXXXX X
4XXXXXXXXXXXXXXXXX X
5XXXXXXXXXXXXXX X
6XXXXXXXXXXXXXX XXXX
7XXXXXXXXXXXX XXXXXX
8XXXXXXX XXXXXXX
9XXX XXXXXXXXXXXX
10 XXXXXX
11
12 PPPP
13
14 PPPPPP
15 PPPP
16
17
18 PPPP
19
20
21 XXXXXXXXXXXXXXXXXXXX
22 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
23XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
24XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
25Everything Is Embarrassing \ No newline at end of file
diff --git a/maps/cozy.txt b/maps/cozy.txt deleted file mode 100644 index ab4c6f8..0000000 --- a/maps/cozy.txt +++ /dev/null
@@ -1,25 +0,0 @@
1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
6XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXX
8XXXXXXXXXXXXXXXXXXX XXXXXXX
9XXXXXXXXXXXXXXX XX
10XXXXXXXXXXX
11XXXXXXXXXX
12XXXXXXXX
13XXXXXXXX
14XXXXXX
15XXXX
16XXXX
17XXX
18XXX
19XXX
20XXXX
21XXXXXXXXX
22XXXXXXXXXXX
23XXXXXXXXXXXXXXXXX XXXXXXXXXXXX
24XXXXXXXXXXXXXXXXX XXXXXXXXXXXX
25It's A Trap! \ No newline at end of file
diff --git a/maps/embarass.xml b/maps/embarass.xml deleted file mode 100644 index 950854c..0000000 --- a/maps/embarass.xml +++ /dev/null
@@ -1,28 +0,0 @@
1<map-def>
2 <name>Everything Is Embarrassing</name>
3 <environment>0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,20,0,0,0,0,0,0,0,18,9,8,10,8,11,8,10,10,8,11,8,9,10,21,0,
40,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,8,8,17,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
190,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,6,6,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
210,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
220,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
230,0,0,0,0,0,0,0,0,0,24,4,2,1,3,3,1,4,2,2,1,1,1,3,1,2,4,1,3,26,0,0,0,0,0,0,0,0,0,0,
240,0,0,0,24,3,1,2,1,1,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,27,1,3,2,26,0,0,0,0,0,0,
251,2,3,1,25,0,0,0,0,0,20,0,0,0,0,0,0,19,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,27,1,2,2,4,3,1,
260,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,</environment>
27 <leftmap>second</leftmap>
28</map-def>
diff --git a/maps/second.xml b/maps/second.xml deleted file mode 100644 index f9212c0..0000000 --- a/maps/second.xml +++ /dev/null
@@ -1,26 +0,0 @@
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<map-def><name>It's A Trap!</name><environment>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
160,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,29,0,30,31,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
170,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
180,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,34,35,36,37,38,39,40,41,0,0,0,0,0,0,0,0,0,0,0,0,0,
190,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
200,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
210,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
220,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
230,0,0,27,2,2,3,3,3,4,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
240,20,0,0,0,0,0,19,0,0,27,1,1,1,2,2,2,26,0,0,0,0,0,0,0,0,0,0,24,4,2,2,1,3,2,2,1,2,2,3,
250,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,42,42,42,42,42,42,42,42,42,42,12,0,0,0,0,0,19,0,0,0,0,0,
26</environment><leftmap></leftmap><rightmap>embarass</rightmap><entities><entity><entity-type>checkpoint</entity-type><entity-position>257,160</entity-position></entity></entities></map-def>
diff --git a/maps/smoothmap.pyxel b/maps/smoothmap.pyxel deleted file mode 100644 index 25cc94e..0000000 --- a/maps/smoothmap.pyxel +++ /dev/null
Binary files differ
diff --git a/maps/maps.xml b/res/maps.xml index f7c11bf..4fdb43e 100644 --- a/maps/maps.xml +++ b/res/maps.xml
@@ -1,53 +1,53 @@
1<?xml version="1.0" encoding="ISO-8859-1"?> 1<?xml version="1.0" encoding="ISO-8859-1"?>
2<world><nextmapid>4</nextmapid><lastmap>2</lastmap><root>0</root><root>2</root><startpos id="2" pos="141,66"/><map id="0"><name>Embarrassing</name><environment>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2<world><nextmapid>4</nextmapid><lastmap>0</lastmap><root>0</root><root>2</root><startpos id="2" pos="141,66"/><map id="0"><name>Everything Is Embarrassing</name><environment>0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,20,0,0,0,0,0,0,0,18,9,8,10,8,11,8,10,10,8,11,8,9,10,21,0,
30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 30,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,22,21,
40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,8,8,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,
50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 50,19,0,0,0,0,0,0,0,0,0,0,0,18,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,
60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 60,0,0,0,0,0,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0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,
26</environment><leftmap></leftmap><rightmap></rightmap><entities><entity><entity-type>checkpoint</entity-type><entity-position>164,62</entity-position></entity></entities><child>1</child><child>3</child><expanded>1</expanded></map><map id="1"><name>Poop</name><environment>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 26</environment><leftmap>1</leftmap><rightmap></rightmap><entities><entity><entity-type>checkpoint</entity-type><entity-position>164,62</entity-position></entity></entities><child>1</child><child>3</child><expanded>1</expanded></map><map id="1"><name>It's A Trap!</name><environment>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
270,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 270,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,
280,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 280,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,
290,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 290,0,0,0,0,0,0,19,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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0,0,0,0, 490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,42,42,42,42,42,42,42,42,42,42,12,0,0,0,0,0,19,0,0,0,0,0,
50</environment><leftmap></leftmap><rightmap></rightmap><entities/></map><map id="2"><name>junk</name><environment>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 50</environment><leftmap></leftmap><rightmap>0</rightmap><entities/></map><map id="2"><name>junk</name><environment>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
510,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 510,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
520,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 520,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
diff --git a/tools/mapedit/src/frame.cpp b/tools/mapedit/src/frame.cpp index 2a553b6..6fb70c8 100644 --- a/tools/mapedit/src/frame.cpp +++ b/tools/mapedit/src/frame.cpp
@@ -134,7 +134,7 @@ MapeditFrame::MapeditFrame(std::unique_ptr<World> world) : wxFrame(NULL, wxID_AN
134 // Layout 3: Splitter between map editor and properties editor 134 // Layout 3: Splitter between map editor and properties editor
135 135
136 wxSplitterWindow* layout1 = new wxSplitterWindow(this, wxID_ANY); 136 wxSplitterWindow* layout1 = new wxSplitterWindow(this, wxID_ANY);
137 mapTree = new wxTreeCtrl(layout1, MAP_EDITOR_TREE, wxDefaultPosition, wxSize(200, 0), wxTR_HIDE_ROOT | wxTR_HAS_BUTTONS); 137 mapTree = new wxTreeCtrl(layout1, MAP_EDITOR_TREE, wxDefaultPosition, wxSize(150, 0), wxTR_HIDE_ROOT | wxTR_HAS_BUTTONS);
138 wxTreeItemId mapTreeRoot = mapTree->AddRoot("root"); 138 wxTreeItemId mapTreeRoot = mapTree->AddRoot("root");
139 populateMapTree(mapTreeRoot, this->world->getRootMaps()); 139 populateMapTree(mapTreeRoot, this->world->getRootMaps());
140 140
@@ -152,7 +152,7 @@ MapeditFrame::MapeditFrame(std::unique_ptr<World> world) : wxFrame(NULL, wxID_AN
152 mapEditor->frame = this; 152 mapEditor->frame = this;
153 153
154 // Set up property editor 154 // Set up property editor
155 wxPanel* propertyEditor = new wxPanel(layout3, wxID_ANY); 155 wxPanel* propertyEditor = new wxPanel(layout3, wxID_ANY, wxDefaultPosition, wxSize(-1, 100));
156 titleBox = new UndoableTextBox(propertyEditor, MAP_TITLE_TEXTBOX, currentMap->getTitle(), "Edit Map Title", this); 156 titleBox = new UndoableTextBox(propertyEditor, MAP_TITLE_TEXTBOX, currentMap->getTitle(), "Edit Map Title", this);
157 titleBox->SetMaxLength(40); 157 titleBox->SetMaxLength(40);
158 158
diff --git a/tools/mapedit/src/widget.cpp b/tools/mapedit/src/widget.cpp index 61a8d65..cb10489 100644 --- a/tools/mapedit/src/widget.cpp +++ b/tools/mapedit/src/widget.cpp
@@ -1,9 +1,14 @@
1#include "widget.h" 1#include "widget.h"
2#include "frame.h" 2#include "frame.h"
3 3
4IMPLEMENT_DYNAMIC_CLASS(MapeditWidget,wxScrolledWindow) 4const int EDITOR_SPACING_X = MAP_WIDTH * TILE_WIDTH / 2;
5const int EDITOR_SPACING_Y = MAP_HEIGHT * TILE_HEIGHT / 2;
6const int EDITOR_WIDTH = MAP_WIDTH * TILE_WIDTH + EDITOR_SPACING_X * 2;
7const int EDITOR_HEIGHT = MAP_HEIGHT * TILE_HEIGHT + EDITOR_SPACING_Y * 2;
5 8
6BEGIN_EVENT_TABLE(MapeditWidget, wxScrolledWindow) 9IMPLEMENT_DYNAMIC_CLASS(MapeditWidget,wxScrolledCanvas)
10
11BEGIN_EVENT_TABLE(MapeditWidget, wxScrolledCanvas)
7 EVT_PAINT(MapeditWidget::OnPaint) 12 EVT_PAINT(MapeditWidget::OnPaint)
8 EVT_LEFT_DOWN(MapeditWidget::OnClick) 13 EVT_LEFT_DOWN(MapeditWidget::OnClick)
9 EVT_RIGHT_DOWN(MapeditWidget::OnRightClick) 14 EVT_RIGHT_DOWN(MapeditWidget::OnRightClick)
@@ -18,7 +23,7 @@ MapeditWidget::MapeditWidget()
18} 23}
19 24
20MapeditWidget::MapeditWidget(wxWindow* parent, wxWindowID winid, Map* map, TileWidget* tileWidget, const wxPoint& pos, const wxSize& size) 25MapeditWidget::MapeditWidget(wxWindow* parent, wxWindowID winid, Map* map, TileWidget* tileWidget, const wxPoint& pos, const wxSize& size)
21 : wxScrolledWindow(parent, winid, pos, size), map(map), tileWidget(tileWidget) 26 : wxScrolledCanvas(parent, winid, pos, size), map(map), tileWidget(tileWidget)
22{ 27{
23 Init(); 28 Init();
24} 29}
@@ -30,12 +35,21 @@ void MapeditWidget::Init()
30 this->FitInside(); 35 this->FitInside();
31 this->SetScrollRate(5, 5); 36 this->SetScrollRate(5, 5);
32 37
38 SetVirtualSize(EDITOR_WIDTH, EDITOR_HEIGHT);
39
40 int cW, cH;
41 GetClientSize(&cW, &cH);
42 mousePos.x = cW / 2;
43 mousePos.y = cH / 2;
44
45// Scroll(GAME_WIDTH*1.5-mousePos.x, GAME_HEIGHT*1.5-mousePos.y);
46
33 SetZoomSize(2); 47 SetZoomSize(2);
34} 48}
35 49
36wxSize MapeditWidget::DoGetBestSize() const 50wxSize MapeditWidget::DoGetBestSize() const
37{ 51{
38 return {GAME_WIDTH*2, GAME_HEIGHT*2}; 52 return {EDITOR_WIDTH*scale, EDITOR_HEIGHT*scale};
39} 53}
40 54
41void MapeditWidget::OnPaint(wxPaintEvent&) 55void MapeditWidget::OnPaint(wxPaintEvent&)
@@ -43,12 +57,18 @@ void MapeditWidget::OnPaint(wxPaintEvent&)
43 wxPaintDC dc(this); 57 wxPaintDC dc(this);
44 wxMemoryDC tiles_dc; 58 wxMemoryDC tiles_dc;
45 tiles_dc.SelectObject(tiles); 59 tiles_dc.SelectObject(tiles);
46 int vX, vY; 60
61 int vX, vY, vXX, vXY, vW, vH, cW, cH;
47 GetViewStart(&vX, &vY); 62 GetViewStart(&vX, &vY);
48 int vXX, vYX; 63 GetVirtualSize(&vW, &vH);
49 GetScrollPixelsPerUnit(&vXX, &vYX); 64 GetClientSize(&cW, &cH);
65 GetScrollPixelsPerUnit(&vXX, &vXY);
50 vX *= vXX; 66 vX *= vXX;
51 vY *= vYX; 67 vY *= vXY;
68
69 dc.SetPen(*wxGREY_PEN);
70 dc.SetBrush(*wxGREY_BRUSH);
71 dc.DrawRectangle(0, 0, cW, cH);
52 72
53 for (int y=0; y<MAP_HEIGHT; y++) 73 for (int y=0; y<MAP_HEIGHT; y++)
54 { 74 {
@@ -60,7 +80,9 @@ void MapeditWidget::OnPaint(wxPaintEvent&)
60 tile = tileWidget->getSelected(); 80 tile = tileWidget->getSelected();
61 } 81 }
62 82
63 dc.StretchBlit(x*TILE_WIDTH*scale-vX, y*TILE_HEIGHT*scale-vY, TILE_WIDTH*scale, TILE_HEIGHT*scale, &tiles_dc, tile%8*TILE_WIDTH, tile/8*TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT); 83 wxPoint pos {(x*TILE_WIDTH + EDITOR_SPACING_X)*scale - vX, (y*TILE_HEIGHT + EDITOR_SPACING_Y) * scale - vY};
84
85 dc.StretchBlit(pos.x, pos.y, TILE_WIDTH*scale, TILE_HEIGHT*scale, &tiles_dc, tile%8*TILE_WIDTH, tile/8*TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT);
64 } 86 }
65 } 87 }
66 88
@@ -71,7 +93,7 @@ void MapeditWidget::OnPaint(wxPaintEvent&)
71 wxBitmap sprite = object->object->getSprite(); 93 wxBitmap sprite = object->object->getSprite();
72 tiles_dc.SelectObject(sprite); 94 tiles_dc.SelectObject(sprite);
73 95
74 wxPoint pos {(int) object->position.first*scale-vX, (int) object->position.second*scale-vY}; 96 wxPoint pos {(object->position.first + EDITOR_SPACING_X)*scale-vX, (object->position.second + EDITOR_SPACING_Y)*scale-vY};
75 wxSize size {object->object->getWidth()*scale, object->object->getHeight()*scale}; 97 wxSize size {object->object->getWidth()*scale, object->object->getHeight()*scale};
76 dc.StretchBlit(pos.x, pos.y, size.GetWidth(), size.GetHeight(), &tiles_dc, 0, 0, object->object->getWidth(), object->object->getHeight()); 98 dc.StretchBlit(pos.x, pos.y, size.GetWidth(), size.GetHeight(), &tiles_dc, 0, 0, object->object->getWidth(), object->object->getHeight());
77 99
@@ -99,9 +121,9 @@ void MapeditWidget::OnPaint(wxPaintEvent&)
99 tiles_dc.SelectObject(wxNullBitmap); 121 tiles_dc.SelectObject(wxNullBitmap);
100 tiles_dc.SelectObject(sprite); 122 tiles_dc.SelectObject(sprite);
101 123
102 std::pair<double, double> startPos = map->getWorld()->getStartingPosition(); 124 std::pair<int, int> startPos = map->getWorld()->getStartingPosition();
103 125
104 wxPoint pos {(int) startPos.first*scale-vX, (int) startPos.second*scale-vY}; 126 wxPoint pos {(startPos.first + EDITOR_SPACING_X)*scale-vX, (startPos.second + EDITOR_SPACING_Y)*scale-vY};
105 wxSize size {PLAYER_WIDTH[currentPlayer]*scale, PLAYER_HEIGHT[currentPlayer]*scale}; 127 wxSize size {PLAYER_WIDTH[currentPlayer]*scale, PLAYER_HEIGHT[currentPlayer]*scale};
106 128
107 dc.StretchBlit(pos.x, pos.y, size.GetWidth(), size.GetHeight(), &tiles_dc, 0, 0, PLAYER_WIDTH[currentPlayer], PLAYER_HEIGHT[currentPlayer]); 129 dc.StretchBlit(pos.x, pos.y, size.GetWidth(), size.GetHeight(), &tiles_dc, 0, 0, PLAYER_WIDTH[currentPlayer], PLAYER_HEIGHT[currentPlayer]);
@@ -127,10 +149,10 @@ void MapeditWidget::OnPaint(wxPaintEvent&)
127 } else if (editMode == EditTiles) 149 } else if (editMode == EditTiles)
128 { 150 {
129 int tile = tileWidget->getSelected(); 151 int tile = tileWidget->getSelected();
130 int x = (mousePos.x + vX) / (TILE_WIDTH * scale); 152 int x = (mousePos.x + vX - EDITOR_SPACING_X*scale) / (TILE_WIDTH * scale);
131 int y = (mousePos.y + vY) / (TILE_HEIGHT * scale); 153 int y = (mousePos.y + vY - EDITOR_SPACING_Y*scale) / (TILE_HEIGHT * scale);
132 154
133 wxPoint pos {x*TILE_WIDTH*scale-vX, y*TILE_HEIGHT*scale-vY}; 155 wxPoint pos {(x*TILE_WIDTH + EDITOR_SPACING_X)*scale-vX, (y*TILE_HEIGHT + EDITOR_SPACING_Y)*scale-vY};
134 wxSize size {TILE_WIDTH*scale, TILE_HEIGHT*scale}; 156 wxSize size {TILE_WIDTH*scale, TILE_HEIGHT*scale};
135 157
136 tiles_dc.SelectObject(wxNullBitmap); 158 tiles_dc.SelectObject(wxNullBitmap);
@@ -184,8 +206,8 @@ void MapeditWidget::SetTile(wxPoint pos)
184 vX *= vXX; 206 vX *= vXX;
185 vY *= vYX; 207 vY *= vYX;
186 208
187 int x = (pos.x + vX) / (TILE_WIDTH * scale); 209 int x = (pos.x + vX - EDITOR_SPACING_X*scale) / (TILE_WIDTH * scale);
188 int y = (pos.y + vY) / (TILE_HEIGHT * scale); 210 int y = (pos.y + vY - EDITOR_SPACING_Y*scale) / (TILE_HEIGHT * scale);
189 211
190 changeBuffer.insert({x,y}); 212 changeBuffer.insert({x,y});
191 213
@@ -194,6 +216,8 @@ void MapeditWidget::SetTile(wxPoint pos)
194 216
195void MapeditWidget::OnClick(wxMouseEvent& event) 217void MapeditWidget::OnClick(wxMouseEvent& event)
196{ 218{
219 if (!mouseIsIn) return;
220
197 mouseIsDown = true; 221 mouseIsDown = true;
198 222
199 int vX, vY; 223 int vX, vY;
@@ -338,14 +362,29 @@ void MapeditWidget::OnRightClick(wxMouseEvent& event)
338void MapeditWidget::OnMouseMove(wxMouseEvent& event) 362void MapeditWidget::OnMouseMove(wxMouseEvent& event)
339{ 363{
340 mousePos = event.GetPosition(); 364 mousePos = event.GetPosition();
341 mouseIsIn = true;
342 365
343 if (editMode == EditTiles) 366 int vX, vY, vW, vH;
367 GetViewStart(&vX, &vY);
368 GetVirtualSize(&vW, &vH);
369 int vXX, vYX;
370 GetScrollPixelsPerUnit(&vXX, &vYX);
371 vX *= vXX;
372 vY *= vYX;
373
374 if ((mousePos.x+vX >= EDITOR_SPACING_X*scale) && (mousePos.x+vX < (EDITOR_WIDTH-EDITOR_SPACING_X)*scale)
375 && (mousePos.y+vY >= EDITOR_SPACING_Y*scale) && (mousePos.y+vY < (EDITOR_HEIGHT-EDITOR_SPACING_Y)*scale))
344 { 376 {
345 if (mouseIsDown) 377 mouseIsIn = true;
378
379 if (editMode == EditTiles)
346 { 380 {
347 SetTile(event.GetPosition()); 381 if (mouseIsDown)
382 {
383 SetTile(event.GetPosition());
384 }
348 } 385 }
386 } else {
387 mouseIsIn = false;
349 } 388 }
350 389
351 Refresh(); 390 Refresh();
@@ -406,9 +445,19 @@ void MapeditWidget::ZoomOut()
406 445
407void MapeditWidget::SetZoomSize(int zoom) 446void MapeditWidget::SetZoomSize(int zoom)
408{ 447{
409 scale = zoom; 448 int vX, vY, vXX, vXY;
449 GetViewStart(&vX, &vY);
450 GetScrollPixelsPerUnit(&vXX, &vXY);
451 vX *= vXX;
452 vY *= vXY;
410 453
411 SetVirtualSize(MAP_WIDTH*TILE_WIDTH*scale, MAP_HEIGHT*TILE_HEIGHT*scale); 454 int newViewStartX = (vX + mousePos.x) / scale * zoom - mousePos.x;
455 int newViewStartY = (vY + mousePos.y) / scale * zoom - mousePos.y;
456
457 SetVirtualSize(EDITOR_WIDTH * zoom, EDITOR_HEIGHT * zoom);
458 Scroll(newViewStartX / vXX, newViewStartY / vXY);
459
460 scale = zoom;
412 461
413 Refresh(); 462 Refresh();
414} 463}
diff --git a/tools/mapedit/src/widget.h b/tools/mapedit/src/widget.h index 4ae22c7..77b840e 100644 --- a/tools/mapedit/src/widget.h +++ b/tools/mapedit/src/widget.h
@@ -21,7 +21,7 @@ enum EditMode {
21 EditEntities 21 EditEntities
22}; 22};
23 23
24class MapeditWidget : public wxScrolledWindow { 24class MapeditWidget : public wxScrolledCanvas {
25 public: 25 public:
26 MapeditWidget(); 26 MapeditWidget();
27 MapeditWidget(wxWindow* parent, wxWindowID winid, Map* map, TileWidget* tileWidget, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); 27 MapeditWidget(wxWindow* parent, wxWindowID winid, Map* map, TileWidget* tileWidget, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
@@ -54,8 +54,8 @@ class MapeditWidget : public wxScrolledWindow {
54 wxBitmap tiles; 54 wxBitmap tiles;
55 TileWidget* tileWidget; 55 TileWidget* tileWidget;
56 bool mouseIsDown = false; 56 bool mouseIsDown = false;
57 int scale; 57 int scale = 1;
58 wxPoint mousePos; 58 wxPoint mousePos {GAME_WIDTH/2, GAME_HEIGHT/2};
59 bool mouseIsIn = false; 59 bool mouseIsIn = false;
60 EditMode editMode = EditTiles; 60 EditMode editMode = EditTiles;
61 int currentPlayer = 0; 61 int currentPlayer = 0;
diff --git a/tools/mapedit/src/world.cpp b/tools/mapedit/src/world.cpp index db1201e..fb0bb36 100644 --- a/tools/mapedit/src/world.cpp +++ b/tools/mapedit/src/world.cpp
@@ -114,7 +114,7 @@ World::World(std::string filename)
114 xmlChar* key = xmlNodeListGetString(doc, mapNode->xmlChildrenNode, 1); 114 xmlChar* key = xmlNodeListGetString(doc, mapNode->xmlChildrenNode, 1);
115 if (key != 0) 115 if (key != 0)
116 { 116 {
117 map->setRightmap(atoi((char*) key)); 117 map->setRightmap(atoi((char*) key), false);
118 } 118 }
119 xmlFree(key); 119 xmlFree(key);
120 } else if (!xmlStrcmp(mapNode->name, (const xmlChar*) "entities")) 120 } else if (!xmlStrcmp(mapNode->name, (const xmlChar*) "entities"))