Page 1 of 1

gl.ConfigMiniMap and GetMiniMapGeometry

Posted: 29 Apr 2010, 10:10
by knorke
its not making sense :?
i want to do a screenshot then use irfanview.exe /crop =(x,y,width, heigth) to crop out the minimap.
irfanviews coordinates:
x= left/right. y=up/down
(0:0) is top left corner
(irfanview is some free graphic program http://www.irfanview.com that can be used over commandline)

I use this:

Code: Select all

...
local map_sizeratio = (Game.mapSizeX / Game.mapSizeZ)
	gl.ConfigMiniMap(0, 0, 500, 500/map_sizeratio)
...
	posX, posY, sizeX, sizeY, minimized, maximized = Spring.GetMiniMapGeometry()
...
For some reason, y value was always 50 pixels too low causing this: http://knorke.net23.net/battlereports/T ... _2010x.jpg

so I just added +50 when calling Irfanview.
This used to work:
http://knorke.net23.net/battlereports/n ... _2010x.jpg

http://knorke.net23.net/battlereports/n ... _2010x.jpg

http://knorke.net23.net/battlereports/n ... _2010x.jpg

although I have no idea why.

for example the above code sets the minimap "somewhere"
(with the 0,0 i would expect it to be either at the very top or bottom of the screen, just like it is to the very left)
return of GetMiniMapGeometry arethese values:
posx=0
posy=94 <- wtf 94? counting from where?
width=500
mmh=583
causing this: http://knorke.net23.net/battlereports/n ... _2010x.jpg


Sometimes the 50 pixel offset changes for no reason:
http://knorke.net23.net/battlereports/n ... _2010x.jpg
-> wrong cropping

It is not the way irfanview gets called or my other program that draws the stuff, ive used the "create custom selection" menu and typed in the values by hand and the crop section is still off. even in ms paint you can see the returned values do not match up sometimes.
As far i can tell its only in Y-axis (up/down)

So any hints :?

more sometimes correct, sometimes wrongly cropped minimaps are here:
http://knorke.net23.net/battlereports/
maybe someone can see a system? I don't.
Oh my windows resolution is 1280x1024 but spring runs in 1024x768. I thought maybe its getting confused by this when i alt tab during loading or whatever but that didnt seem so.

Re: gl.ConfigMiniMap and GetMiniMapGeometry

Posted: 29 Apr 2010, 10:29
by jK
ever got the idea to render the whole image in Spring?

Re: gl.ConfigMiniMap and GetMiniMapGeometry

Posted: 29 Apr 2010, 10:34
by knorke
yes but the idea of learning even more lua made me shake in terror and fear...

but if you have a function to export the texturemap of a map (someone once did that for heightmap?) as a bitmap, that is welcome too :)

but i would rather not remake the whole program because basically everything is done. only these stupid offsets...

Re: gl.ConfigMiniMap and GetMiniMapGeometry

Posted: 30 Apr 2010, 16:24
by knorke

Code: Select all

screenSizeX, screenSizeY, lol,rofl = Spring.GetScreenGeometry () 
Spring.Echo ("screensizeX=" .. screenSizeX .. " screensizeY=" .. screenSizeY)
for a resolution of 1024x768 this prints:
screensizeX=1024 screenSizeY=667

for a resolution of 1600x1200 this prints:
screensizeX=1600 screenSizeY=1099

wait wat?

Re: gl.ConfigMiniMap and GetMiniMapGeometry

Posted: 30 Apr 2010, 16:41
by zwzsg
Do you run Spring windowed? If so, then the difference could be due to the application title bar size.

What's strange is that the side border is usually a couple pixels wide too.

Re: gl.ConfigMiniMap and GetMiniMapGeometry

Posted: 30 Apr 2010, 16:49
by knorke
yea i thought but i run fullscreen.
and 201 pixels is a bit much for the titlebar

What's strange is that the side border is usually a couple pixels wide too.
yea but i think thats just because the minimap has 1 or 2 pixels wide border around it, thats not so bad and should be easy to adjust

edit
just realised you probally mean the window border not the minimap border