Dual screen mode and adjusting screen split position

Dual screen mode and adjusting screen split position

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
Garo
Posts: 11
Joined: 26 Apr 2009, 18:24

Dual screen mode and adjusting screen split position

Post by Garo »

I've been working with a patch which allows to adjust the dual screen map/viewport division. Currently the map takes 50% of the screen, but that's not very usefull for people who have different resolutions in their monitors.

The patch changes gu->viewSizeX, viewPosX and alter some calculations when gu->dualScreenMode is enabled, because current code assumes that the split is always at 50%.

The patch is against 0.78.2.1 (not the git trunk) and it assumes that user runs client in windowed mode (not in full screen). I'm planning to port the patch to support latest git trunk after I've fixed all current problems.

There's still one problem: for some reason CustomFormations widget doesn't work inside dual screen mode. I'm not sure if it's a widget problem or is it a bug in the core spring engine. When assigning two or more units to a position (a move order) with CustomFormations enabled, the actual position where the move command is issued is shifted in both x and y (2D) coordinates by a large factor.

The change is not constant: it's biggest when trying to order units to top-left corner. Then the shift suddenly disapear when trying to order units to bottom-right corner (there's an area where the shift does not occur and the shift suddenly reappear when issuing orders out from this imaginary area.

The shift and the imaginary area where the shift does not occur is affected by the camera: zooming and panning the area changes the imaginary area where shift does not occur.

Does anybody have any clue what could be the source of this bug? All help is appreciated.

- Garo
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Dual screen mode and adjusting screen split position

Post by Beherith »

Garo, try if this bug appears with minimap on right. It shouldnt. Its a viewsize bug iirc. Even one of the getviewsize lua callins are broken too.
Garo
Posts: 11
Joined: 26 Apr 2009, 18:24

Re: Dual screen mode and adjusting screen split position

Post by Garo »

It doesn't appear in the dual screen map. I built up a screenshot which shows the problem nicely.

- There's the green area where clicks work as they should
- Then there's the other area where the shift occurs. There's an example line: I clicked orders in the red line and the orders end up in the yellow line.
Attachments
customformations-bug-screenshot.jpg
customformations-bug-screenshot.jpg (72.01 KiB) Viewed 1419 times
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Dual screen mode and adjusting screen split position

Post by Beherith »

I mean test if this bug exists with minimap set to right on dual screen mode.
Im guessing its set to left right now, is it?
Garo
Posts: 11
Joined: 26 Apr 2009, 18:24

Re: Dual screen mode and adjusting screen split position

Post by Garo »

I made a quick try with minimap on the right side and the bug did not appear. So what does this mean?

- Garo
Garo
Posts: 11
Joined: 26 Apr 2009, 18:24

Re: Dual screen mode and adjusting screen split position

Post by Garo »

The bug was inside CustomFormations which InMinimap function did not take in account if the game was running in dual screen mode. Here's the fixed version of the function:

Code: Select all

local function InMinimap(x,y)
  local posx,posy,sizex,sizey,minimized,maximized = spGetMiniMapGeometry()
  local rx,ry = (x-posx)/sizex,(y-posy)/sizey
  if (Spring.GetMiniMapDualScreen() == 'left')
  then
	rx = rx + 1.0
  end
  
  return (not (minimized or maximized)) and
		 (rx>=0)and(rx<=1)and
		 (ry>=0)and(ry<=1),rx,ry
end
- Garo
Last edited by Garo on 28 Apr 2009, 20:56, edited 1 time in total.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Dual screen mode and adjusting screen split position

Post by Beherith »

if (Spring.GetMiniMapDualScreen()=='left')

if (Spring.GetMiniMapDualScreen()=='right')

Also works
Garo
Posts: 11
Joined: 26 Apr 2009, 18:24

Re: Dual screen mode and adjusting screen split position

Post by Garo »

Thanks, that's much cleaner way =)

- Garo
Post Reply

Return to “Engine”