SceneView is getting stretched despite specifically setting it to a certain size[solved]
by Will O-Reagan · in Torque X 2D · 10/07/2010 (7:31 pm) · 2 replies
My issue is that a scene view seems to be streached, always to the far right now matter what i set it to. Heres an example
Coded for this...
<--view1--><--view2-->
Got this
<--view1-------------->
____________<--view2-->
Coded for this...
<--view1--><--view2-->
Got this
<--view1-------------->
____________<--view2-->
T2DSceneCamera theirCam = new T2DSceneCamera();
T2DSceneCamera ourCam = new T2DSceneCamera();
ourCam.Extent = new Microsoft.Xna.Framework.Vector2(64, 72);
theirCam.Extent = ourCam.Extent;
theirCam.Position = ourCam.Position + new Microsoft.Xna.Framework.Vector2(200, 0);
TorqueObjectDatabase.Instance.Register(theirCam);
TorqueObjectDatabase.Instance.Register(ourCam);
GUISceneview superView = new GUISceneview();
GUIStyle superStyle = new GUIStyle();
superView.Style = superStyle;
T2DSceneCamera overlayCam = TorqueObjectDatabase.Instance.FindObject("Camera") as T2DSceneCamera;
overlayCam.Position = new Microsoft.Xna.Framework.Vector2(0, -150);
overlayCam.Extent = new Microsoft.Xna.Framework.Vector2(128, 72);
superView.Camera = overlayCam;
superView.Size = new Microsoft.Xna.Framework.Vector2(1280, 720);
GUISceneview ourView = new GUISceneview();
GUIStyle ourStyle = new GUIStyle();
ourView.Style = ourStyle;
ourView.Camera = ourCam;
ourView.Name = "OurScreen";
ourView.Size = new Microsoft.Xna.Framework.Vector2(640.0f, 720.0f);
ourView.Folder = superView;
ourView.Position = new Microsoft.Xna.Framework.Vector2(0, 0);
GUISceneview theirView = new GUISceneview();
GUIStyle theirStyle = new GUIStyle();
theirView.Style = theirStyle;
theirView.Camera = theirCam;
theirView.Name = "ThierScreen";
theirView.Size = new Microsoft.Xna.Framework.Vector2(640.0f, 720.0f);
theirView.Folder = superView;
theirView.Position = new Microsoft.Xna.Framework.Vector2(640, 0);
GUICanvas.Instance.SetContentControl(superView);About the author
I have a degree in dramatic art, and literature, from UC Santa Barbara. I've worked for a few studios, also at Animax Ent in 2008, and some smaller studios. Currently studying Computer Science at CSU Channel Islands.
#2
You'll have to modify GUICanvas to give you an area property, but that should be easy.
10/07/2010 (8:12 pm)
Ok, I got it... I simply wasn't setting a proper size, and things were getting resized because i didn't know what the heck i was doing... heres the fixed code, for anyone trying to do split screen.You'll have to modify GUICanvas to give you an area property, but that should be easy.
//in GUICanvas
public Vector2 Area
{
get { return new Vector2(width, height); }
}T2DSceneCamera theirCam = new T2DSceneCamera();
T2DSceneCamera ourCam = new T2DSceneCamera();
ourCam.Extent = new Microsoft.Xna.Framework.Vector2(64, 72);
theirCam.Extent = ourCam.Extent;
theirCam.Position = ourCam.Position + new Microsoft.Xna.Framework.Vector2(0, 0);
TorqueObjectDatabase.Instance.Register(theirCam);
TorqueObjectDatabase.Instance.Register(ourCam);
GUIControl superView = new GUIControl();
GUIStyle superStyle = new GUIStyle();
superView.Style = superStyle;
GUISceneview ourView = new GUISceneview();
GUIStyle ourStyle = new GUIStyle();
ourView.Style = ourStyle;
ourView.Name = "OurScreen";
ourView.Size = GUICanvas.Instance.Area - new Microsoft.Xna.Framework.Vector2(GUICanvas.Instance.Area.X / 2, 0);
ourView.Folder = superView;
ourView.Position = new Microsoft.Xna.Framework.Vector2(0, 0);
GUISceneview theirView = new GUISceneview();
GUIStyle theirStyle = new GUIStyle();
theirView.Style = theirStyle;
theirView.Name = "ThierScreen";
theirView.Size = GUICanvas.Instance.Area - new Microsoft.Xna.Framework.Vector2(GUICanvas.Instance.Area.X / 2, 0);
theirView.Folder = superView;
theirView.Position = new Microsoft.Xna.Framework.Vector2(GUICanvas.Instance.Area.X/2, 0);
ourView.Camera = ourCam;
theirView.Camera = theirCam;
GUICanvas.Instance.SetContentControl(superView);
Torque 3D Owner Will O-Reagan
Modern Intrigues