Author Topic: [done]Display coordinates of tile under mouse in the map editor  (Read 1598 times)

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
I believe it would be beneficial for map editing and scenario creation if the map editor displayed the coordinates for the tile the mouse is currently hovering over in the status bar in the window. This feature is seen in most modern image editors.
« Last Edit: 29 October 2013, 09:42:47 by titi »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Re: Display coordinates of tile under mouse in the map editor
« Reply #1 on: 6 September 2013, 23:25:28 »
I believe it would be beneficial for map editing and scenario creation if the map editor displayed the coordinates for the tile the mouse is currently hovering over in the status bar in the window. This feature is seen in most modern image editors.

GAE does this no? Are you sure MG doesn't already have this?

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Display coordinates of tile under mouse in the map editor
« Reply #2 on: 7 September 2013, 00:12:09 »
GAE does this no? Are you sure MG doesn't already have this?
I don't have my computer setup to compile the tools, but as of the latest stable release, it doesn't appear to exist.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,226
    • View Profile
    • http://www.titusgames.de
Re: Display coordinates of tile under mouse in the map editor
« Reply #3 on: 9 September 2013, 13:42:18 »
I will check if its there already. If its not there I try to add it, as it's very useful for scenarios.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

seanmc

  • Guest
Re: Display coordinates of tile under mouse in the map editor
« Reply #4 on: 16 September 2013, 08:34:11 »
Hi guys,

If no one has already done this, I am happy to take a look and see if I can implement this.

I have a little bit of experience coding, and will see if I am able to come up with anything.

I will let you know how I go.

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,226
    • View Profile
    • http://www.titusgames.de
Re: Display coordinates of tile under mouse in the map editor
« Reply #5 on: 16 September 2013, 15:07:17 »
Welcome to the board and MegaGlest. And yes, noone is working on this yet. ( beside of you now  :D)
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi_son

  • Draco Rider
  • *****
  • Posts: 283
  • titi_son
    • View Profile
Re: Display coordinates of tile under mouse in the map editor
« Reply #6 on: 24 September 2013, 15:34:25 »
i got it :D
sry I didnt see anyone else is working on it already...
maybe you can make it better than me because i display the Position here:


the changes i made (svn diff output) :

Code: [Select]
Index: source/glest_map_editor/main.cpp
===================================================================
--- source/glest_map_editor/main.cpp (Revision 4566)
+++ source/glest_map_editor/main.cpp (Arbeitskopie)
@@ -304,6 +304,7 @@
  -2, // Brush Type
  -2, // Brush 'Value'
  -1, // Brush Radius
+ -2, // Position
  };
  CreateStatusBar(siCOUNT);
  GetStatusBar()->SetStatusWidths(siCOUNT, status_widths);
@@ -314,6 +315,7 @@
  SetStatusText(wxT("Brush: Height"), siBRUSH_TYPE);
  SetStatusText(wxT("Value: 0"), siBRUSH_VALUE);
  SetStatusText(wxT("Radius: 1"), siBRUSH_RADIUS);
+ SetStatusText(wxT("Position: 0"), siPOS_VALUE);
 
  wxToolBar *toolbar = new MainToolBar(this->panel, wxID_ANY);
  toolbar->AddTool(miEditUndo, _("undo"), wxBitmap(edit_undo), _("Undo"));
@@ -603,6 +605,7 @@
  objectUnderMouse = currObject;
  }
 
+ SetStatusText(wxT("Position: ") + ToUnicode((program->getCell(x,y))), siPOS_VALUE);
 //#ifdef WIN32
  //repaint = true;
 //#endif
Index: source/glest_map_editor/program.cpp
===================================================================
--- source/glest_map_editor/program.cpp (Revision 4566)
+++ source/glest_map_editor/program.cpp (Arbeitskopie)
@@ -10,6 +10,7 @@
 // ==============================================================
 
 
+#include "conversion.h"
 #include "program.h"
 #include "util.h"
 #include <iostream>
@@ -183,6 +184,12 @@
  }
 }
 
+string Program::getCell(int x, int y) {
+ int i=(x - ofsetX) / cellSize;
+ int j= (y + ofsetY) / cellSize;
+ return intToStr(i) + "," + intToStr(j);
+}
+
 int Program::getResource(int x, int y) {
  int i=(x - ofsetX) / cellSize;
  int j= (y + ofsetY) / cellSize;
Index: source/glest_map_editor/main.h
===================================================================
--- source/glest_map_editor/main.h (Revision 4566)
+++ source/glest_map_editor/main.h (Arbeitskopie)
@@ -53,6 +53,7 @@
  siBRUSH_TYPE,
  siBRUSH_VALUE,
  siBRUSH_RADIUS,
+ siPOS_VALUE,
  siCOUNT
 };
 
Index: source/glest_map_editor/program.h
===================================================================
--- source/glest_map_editor/program.h (Revision 4566)
+++ source/glest_map_editor/program.h (Arbeitskopie)
@@ -175,6 +175,7 @@
 
  int getObject(int x, int y);
  int getResource(int x, int y);
+ string getCell(int x, int y);
  static const MapPreview *getMap() {return map;}
 };
 

EDIT:@titi its not good for scenarios because a map having 128*128 cells in map editor has 256*256 ingame....
« Last Edit: 24 September 2013, 15:45:06 by PT »
My first Tilseset: SPRING :) (included in Megaglest )

Secret Hint: To play online join the IRC #megaglest-lobby on freenode which is the lobby chat ingame. So you can chat with or wait for people in the lobby without running megaglest all the time.

seanmc

  • Guest
Re: Display coordinates of tile under mouse in the map editor
« Reply #7 on: 25 September 2013, 06:18:57 »
Hey great work!  :thumbup:

You beat us to it but no worries at all, we will have a look for other ways to contribute to MegaGlest  :)

We are already designing some cool new maps.

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,070
  • um wat??
    • View Profile
    • DelphaDesign
Re: Display coordinates of tile under mouse in the map editor
« Reply #8 on: 25 September 2013, 19:23:09 »
@PT  I would imagine that multipling the value by 2 could give a somewhat accurate location value in game
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

 

anything