diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-17 15:58:02 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-17 15:58:02 -0400 |
commit | 5c6d5cf1b4a22ae6d35b9c081bf34afec263ba63 (patch) | |
tree | c5df24939a0678abf14e0e79fd2d5b0bfe17328f | |
parent | 90ae982fc2bfdf2f4c049db747ce9516debb148a (diff) | |
download | therapy-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.txt | 25 | ||||
-rw-r--r-- | maps/cozy.txt | 25 | ||||
-rw-r--r-- | maps/embarass.xml | 28 | ||||
-rw-r--r-- | maps/second.xml | 26 | ||||
-rw-r--r-- | maps/smoothmap.pyxel | bin | 3330 -> 0 bytes | |||
-rw-r--r-- | res/maps.xml (renamed from maps/maps.xml) | 98 | ||||
-rw-r--r-- | tools/mapedit/src/frame.cpp | 4 | ||||
-rw-r--r-- | tools/mapedit/src/widget.cpp | 95 | ||||
-rw-r--r-- | tools/mapedit/src/widget.h | 6 | ||||
-rw-r--r-- | tools/mapedit/src/world.cpp | 2 |
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 @@ | |||
1 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
2 | XXXXXXXXXXXXXXXXXXXXXXXXX XX | ||
3 | XXXXXXXXXXXXXXXXXXXXXX X | ||
4 | XXXXXXXXXXXXXXXXX X | ||
5 | XXXXXXXXXXXXXX X | ||
6 | XXXXXXXXXXXXXX XXXX | ||
7 | XXXXXXXXXXXX XXXXXX | ||
8 | XXXXXXX XXXXXXX | ||
9 | XXX XXXXXXXXXXXX | ||
10 | XXXXXX | ||
11 | |||
12 | PPPP | ||
13 | |||
14 | PPPPPP | ||
15 | PPPP | ||
16 | |||
17 | |||
18 | PPPP | ||
19 | |||
20 | |||
21 | XXXXXXXXXXXXXXXXXXXX | ||
22 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
23 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
24 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
25 | Everything 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 @@ | |||
1 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
2 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
3 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
4 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
5 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
6 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
7 | XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXX | ||
8 | XXXXXXXXXXXXXXXXXXX XXXXXXX | ||
9 | XXXXXXXXXXXXXXX XX | ||
10 | XXXXXXXXXXX | ||
11 | XXXXXXXXXX | ||
12 | XXXXXXXX | ||
13 | XXXXXXXX | ||
14 | XXXXXX | ||
15 | XXXX | ||
16 | XXXX | ||
17 | XXX | ||
18 | XXX | ||
19 | XXX | ||
20 | XXXX | ||
21 | XXXXXXXXX | ||
22 | XXXXXXXXXXX | ||
23 | XXXXXXXXXXXXXXXXX XXXXXXXXXXXX | ||
24 | XXXXXXXXXXXXXXXXX XXXXXXXXXXXX | ||
25 | It'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, | ||
4 | 0,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, | ||
5 | 0,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, | ||
6 | 0,19,-1,-1,-1,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, | ||
7 | 0,0,-1,-1,-1,0,0,0,19,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13, | ||
8 | 0,0,-1,-1,0,0,0,0,0,0,0,18,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,1,1,25, | ||
9 | 0,0,0,0,-1,0,18,8,8,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,24,1,25,19,0,0, | ||
10 | 0,0,18,8,8,8,17,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,25,0,0,0,0,0, | ||
11 | 8,8,17,0,0,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,23,8,8,8,8,8,8, | ||
12 | 0,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26,0,0,0,0,0,0,0,0,0,0, | ||
24 | 0,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, | ||
25 | 1,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, | ||
26 | 0,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,0,0, | ||
3 | 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,20,0,0,0,0,0,0,0, | ||
4 | 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,19,0,0,0,0,0,0,0,0,0,0,0,0,0, | ||
5 | 0,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, | ||
6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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, | ||
7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,10,10,10,10,10,10,10,10,10,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | ||
8 | 0,0,0,18,9,9,9,9,9,9,9,9,9,9,17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 | 0,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, | ||
21 | 0,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, | ||
22 | 0,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, | ||
23 | 0,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, | ||
24 | 0,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, | ||
25 | 0,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, |
3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 3 | 0,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, |
4 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 4 | 0,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, |
5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 5 | 0,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, |
6 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 6 | 0,0,0,0,0,0,0,0,19,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13, |
7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 7 | 0,0,0,0,0,0,0,0,0,0,0,18,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,1,1,25, |
8 | 0,0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,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, |
27 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 27 | 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,20,0,0,0,0,0,0,0, |
28 | 0,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, | 28 | 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,19,0,0,0,0,0,0,0,0,0,0,0,0,0, |
29 | 0,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, | 29 | 0,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, |
30 | 0,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, | 30 | 0,0,0,0,0,0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,0,0,0, | 48 | 0,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, |
49 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 49 | 0,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, |
51 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 51 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
52 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 52 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
53 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 53 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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 | ||
4 | IMPLEMENT_DYNAMIC_CLASS(MapeditWidget,wxScrolledWindow) | 4 | const int EDITOR_SPACING_X = MAP_WIDTH * TILE_WIDTH / 2; |
5 | const int EDITOR_SPACING_Y = MAP_HEIGHT * TILE_HEIGHT / 2; | ||
6 | const int EDITOR_WIDTH = MAP_WIDTH * TILE_WIDTH + EDITOR_SPACING_X * 2; | ||
7 | const int EDITOR_HEIGHT = MAP_HEIGHT * TILE_HEIGHT + EDITOR_SPACING_Y * 2; | ||
5 | 8 | ||
6 | BEGIN_EVENT_TABLE(MapeditWidget, wxScrolledWindow) | 9 | IMPLEMENT_DYNAMIC_CLASS(MapeditWidget,wxScrolledCanvas) |
10 | |||
11 | BEGIN_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 | ||
20 | MapeditWidget::MapeditWidget(wxWindow* parent, wxWindowID winid, Map* map, TileWidget* tileWidget, const wxPoint& pos, const wxSize& size) | 25 | MapeditWidget::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 | ||
36 | wxSize MapeditWidget::DoGetBestSize() const | 50 | wxSize 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 | ||
41 | void MapeditWidget::OnPaint(wxPaintEvent&) | 55 | void 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 | ||
195 | void MapeditWidget::OnClick(wxMouseEvent& event) | 217 | void 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) | |||
338 | void MapeditWidget::OnMouseMove(wxMouseEvent& event) | 362 | void 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 | ||
407 | void MapeditWidget::SetZoomSize(int zoom) | 446 | void 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 | ||
24 | class MapeditWidget : public wxScrolledWindow { | 24 | class 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")) |