示例#1
0
        public void Initialize()
        {
            WindowControl rightpanel = new WindowControl(MainCanvas.Instance);
            rightpanel.Dock = Gwen.Pos.Right;
            rightpanel.Width = (GraphicsManager.WindowWidth / 2) - 20;
            rightpanel.IsClosable = false;
            rightpanel.DisableResizing();

            Base dummy = new Base(MainCanvas.Instance);
            dummy.Dock = Gwen.Pos.Fill;

            bottompanel = new WindowControl(dummy);
            bottompanel.Dock = Gwen.Pos.Bottom;
            bottompanel.Height = (GraphicsManager.WindowHeight / 2) - 20;
            bottompanel.IsClosable = false;
            bottompanel.DisableResizing();

            Gameview = new Camera3D();
            Gameview.Layer = 1;
            Gameview.FieldOfView = 60;
            Gameview.EnableViewport(10, 10, GraphicsManager.WindowWidth / 2, GraphicsManager.WindowHeight / 2);
            Gameview.OnRender += GameRender;

            if (GameInfo.Me.IsServer) {
                ScriptManager.Initialize();
                foreach (var p in GameInfo.Players.Values){
                    InitializePlayer(p);
                }
            }
        }
示例#2
0
        public static bool GetMousePosition(Camera3D camera, out Vector2d position)
        {
            Vector2d ViewArea = new Vector2d(camera.Viewport.Width, camera.Viewport.Height);
            Vector2d MouseAt = MouseManager.MousePosition - new Vector2d(camera.Viewport.X, camera.Viewport.Y);
            if (MouseAt.X < 0 || MouseAt.Y < 0 || MouseAt.X > camera.Viewport.Width || MouseAt.Y > camera.Viewport.Height) {
                position = new Vector2d();
                return false;
            }

            Vector3d ray = camera.ScreenPointToRay(MouseAt);

            Vector3d pos;
            AABBCollision.CheckLineBox(new Vector3d(0, 0, -1), new Vector3d(5, 7, 0), camera.Position, (ray * 30) + camera.Position, out pos);
            position = pos.Xy;
            return true;
        }
示例#3
0
 public GameRenderer()
 {
     Camera = new Camera3D();
     Camera.OnRender += OnRender;
     Camera.CameraUp = Vector3d.UnitZ;
 }