/// <summary> /// Initialize the static camera functionality. /// </summary> /// <param name="game">The game that this component will be attached to.</param> public static void Initialize() { if (camera != null) { // System.Windows.MessageBox.Show("Error: camera already initialized!"); } camera = new Camera(); //JabJect.GetGame().Components.Add(camera); }
public static void OnTap(Vector2 pos) { float leftMost = AdSprite.PosX - AdSprite.Width / 2.0f; float rightMost = AdSprite.PosX + AdSprite.Width / 2.0f; float topMost = AdSprite.PosY + AdSprite.Height / 2.0f; float bottomMost = AdSprite.PosY - AdSprite.Height / 2.0f; topMost *= -1; bottomMost *= -1; Camera cam = new Camera(); //pos = cam.ScreenToWorld(pos); pos *= BaseGame.Get.BackBufferDimensions; /* leftMost = cam.WorldToScreen(new Vector2(leftMost, 0)).X; rightMost = cam.WorldToScreen(new Vector2(rightMost, 0)).X; topMost = cam.WorldToScreen(new Vector2(0, topMost)).Y; bottomMost = cam.WorldToScreen(new Vector2(0, bottomMost)).Y; */ //Camera.CurrentCamera = new Camera(); if (pos.X > leftMost && pos.X < rightMost && pos.Y < bottomMost && pos.Y > topMost) { if (AdShowing) { WebBrowserTask webBrowserTask = new WebBrowserTask(); webBrowserTask.URL = somaAd.Uri; webBrowserTask.Show(); } else { WebBrowserTask webBrowserTask = new WebBrowserTask(); webBrowserTask.URL = "http://twitter.com/#!/JabberWorx"; webBrowserTask.Show(); } } }