Author Topic: Center Drawn Game Graphics to a Rectangle in the Game Window  (Read 1540 times)

Fractalbase

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Is it possible to center the game graphics rendered to a particular rectangle in the game window?  For example, in the interior of a sprite?  And then what would be the method to clip game artwork outside of that rectangle (or depending on how the graphics is rendered, I might assume that I have to calculate clipping myself)?  Is there a better way to zoom in and out of the graphics (for a 2D game) then adjusting the z position coordinate of the main camera?

thanks,
fb

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Center Drawn Game Graphics to a Rectangle in the Game Window
« Reply #1 on: June 25, 2014, 07:20:02 AM »
I don't quite understand what you mean. Center game graphics?

Fractalbase

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: Center Drawn Game Graphics to a Rectangle in the Game Window
« Reply #2 on: June 25, 2014, 07:44:35 AM »
Typically, the main camera is positioned at (0, 0, z).  This draws graphics on the entire screen centered at the center of the screen.  I will like to render game graphics only in a subset of the screen, a rectangle.  Then I want the center of that rectangle to be aligned with the center of the camera.  Is there a simple way to accomplish that?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Center Drawn Game Graphics to a Rectangle in the Game Window
« Reply #3 on: June 25, 2014, 07:57:23 AM »
This is controlled by specifying a view rect on the Camera. It's Unity's functionality and has nothing to do with NGUI.