public void InitDeviceResources(GraphicsDevice device) { if (!contentLoaded) { return; } int w, h; GetWH(out w, out h); height = h * width / w; // Create the geometry if new size is needed. if (geometry == null || geometry.Height != height || geometry.Width != width) { // Release any existing 9grid. BokuGame.Unload(geometry); geometry = new Base9Grid(width, height, edgeSize); BokuGame.Load(geometry, true); } if (diffuse == null || diffuse.Height != h) { ReleaseRenderTargets(); CreateRenderTargets(device); } dirty = true; }
} // end of c'tor public override void Render(Camera camera) { if (active || renderWhenInactive) { // Update the size if needed. float w = width; for (int i = 0; i < ActualDimensions.Y; i++) { UIGrid2DFloatingTextElement e = (UIGrid2DFloatingTextElement)grid[0, i]; w = Math.Max(w, e.WidthOfLabelInPixels); } w /= 96.0f; // pixels to inches. w += 2.0f * edgeSize; if (w > width) { width = w; BokuGame.Unload(geometry); geometry = new Base9Grid(width, height, edgeSize); BokuGame.Load(geometry); } UpdateSelectionFocus(); effect.CurrentTechnique = effect.Techniques["TexturedRegularAlpha"]; effect.Parameters["DiffuseTexture"].SetValue(backgroundTexture); // Calc position from lowerLeftCorner. Vector3 trans = new Vector3(lowerLeftCorner.X + (width - edgeSize) / 2.0f, lowerLeftCorner.Y + (height - edgeSize) / 2.0f, 0.0f); worldMatrix.Translation = trans; effect.Parameters["WorldMatrix"].SetValue(worldMatrix); effect.Parameters["WorldViewProjMatrix"].SetValue(worldMatrix * camera.ViewProjectionMatrix); effect.Parameters["Alpha"].SetValue(1.0f); effect.Parameters["DiffuseColor"].SetValue(Vector4.One); geometry.Render(effect); // // Render the menu elements. // Vector3 pos = worldMatrix.Translation + new Vector3(-(width / 2.0f - edgeSize), height / 2.0f - edgeSize, 0.0f); Point pixelCoord = camera.WorldToScreenCoords(pos); Vector2 position = new Vector2(pixelCoord.X, pixelCoord.Y); batch.Begin(); for (int i = 0; i < ActualDimensions.Y; i++) { UIGrid2DFloatingTextElement e = (UIGrid2DFloatingTextElement)grid[0, i]; e.RenderAt(batch, position); position.Y += lineHeight; } batch.End(); } //base.Render(camera); }
} // end of UIGrid2DTextElement LoadContent() public override void InitDeviceResources(GraphicsDevice device) { const int dpi = 128; int w = (int)(dpi * width); int h = (int)(dpi * height); // Create the geometry. if (BokuGame.RequiresPowerOf2) { float u = (float)w / (float)MyMath.GetNextPowerOfTwo(w); float v = (float)h / (float)MyMath.GetNextPowerOfTwo(h); geometry = new Base9Grid(width, height, edgeSize, u, v); } else { geometry = new Base9Grid(width, height, edgeSize); } if (diffuse == null) { CreateRenderTargets(device); } BokuGame.Load(geometry); }
} // end of UIGridModularButtonElement LoadContent() public override void InitDeviceResources(GraphicsDevice device) { // Create the geometry. geometry = new Base9Grid(width, height, edgeSize); CreateRenderTargets(device); BokuGame.Load(geometry, true); }
public override void UnloadContent() { base.UnloadContent(); BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Unload(geometry); geometry = null; } // end of UIGrid2DTextElement2 UnloadContent()
public override void UnloadContent() { base.UnloadContent(); BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Release(ref diffuse); BokuGame.Unload(geometry); geometry = null; } // end of UIGrid2DButtonBar UnloadContent()
public override void UnloadContent() { base.UnloadContent(); ReleaseRenderTargets(); BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Release(ref sliderBox); BokuGame.Unload(geometry); geometry = null; } // end of UIGridBaseSliderElement UnloadContent()
public void UnloadContent() { BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Release(ref whiteHighlight); BokuGame.Release(ref greenBar); BokuGame.Release(ref checkboxLit); BokuGame.Release(ref checkboxUnlit); BokuGame.Release(ref radioButtonLit); BokuGame.Release(ref radioButtonUnlit); BokuGame.Unload(geometry); geometry = null; } // end of ModularCheckboxList UnloadContent()
public override void UnloadContent() { base.UnloadContent(); ReleaseRenderTargets(); BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Release(ref checkboxWhite); BokuGame.Release(ref blackSquare); BokuGame.Unload(geometry); geometry = null; } // end of UIGridModularButtonElement UnloadContent()
public override void UnloadContent() { base.UnloadContent(); ReleaseRenderTargets(); BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Release(ref checkbox); BokuGame.Release(ref checkmark); BokuGame.Unload(geometry); geometry = null; } // end of UIGrid2DCheckboxElement UnloadContent()
public void UnloadContent() { ReleaseRenderTargets(); BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Release(ref diffuse); BokuGame.Release(ref whiteTop); BokuGame.Release(ref whiteHighlight); BokuGame.Release(ref blackHighlight); BokuGame.Release(ref greenBar); BokuGame.Unload(geometry); geometry = null; } // end of UIGridModularMenu UnloadContent()
public override void UnloadContent() { base.UnloadContent(); ReleaseRenderTargets(); BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Release(ref nextLevelWhite); BokuGame.Release(ref nextLevelMiddleBlack); BokuGame.Release(ref nextLevelBlack); BokuGame.Release(ref nextLevelNone); BokuGame.Unload(geometry); geometry = null; } // end of UIGridModularCheckboxElement UnloadContent()
public override void UnloadContent() { base.UnloadContent(); ReleaseRenderTargets(); BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Release(ref sliderWhite); BokuGame.Release(ref sliderBlack); BokuGame.Release(ref sliderBeadEnd); BokuGame.Release(ref sliderBeadMiddle); BokuGame.Unload(geometry); geometry = null; } // end of UIGridBaseModularSliderElement UnloadContent()
public override void UnloadContent() { base.UnloadContent(); ReleaseRenderTargets(); BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Release(ref radioWhite); BokuGame.Release(ref radioBlack); BokuGame.Release(ref middleBlack); BokuGame.Release(ref indicatorLit); BokuGame.Release(ref indicatorUnlit); BokuGame.Unload(geometry); geometry = null; } // end of UIGridModularRadioBoxElement UnloadContent()
} // end of UIGridModularCheckboxElement LoadContent() public override void InitDeviceResources(GraphicsDevice device) { int w = 512; int h = 64 + 128; //make sure the height keeps proper dimensions height = h * width / w; // Create the geometry. geometry = new Base9Grid(width, height, edgeSize); mainHitBox = new AABB2D(); clearHitBox = new AABB2D(); CreateRenderTargets(device); BokuGame.Load(geometry, true); }
public AuxMenuUIGrid( UIGridEvent onSelect, UIGridEvent onCancel, Point maxDimensions, string backgroundName, string uiMode) : base(onSelect, onCancel, maxDimensions, uiMode) { this.backgroundName = backgroundName; edgeSize = 64.0f / 96.0f; height = (maxDimensions.Y * lineHeight) / 96.0f + 2.0f * edgeSize; float minWidth = 3.0f; width = Math.Max(2.0f * edgeSize, minWidth); geometry = new Base9Grid(width, height, edgeSize); } // end of c'tor
public override void UnloadContent() { base.UnloadContent(); ReleaseRenderTargets(); BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Release(ref leftArrow); BokuGame.Release(ref rightArrow); for (int i = 0; i < pictures.Count; i++) { BokuGame.Unload(pictures[i]); } BokuGame.Unload(geometry); geometry = null; } // end of UIGridPictureListElement UnloadContent()
public override void InitDeviceResources(GraphicsDevice device) { int w, h; GetWH(out w, out h); height = h * width / w; // Create the geometry. geometry = new Base9Grid(width, height, edgeSize); // Create the diffuse texture. Leave it null if we have no text to render. if (diffuse == null) { CreateRenderTargets(device); } BokuGame.Load(geometry, true); dirty = true; }
} // end of UIGrid2DLEDArray LoadContent() public override void InitDeviceResources(GraphicsDevice device) { const int dpi = 96; int w = (int)(dpi * width); int h = (int)(dpi * height); // Create the geometry. if (BokuGame.RequiresPowerOf2 && !IgnorePowerOf2) { float u = (float)w / (float)MyMath.GetNextPowerOfTwo(w); float v = (float)h / (float)MyMath.GetNextPowerOfTwo(h); geometry = new Base9Grid(width, height, edgeSize, u, v); } else { geometry = new Base9Grid(width, height, edgeSize); } BokuGame.Load(geometry, true); }
public override void UnloadContent() { base.UnloadContent(); title.UnloadContent(); foreach (TextLine line in textList) { line.UnloadContent(); } ReleaseRenderTargets(); BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Release(ref checkbox); BokuGame.Release(ref checkmark); BokuGame.Unload(geometry); geometry = null; } // end of UIGridTextListElement UnloadContent()
public override void InitDeviceResources(GraphicsDevice device) { int w = (int)(dpi * width); int h = (int)(dpi * height); // Create the geometry. if (BokuGame.RequiresPowerOf2) { float u = (float)w / (float)MyMath.GetNextPowerOfTwo(w); float v = (float)h / (float)MyMath.GetNextPowerOfTwo(h); geometry = new Base9Grid(width, height, edgeSize, u, v); } else { geometry = new Base9Grid(width, height, edgeSize); } // Create the diffuse texture. backgroundWidth = w; backgroundHeight = h; if (BokuGame.RequiresPowerOf2) { w = MyMath.GetNextPowerOfTwo(w); h = MyMath.GetNextPowerOfTwo(h); } CreateRenderTargets(device); // Reload any textures. for (int i = 0; i < pictures.Count; i++) { BokuGame.Load(pictures[i], true); } // Recalc everything and refresh the texture. dirty = true; RecalcPositions(); RefreshTexture(); BokuGame.Load(geometry, true); }
public void Update(Camera camera, ref Matrix parentMatrix) { // Check for input. if (active && itemList.Count > 1) { HandleMouseInput(camera); HandleTouchInput(camera); HandleGamePadInput(camera); // Ensure that the selected state of all items is correct. for (int i = 0; i < itemList.Count; i++) { itemList[i].Selected = i == CurIndex; } if (dirty) { // Recalc size of box. h = itemList.Count * Font().LineSpacing; w = 0; for (int i = 0; i < itemList.Count; i++) { w = Math.Max(w, 2 * margin + checkboxSize + gap + (int)Font().MeasureString(itemList[i].Text).X); } if (geometry != null) { BokuGame.Unload(geometry); geometry = null; } width = w / 96.0f + 2.0f * tileBorder; height = h / 96.0f + 2.0f * tileBorder; geometry = new Base9Grid(width, height, edgeSize); geometry.InitDeviceResources(BokuGame.bokuGame.GraphicsDevice); dirty = false; } } } // end of ModularCheckboxList Update()
public override void InitDeviceResources(GraphicsDevice device) { int w = (int)(dpi * width); int h = (int)(dpi * height); // Create the geometry. if (BokuGame.RequiresPowerOf2) { float u = (float)w / (float)MyMath.GetNextPowerOfTwo(w); float v = (float)h / (float)MyMath.GetNextPowerOfTwo(h); geometry = new Base9Grid(width, height, edgeSize, u, v); } else { geometry = new Base9Grid(width, height, edgeSize); } // Create the diffuse texture. Leave it null if we have no text to render. int originalWidth = w; int originalHeight = h; if (diffuse == null) { CreateRenderTargets(device); } BokuGame.Load(title, true); foreach (TextLine line in textList) { BokuGame.Load(line, true); } BokuGame.Load(geometry, true); dirty = true; }
public override void UnloadContent() { base.UnloadContent(); ReleaseRenderTargets(); BokuGame.Release(ref effect); BokuGame.Release(ref normalMap); BokuGame.Release(ref white); BokuGame.Release(ref black); BokuGame.Release(ref middleBlack); BokuGame.Release(ref arrow); BokuGame.Release(ref indicatorLit); BokuGame.Unload(geometry); geometry = null; // Release all textures. for (int i = 0; i < pics.Count; i++) { Picture pic = pics[i]; BokuGame.Release(ref pic.texture); } } // end of UIGridModularPictureListElement UnloadContent()