public MouseWheelController(WheelDelegate wheelDelegate, GraphicsDevice device) { this.device = device; this.wheelDelegate = wheelDelegate; mouseState = new MouseState(); position = new Vector2(); camera = new Camera2D(device); }
protected PhysicsGameScreen() { TransitionOnTime = TimeSpan.FromSeconds(0.75); TransitionOffTime = TimeSpan.FromSeconds(0.75); HasCursor = true; EnableCameraControl = true; _userAgent = null; World = null; Camera = null; DebugView = null; }
public KinectInsideWheelController(WheelDelegate wheelDelegate, GraphicsDevice device, KinectSensor kinect, int activeSkeletonIndex, int radius, Vector2 centerPosition) { this.device = device; this.radius = radius; this.centerPosition = centerPosition; this.wheelDelegate = wheelDelegate; position = new Vector2(); camera = new Camera2D(device); if (!kinect.IsRunning) { kinect.SkeletonStream.Enable(); kinect.Start(); } kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinectSkeletonFrameReady); if(activeSkeletonIndex>=0){ skeleton = skeletonData[activeSkeletonIndex]; } }
public override void LoadContent() { base.LoadContent(); //We enable diagnostics to show get values for our performance counters. Settings.EnableDiagnostics = true; if (World == null) { World = new World(Vector2.Zero); } else { World.Clear(); } if (DebugView == null) { DebugView = new DebugViewXNA(World); DebugView.RemoveFlags(DebugViewFlags.Shape); DebugView.RemoveFlags(DebugViewFlags.Joint); DebugView.DefaultShapeColor = Color.White; DebugView.SleepingShapeColor = Color.LightGray; DebugView.LoadContent(ScreenManager.GraphicsDevice, ScreenManager.Content); } frameRateCounter = new FrameRateCounter(this.ScreenManager); if (Camera == null) { Camera = new Camera2D(ScreenManager.GraphicsDevice); } else { Camera.ResetCamera(); } // Loading may take a while... so prevent the game from "catching up" once we finished loading ScreenManager.Game.ResetElapsedTime(); }
public override void LoadContent() { base.LoadContent(); HasCursor = true; if (World == null) { World = new World(new Vector2(0, 20)); } else { World.Clear(); } if (Camera == null) { Camera = new Camera2D(ScreenManager.GraphicsDevice); } else { Camera.ResetCamera(); } Map = new Map(this, World, ScreenManager); var config = new NetPeerConfiguration("xnaapp"); client = new NetClient(config); client.Start(); config = new NetPeerConfiguration("xnaapp"); config.AcceptIncomingConnections = true; config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest); config.Port = port; server = new NetServer(config); server.Start(); IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); foreach (IPAddress ip in host.AddressList) { if (ip.AddressFamily == AddressFamily.InterNetwork) { localIP = ip.ToString(); } } recipients = new List<NetConnection>(); // Loading may take a while... so prevent the game from "catching up" once we finished loading ScreenManager.Game.ResetElapsedTime(); Players = new Dictionary<string, Player>(); Factory = new MinionFactory(); }
public override void LoadContent() { base.LoadContent(); if (KinectSensor.KinectSensors.Count > 0) { kinect = KinectSensor.KinectSensors[0]; kinect.SkeletonStream.Enable(); kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeletonFrameReady); kinect.Start(); } else { cursorSprite = new Sprite(ScreenManager.Content.Load<Texture2D>("Common/cursor")); camera = new Camera2D(ScreenManager.GraphicsDevice); usingMouse = true; } // Slaven, just for testing jointTexture = ScreenManager.Content.Load<Texture2D>("joint"); scoreFont = ScreenManager.Content.Load<SpriteFont>("Font"); keyboardPosition = new Vector2(-ScreenManager.GraphicsDevice.Viewport.Width / 3, -ScreenManager.GraphicsDevice.Viewport.Height / 8); keyboard = new KeyboardBody(keyboardPosition, World, ScreenManager, scoreFont); currentName = ""; currentNamePosition = new Vector2(0, keyboardPosition.Y - ScreenManager.GraphicsDevice.Viewport.Height / 8); TimeSpan t = TimeSpan.FromMilliseconds(scoreToEnter); string answer = string.Format("{0:D2}:{1:D2}:{2:D3}", t.Minutes, t.Seconds, t.Milliseconds); congratulationsMessage = "Congratulations, you've made to High Scores with score " + answer; scorePosition = new Vector2(-scoreFont.MeasureString(congratulationsMessage).X/2, currentNamePosition.Y - ScreenManager.GraphicsDevice.Viewport.Height / 8); gestureControllerHandler = new GestureControllerHandler(); keyboard.ActivationChanged += new EventHandler(keyboard_ActivationChanged); kinectPongDAL = new KinectPongDAL(); }