Author Topic: map preview code  (Read 1208 times)

treba

  • Guest
map preview code
« on: 5 May 2012, 12:00:23 »
hey everyone,

i was just wondering if anyone could tell me which part of the code in megaglest is responsible for the map preview, as i want to reuse it for my editor (to make it possible to define areas in a graphical way)

thanks in advance

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Re: map preview code
« Reply #1 on: 5 May 2012, 15:37:15 »
Actual rendering code in renderer.cpp:

Renderer::renderMapPreview

called from some of the menus like this:

renderer.renderMapPreview(&mapPreview, renderAll, 10, 350,&mapPreviewTexture);

treba

  • Guest
Re: map preview code
« Reply #2 on: 5 May 2012, 17:30:46 »
thanks softcoder!
i was actually more looking for the part of the code that reads the data from the file, but i guess i found it now (in shared_lib/sources/map.cpp MapPreview::loadFromFile)

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: map preview code
« Reply #3 on: 7 May 2012, 02:06:16 »
This is exelent!, if you need help testing treba im on Windows and Linux :P:thumbup: :thumbup:
WiP Game developer.
I do danish translations.
"i break stuff"

wciow

  • Behemoth
  • *******
  • Posts: 968
    • View Profile
Re: map preview code
« Reply #4 on: 7 May 2012, 09:04:47 »
You might also want to check the GAE map editors "show map" function which calls the engine to render only the map without starting a game.
Check out my new Goblin faction - https://forum.megaglest.org/index.php?topic=9658.0

treba

  • Guest
Re: map preview code
« Reply #5 on: 7 May 2012, 19:50:09 »
ok, seems to work pretty well. got most things rendered now.
(click to show/hide)

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: map preview code
« Reply #6 on: 7 May 2012, 19:52:21 »
And now the plan is to make it graphical did i understand that correctly?
WiP Game developer.
I do danish translations.
"i break stuff"

treba

  • Guest
Re: map preview code
« Reply #7 on: 7 May 2012, 20:17:24 »
well no, this i way to much work in the moment. maybe some later time.
the next step is to make it possible to select areas to e.g. place units. i would love to do in directly inside the engine, like in wc3, but i think with this 2d map, it's also quite easy already.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: map preview code
« Reply #8 on: 8 May 2012, 05:59:32 »
By the way, your image is showing a typo. Should it say "Title" instead of "Titel"?
Edit the MegaGlest wiki: http://docs.megaglest.org/

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