/// <summary> /// Entry point for each frame's update of waypoint editing. /// </summary> /// <param name="inGame"></param> /// <param name="camera"></param> public void Update(InGame inGame, Camera camera) { CheckDirection(); if (mode == Mode.ReCenter) { /// We're transitioning position to new spot. AdvanceReCenter(); } else { if (!ContinueMoving && TouchInput.WasTouched && TouchInput.TouchCount == 1 && InGame.inGame.TouchEdit.HasNonUITouch()) { //Only update "over" target when a tap was registered FindOver(camera); } if (!Empty) { CheckReCenter(); } if (Path != null) { Path.Moving = skeletonTimer > 0; } } CheckMode(); clickTimer -= Time.WallClockFrameSeconds; skeletonTimer -= Time.WallClockFrameSeconds; DoDrag(camera); DoAdd(camera); }
} // end of GameListManager Update() public void Render() { #if NETFX_CORE if (BokuGame.ScreenSize.X > BokuGame.ScreenSize.Y) { #endif for (int i = 0; i < renderList.Count; ++i) { RenderObject obj = renderList[i] as RenderObject; obj.Render(null); } #if NETFX_CORE } else { // Game paused since in strange snapped mode GraphicsDevice device = BokuGame.bokuGame.GraphicsDevice; InGame.Clear(Color.Black); // Center Kodu. Vector2 size = new Vector2(deadKoduTexture.Width, deadKoduTexture.Height); Vector2 pos = (BokuGame.ScreenSize - size) * 0.5f; SpriteBatch batch = UI2D.Shared.SpriteBatch; batch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied); batch.Draw(deadKoduTexture, pos, Color.White); batch.End(); pos.X = BokuGame.ScreenSize.X / 2.0f - 150.0f; pos.Y += size.Y + 30.0f; blob.RenderWithButtons(pos, new Color(0.8f, 0.8f, 0.8f)); } #endif } // end of GameListManager Render()
private void CreateRenderTargets(GraphicsDevice device) { int w = (int)width; int h = (int)height; // Create the diffuse texture. backgroundWidth = w; backgroundHeight = h; if (BokuGame.RequiresPowerOf2) { w = MyMath.GetNextPowerOfTwo(w); h = MyMath.GetNextPowerOfTwo(h); } if (diffuse == null) { diffuse = new RenderTarget2D(device, w, h, false, // Mipmaps SurfaceFormat.Color, DepthFormat.None); InGame.GetRT("TextDialog", diffuse); } shared.dirty = true; }
/// <summary> /// Set up a blank stack. /// </summary> private static void ZeroStack(int index) { inGame = InGame.inGame; idxBase = idxTop = IdxAt = index; stack = new string[kStartNumLevels]; }
} // end of UnloadContent() public void Render() { if (!Active) { return; } InGame.RenderMessages();//Needed?? }
// c'tor public BaseEditUpdateObj(InGame parent, ref Shared shared) { this.parent = parent; this.shared = shared; // Just create an empty command map to act as a placeholder on // on the command map stack. if (commandMap == null) { commandMap = new CommandMap("InGameEditBase"); } } // end of BaseEditUpdateObj c'tor
internal void Activate() { if (!LiveManager.AcceptedShareInvitation) { LiveManager.FriendUpdatesEnabled = true; LiveManager.JoinableUpdatesEnabled = true; } else { LiveManager.FriendUpdatesEnabled = false; LiveManager.JoinableUpdatesEnabled = false; } // TODO: remap to a kodu-meaningful string if remote player is playing kodu (but could look odd in the dashboard and other games that show presence). InGame.SetPresence(GamerPresenceMode.CornflowerBlue); // We rebuild the grid each time the share hub is activated, to reflect the dynamic nature of the friend list. grid = new UIGrid(parent.OnSelect, parent.OnCancel, new Point(1, 0), "App.ShareHub.Grid"); elements = new List <UIGridShareHubElement>(); // Set grid properties. grid.Spacing = new Vector2(0.0f, -0.1f); // The first number doesn't really matter since we're doing a 1d column. grid.Scrolling = true; grid.Wrap = false; grid.SlopOffset = true; grid.UseMouseScrollWheel = true; // First element is the "Enter Sharing Room" button. //grid.Add(new UIGridStartSharingElement(), 0, 0); BokuGame.Load(grid, true); grid.Active = true; // Queue up session finders for the sharing servers. if (!LiveManager.AcceptedShareInvitation) { foreach (string gamerTag in SharingServers.Instance.gamerTags) { UIGridSharingServerElement elem = new UIGridSharingServerElement(gamerTag); elem.JoinableChanged += new StatusChangedDelegate(elem_JoinableChanged); elements.Add(elem); elem.StartCheckingPresence(); } } }
} // end of TexturePicker Render() public void OnSelect(UIGrid grid) { //int index = grid.SelectionIndex.Y; // Don't need to do anything with the selection // since we've been actively updating it. Deactivate(); // Save the changes. string filename = InGame.CurrentLevelFilename(false); InGame.XmlWorldData.xmlTerrainData = InGame.inGame.Terrain.XmlTerrainData; } // end of OnSelect
public override void Render(Camera camera) { GraphicsDevice device = BokuGame.bokuGame.GraphicsDevice; // Clear the screen & z-buffer. InGame.Clear(backgroundColor); // Set up params for rendering UI with this camera. BokuGame.bokuGame.shaderGlobals.Effect.Parameters["EyeLocation"].SetValue(new Vector4(shared.camera.From, 1.0f)); BokuGame.bokuGame.shaderGlobals.Effect.Parameters["CameraUp"].SetValue(new Vector4(shared.camera.Up, 1.0f)); // Render the active grid using the local camera. UIGrid curGrid = shared.GetGridFromCurTab(); if (curGrid != null) { curGrid.Render(shared.camera); } // Render the backdrop/frame on top of the grid. ScreenSpaceQuad ssquad = ScreenSpaceQuad.GetInstance(); ssquad.Render(shared.backgroundTexture, new Vector2(0.0f), new Vector2(BokuGame.bokuGame.GraphicsDevice.Viewport.Width - 1.0f, BokuGame.bokuGame.GraphicsDevice.Viewport.Height - 1.0f), @"TexturedRegularAlpha"); // Render the tabs. #if !HIDE_MISSIONS shared.missionsTab.Render(shared.camera); #endif shared.myWorldsTab.Render(shared.camera); shared.starterWorldsTab.Render(shared.camera); shared.downloadsTab.Render(shared.camera); // Render the bottom bar. Well, actually, instead of rendering the bar // we'll just steal the texture from it and render than. shared.bottomBar.Render(shared.camera); CameraSpaceQuad csquad = CameraSpaceQuad.GetInstance(); //csquad.Render(shared.camera, shared.bottomBar.Diffuse.GetTexture(), new Vector2(0.0f, -3.35f), new Vector2(9.5f, 0.5f), @"TexturedRegularAlpha"); // Render the buttons for the bottom bar. if (shared.parent.curTab == Tab.MyWorlds || shared.parent.curTab == Tab.Downloads) { csquad.Render(shared.camera, ButtonTextures.XButton, shared.xButtonPosition, shared.buttonSize, @"TexturedRegularAlpha"); } csquad.Render(shared.camera, ButtonTextures.YButton, shared.yButtonPosition, shared.buttonSize, @"TexturedRegularAlpha"); } // end of LoadLevelMenu RenderObj Render()
} // end of Deactivate() public void Update() { touchedThisFrame = false; if (active) { InGame.SetViewportToScreen(); camera.Resolution = new Point((int)BokuGame.ScreenSize.X, (int)BokuGame.ScreenSize.Y); camera.Recalc(); camera.Update(); Matrix matrix = Matrix.Identity; brightnessSlider.Update(ref matrix); durationSlider.Update(ref matrix); ledGrid.Update(ref matrix); bar.Update(ref matrix); switch (GamePadInput.ActiveMode) { case GamePadInput.InputMode.GamePad: HandleGamePad(); break; case GamePadInput.InputMode.Touch: HandleTouch(); break; case GamePadInput.InputMode.KeyboardMouse: HandleMouse(); break; } // Adjust alpha value for stick icons if needed. float targetAlpha = GamePadInput.ActiveMode == GamePadInput.InputMode.GamePad ? 1.0f : 0.0f; if (targetAlpha != _stickAlpha) { _stickAlpha = targetAlpha; TwitchManager.Set <float> set = delegate(float value, Object param) { stickAlpha = value; }; TwitchManager.CreateTwitch <float>(stickAlpha, _stickAlpha, set, 0.2f, TwitchCurve.Shape.EaseOut); } // touchedThisFrame = true; } } // end of Update()
public override void Render(Camera camera) { GraphicsDevice device = BokuGame.bokuGame.GraphicsDevice; RenderTarget2D rt = UI2D.Shared.RenderTargetDepthStencil1280_720; Vector2 screenSize = new Vector2(device.Viewport.Width, device.Viewport.Height); Vector2 rtSize = new Vector2(rt.Width, rt.Height); // Render the scene to our rendertarget. InGame.SetRenderTarget(rt); // Set up params for rendering UI with this camera. Fx.ShaderGlobals.SetCamera(shared.camera); ScreenSpaceQuad quad = ScreenSpaceQuad.GetInstance(); // Copy the background to the rt. quad.Render(backgroundTexture, Vector2.Zero, rtSize, "TexturedNoAlpha"); // Set up local camera for rendering. Fx.ShaderGlobals.SetCamera(shared.camera); // Render the grid of friends. shared.grid.Render(shared.camera); Color darkText = new Color(40, 40, 40); Color greenText = new Color(12, 255, 0); // Tile1 Vector2 size = new Vector2(tile1.Width, tile1.Height); Vector2 position = new Vector2(285, 0); quad.Render(tile1, position, size, "TexturedRegularAlpha"); // TODO Add code to adjust for a change in the number of lines of text to make localization easier. position += new Vector2(120, 42); tile1Blob.RenderWithButtons(position, darkText); int numFriends = CalcNumInvitedFriends(); SpriteBatch batch = UI2D.Shared.SpriteBatch; batch.Begin(); int w = 70 - (int)UI2D.Shared.GetGameFont30Bold().MeasureString(numFriends.ToString()).X; position = new Vector2(790 + w / 2, 52); TextHelper.DrawString(UI2D.Shared.GetGameFont30Bold, numFriends.ToString(), position, greenText); position = new Vector2(865 - w / 3, 52); TextHelper.DrawString(UI2D.Shared.GetGameFont20, numFriends == 1 ? Strings.Localize("shareHub.friend") : Strings.Localize("shareHub.friends"), position, greenText); position = new Vector2(865 - w / 3, 77); TextHelper.DrawString(UI2D.Shared.GetGameFont20, Strings.Localize("shareHub.invited"), position, greenText); batch.End(); // Tile2 size = new Vector2(tile2.Width, tile2.Height); position = new Vector2(285, 550); quad.Render(tile2, position, size, "TexturedRegularAlpha"); // Set up hit box for bottom tile. shared.openBox.Set(position, position + size); // TODO Add code to adjust for a change in the number of lines of text to make localization easier. position += new Vector2(120, 48); tile2Blob.RenderWithButtons(position, darkText); InGame.RestoreRenderTarget(); InGame.Clear(new Color(20, 20, 20)); // Copy the rendered scene to the rendertarget. float rtAspect = rtSize.X / rtSize.Y; position = Vector2.Zero; Vector2 newSize = screenSize; newSize.X = rtAspect * newSize.Y; position.X = (screenSize.X - newSize.X) / 2.0f; quad.Render(rt, position, newSize, @"TexturedNoAlpha"); RenderMessages(); }
// c'tor public SelectNextLevelUpdateObj(InGame parent, ref Shared shared) : base(parent, ref shared) { } // end of EditWorldParametersUpdateObj c'tor