Hello Guest

Author Topic: Getting the True Lower Left of the Screen  (Read 4318 times)

Matt-Cranktrain

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Getting the True Lower Left of the Screen
« on: September 16, 2013, 11:26:27 am »
Hi,

I'm using two tk2dCamera's, one for the game and one for the game's UI, and that was working nicely until I decided to test it out at different resolutions.

The following image illustrates my problem, I'm trying to align a tk2DSprite at coordinates 0,0:



At the native resolution of 1600x900, it's fine, aligned at the true lower left of the screen. When I change the resolution to a smaller 1024x576, however, it stays at the same point relative to the background tiles, and yet there's plenty more that gets displayed below. I don't mind if more of the game gets shown in the background, but I do need those UI elements aligned to the edges of the screen correctly.

Have I misunderstood some aspect of tk2dCamera or tk2dCameraAnchor? How can I reliably get the 0x0 co-ordinate of the lower left hand corner of the screen, regardless of the resolution?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Getting the True Lower Left of the Screen
« Reply #1 on: September 16, 2013, 12:01:06 pm »
tk2dCamera.ScreenExtents.xMin/yMin should give you the bottom left of the screen. You don't need that though - if you create a camera anchor, anchored to the bottom left, and attach your sprite to it with a localposition of 0,0,0, then it will appear at the bottom left always.

Matt-Cranktrain

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Getting the True Lower Left of the Screen
« Reply #2 on: September 16, 2013, 01:07:02 pm »
Thank you, all sorted now.