} // end of RefreshRT() public override void LoadContent(bool immediate) { const int dpi = 96; int w = (int)(dpi * width); int h = (int)(dpi * height); if (tile == null) { tile = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\GridElements\BlackTextTile"); } if (rt == null) { rt = new RenderTarget2D(BokuGame.bokuGame.GraphicsDevice, w, h); } } // end of UIGridModularTextElement LoadContent()
protected bool MakeIndexBuffer() { BokuGame.Release(ref indexBuff); int numIndices = NumIndices; if (numIndices > 0) { GraphicsDevice device = BokuGame.bokuGame.GraphicsDevice; indexBuff = new IndexBuffer(device, IndexElementSize.SixteenBits, numIndices, BufferUsage.WriteOnly); indexBuff.SetData <Int16>(Indices); } return(numIndices > 0); }
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 Update(); /* * public void test() * { * //foo("pre test"); * for (int i = 0; i < kWidth-1; i++) * { * UIGridLevelElement ei = (UIGridLevelElement)grid[i, 0]; * for (int j = i + 1; j < kWidth; j++) * { * UIGridLevelElement ej = (UIGridLevelElement)grid[j, 0]; * * if (ei != null && ej != null && ei.uniqueNum == ej.uniqueNum) * { * // boom! * } * } * } * } * * public void foo(string label) * { * Debug.Print("===== " + label + " ====="); * for (int i = 0; i < kWidth; i++) * { * UIGridLevelElement e = (UIGridLevelElement)grid[i, 0]; * if (e == null) * { * Debug.Print(i.ToString() + " null"); * } * else * { * Debug.Print(i.ToString() + " " + e.uniqueNum.ToString() + " " + e.Level.Name); * } * } * } */ public override void UnloadContent() { for (int i = 0; i < kWidth; ++i) { UIGridLevelElement e = (UIGridLevelElement)grid[i, 0]; if (e != null) { BokuGame.Unload(e); // Remove from the INeedsDeviceReset Dictionary. e.UnloadContent(); } grid[i, 0] = null; } base.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); }
internal static void LoadContent(bool immediate) { if (backTexture == null) { backTexture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\HealthBarBack"); } if (lifeTexture == null) { lifeTexture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\HealthBarLife"); } if (effect == null) { effect = BokuGame.Load <Effect>(BokuGame.Settings.MediaPath + @"Shaders\HealthBar"); ShaderGlobals.RegisterEffect("HealthBar", effect); } }
private static void ReleaseRenderTargets() { InGame.RelRT("UI2D.Shared:renderTargetDepthStencil1280_720", renderTargetDepthStencil1280_720); InGame.RelRT("UI2D.Shared:renderTargetDepthStencil1024_768", renderTargetDepthStencil1024_768); InGame.RelRT("UI2D.Shared:renderTarget512_512", renderTarget512_512); InGame.RelRT("UI2D.Shared:renderTarget512_302", renderTarget512_302); InGame.RelRT("UI2D.Shared:renderTarget256_256", renderTarget256_256); InGame.RelRT("UI2D.Shared:renderTarget128_128", renderTarget128_128); InGame.RelRT("UI2D.Shared:renderTarget64_64", renderTarget64_64); BokuGame.Release(ref renderTargetDepthStencil1280_720); BokuGame.Release(ref renderTarget1920_540); BokuGame.Release(ref renderTarget1024_768); BokuGame.Release(ref renderTarget512_512); BokuGame.Release(ref renderTarget512_302); BokuGame.Release(ref renderTarget256_256); BokuGame.Release(ref renderTarget128_128); BokuGame.Release(ref renderTarget64_64); } // endof UnloadContent()
/// <summary> /// Called to tell an object to load any device dependent parts of itself. /// </summary> public override void LoadContent(bool immediate) { if (mask == null) { mask = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\FPEMask"); } if (bump == null) { bump = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\DistortionWake"); } if (effect == null) { effect = BokuGame.Load <Effect>(BokuGame.Settings.MediaPath + @"Shaders\FPEDistort"); effectCache.Load(Effect, ""); } base.LoadContent(immediate); }
public override void UnloadContent() { BokuGame.Release(ref faceEyesOpen); BokuGame.Release(ref faceEyesSquint); BokuGame.Release(ref faceEyesPupils); BokuGame.Release(ref faceEyesPupilsCross); BokuGame.Release(ref faceBrowsUp); BokuGame.Release(ref faceBrowsNormal); BokuGame.Release(ref faceBrowsDown); if (effectCache != null) { effectCache.UnLoad(); effectCache = null; } base.UnloadContent(); }
} // end of Update() #endregion #region Internal public static void LoadContent(bool immediate) { Debug.Assert(!initialized, "GUIButtons was already initialized!"); initialized = true; // Load button Textures. buttonTexture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\Programming\TouchGUIButton"); buttonPressedTexture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\Programming\TouchGUIButton_Pressed"); transparentTexture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\BlackTransp"); // Allocate rt for panel of all buttons. This will hold all pre-rendered buttons, both pressed and non-pressed versions. buttonPanelRT = new RenderTarget2D(BokuGame.bokuGame.GraphicsDevice, (int)(GUIButton.DefaultSize.X * kNumButtons), (int)(GUIButton.DefaultSize.Y * 2), mipMap: false, preferredFormat: SurfaceFormat.Color, preferredDepthFormat: DepthFormat.None, preferredMultiSampleCount: 1, usage: RenderTargetUsage.PreserveContents); // <- This is the important bit here! }
/// <summary> /// Initialize data tables. Could be loaded from xml. /// </summary> public HiWallGen() { widthTable = new float[] { 0.10f, 0.40f, 0.40f, 0.40f, 0.50f, 0.60f, 0.60f, 0.60f }; heightTable = new float[] { 0.90f, 0.00f, 0.00f, 0.15f, 0.40f, 0.40f, 0.30f, -1.0f }; tex0Source = new float[] { 0.00f, 0.00f, 0.00f, 1.00f, 1.00f, 1.00f, 1.00f, 1.00f }; uvSource = new float[] { 1.00f, 1.00f, 1.00f, 1.00f, 1.00f, 1.00f, 1.00f, 1.00f }; centerHeight = 0.5f; uvXfm = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); InitDelTables(); diffTex0 = null; diffTex1 = null; normTex0 = null; normTex1 = null; BokuGame.Load(this); }
/// <summary> /// Initialize data tables. Could be loaded from xml. /// </summary> public HiWayWide() { widthTable = new float[] { 2.80f, 3.00f, 3.00f, 3.10f, 3.10f, 3.10f, 0.0f }; heightTable = new float[] { 0.25f, 0.25f, 0.30f, 0.30f, 0.00f, 0.00f, 0.0f }; tex0Source = new float[] { 1.00f, 1.00f, 0.00f, 0.00f, 0.00f, 0.00f, 0.00f }; uvSource = new float[] { 0.00f, 0.00f, 1.00f, 1.00f, 1.00f, 0.00f, 0.00f }; centerHeight = 0.25f; uvXfm = new Vector4(0.1f, 0.1f, 0.25f, 0.25f); InitDelTables(); diffTex0 = null; diffTex1 = null; normTex0 = null; normTex1 = null; BokuGame.Load(this); }
/// <summary> /// Version of AddPicture that allows the scale to be tweaked. Note that this is not fully supported /// in the sense that for layout purposes only the scale of the first picture is used. So if you try /// and make every picture a different size you will have problems. /// </summary> /// <param name="textureName"></param> /// <param name="label"></param> /// <param name="unselectedScale"></param> /// <param name="selectedScale"></param> public void AddPicture(string textureName, string label, float unselectedScale, float selectedScale) { Picture pic = new Picture(); pic.unselectedScale = unselectedScale; pic.selectedScale = selectedScale; pic.label = TextHelper.FilterInvalidCharacters(label); pic.textureName = textureName; pic.Texture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\" + pic.textureName); pic.scale = pic.unselectedScale; pictures.Add(pic); if (pictures.Count == 1) { pictures[0].scale = pic.selectedScale; } }
protected bool MakeVertexBuffer() { BokuGame.Release(ref vertBuff); int numVerts = NumVertices; if (numVerts > 0) { GraphicsDevice device = BokuGame.bokuGame.GraphicsDevice; vertBuff = new VertexBuffer(device, typeof(RoadGenerator.RoadVertex), numVerts, BufferUsage.WriteOnly); vertBuff.SetData <RoadGenerator.RoadVertex>(Verts); } return(numVerts > 0); }
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 static void LoadContent(bool immediate) { Debug.Assert(!isInitialized, "TouchButtons was already initialized!"); isInitialized = true; //Thumb-stick textures. ThumbStickTop_Texture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\VirtualController\ThumbStick_Light"); ThumbStickBottom_Texture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\VirtualController\ThumbStick_Dark"); for (int i = 0; i < kNumButtons; i++) { buttonHitBoxes[i] = new AABB2D(); } //Buttons buttonTextures[(int)TouchButtonType.Button_A] = BokuGame.Load <Texture2D>( BokuGame.Settings.MediaPath + @"Textures\VirtualController\Button_A"); buttonTextures[(int)TouchButtonType.Button_B] = BokuGame.Load <Texture2D>( BokuGame.Settings.MediaPath + @"Textures\VirtualController\Button_B"); buttonTextures[(int)TouchButtonType.Button_X] = BokuGame.Load <Texture2D>( BokuGame.Settings.MediaPath + @"Textures\VirtualController\Button_X"); buttonTextures[(int)TouchButtonType.Button_Y] = BokuGame.Load <Texture2D>( BokuGame.Settings.MediaPath + @"Textures\VirtualController\Button_Y"); // //DPad // buttonTextures[(int)TouchButtonType.DPad_L] = BokuGame.Load<Texture2D>( // BokuGame.Settings.MediaPath + @"Textures\Programming\TouchButton_ControllerDPad_L"); // // buttonTextures[(int)TouchButtonType.DPad_R] = BokuGame.Load<Texture2D>( // BokuGame.Settings.MediaPath + @"Textures\Programming\TouchButton_ControllerDPad_R"); // // buttonTextures[(int)TouchButtonType.DPad_U] = BokuGame.Load<Texture2D>( // BokuGame.Settings.MediaPath + @"Textures\Programming\TouchButton_ControllerDPad_U"); // // buttonTextures[(int)TouchButtonType.DPad_D] = BokuGame.Load<Texture2D>( // BokuGame.Settings.MediaPath + @"Textures\Programming\TouchButton_ControllerDPad_D"); }
public void LoadContent(bool immediate) { Model model = BokuGame.Load <Model>(BokuGame.Settings.MediaPath + modelName); ModelHelper.DumpBoneTree(model, model.Root, true); foreach (ModelBone bone in model.Root.Children) { if (bone.Name.StartsWith(PanelClassName, StringComparison.OrdinalIgnoreCase)) { AddClassRender(PanelClassName, model, bone); } else if (bone.Name.StartsWith(ButtonClassName, StringComparison.OrdinalIgnoreCase)) { AddClassRender(ButtonClassName, model, bone); } else if (bone.Name.StartsWith(CursorClassName, StringComparison.OrdinalIgnoreCase)) { AddClassRender(CursorClassName, model, bone); } else if (bone.Name.StartsWith(Horizontal3GridClassName, StringComparison.OrdinalIgnoreCase)) { foreach (ModelBone bonePart in bone.Children) { if (bonePart.Name.StartsWith(H3gLeftPartName, StringComparison.OrdinalIgnoreCase)) { AddClassPartRender(Horizontal3GridClassName, H3gLeftPartTag, model, bonePart); } else if (bonePart.Name.StartsWith(H3gRepeatPartName, StringComparison.OrdinalIgnoreCase)) { AddClassPartRender(Horizontal3GridClassName, H3gRepeatPartTag, model, bonePart); } else if (bonePart.Name.StartsWith(H3gRightPartName, StringComparison.OrdinalIgnoreCase)) { AddClassPartRender(Horizontal3GridClassName, H3gRightPartTag, model, bonePart); } } } // add other supported classes here otherwise they get // tossed out and ingored } }
private void LoadTextures() { if ((bumpDetail == null) && !string.IsNullOrEmpty(bumpDetailName)) { bumpDetail = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + bumpDetailName); } if ((dirtMap == null) && !string.IsNullOrEmpty(dirtMapName)) { dirtMap = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + dirtMapName); } if (whiteMap == null) { whiteMap = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\White"); } if (checkerMap == null) { checkerMap = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\Checker"); } }
/// <summary> /// Setup data tables. Could come from xml. /// </summary> public Posts() { widthTable = new float[] { 0.20f, 0.20f, 0.20f }; heightTable = new float[] { 2.30f, 2.30f, -1.00f }; tex0Source = new float[] { 1.00f, 1.00f, 1.00f }; tex1Source = null; tex2Source = null; // For UV source, 0 is horizontal mapping, 1 is vertical mapping uvSource = new float[] { 0.00f, 1.00f, 1.00f }; centerHeight = 2.30f; InitDelTables(); diffTex0 = null; diffTex1 = null; normTex0 = null; normTex1 = null; BokuGame.Load(this); }
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()
} // end of ThoughtBalloonManager RemoveThoughts() public static void LoadContent(bool immediate) { // Init the effect. if (effect == null) { effect = BokuGame.Load <Effect>(BokuGame.Settings.MediaPath + @"Shaders\ThoughtBalloon"); ShaderGlobals.RegisterEffect("ThoughtBalloon", effect); } // Load the frame texture. if (frameTexture == null) { frameTexture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\TextEditor\ThoughtBalloon"); } if (tutorialFocusArrow == null) { tutorialFocusArrow = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\GridElements\TutorialFocusArrow"); } } // end of LoadContent()
} // end of Render() #endregion #region Internal public override void LoadContent(bool immediate) { if (reticuleTexture == null) { reticuleTexture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\UI2D\Tools\SelectionReticule"); } base.LoadContent(immediate); // If we've had device reset we need to refresh the tool icon we've given to the help overlay. // We let the base.LoadContent call go first to ensure that the new texture is good to go. if (HelpOverlay.ToolIcon != null && HelpOverlay.ToolIcon.GraphicsDevice.IsDisposed) { UIGrid2DTextureElement selection = SelectionElement as UIGrid2DTextureElement; if (selection != null) { HelpOverlay.ToolIcon = selection.DiffuseTexture; } } } // end of LoadContent()
} // end of Init() public static void CleanUp() { foreach (SystemFont font in systemFonts.Values) { font.Font.Dispose(); } brushBlack.Dispose(); format.Dispose(); graphics.Dispose(); bitmap.Dispose(); BokuGame.Release(ref texture); while (cacheList.Count > 0) { CacheEntry ce = cacheList[0]; cacheList.RemoveAt(0); ce.UnloadContent(); } } // end of CleanUp()
} // end of UIGrid2DCheckboxElement 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) { 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 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; }
public static void InitDeviceResources(GraphicsDevice device) { batch = new SpriteBatch(device); segoeUI20 = BokuGame.Load <SpriteFont>(BokuGame.Settings.MediaPath + @"Fonts\SegoeUI20"); segoeUI24 = BokuGame.Load <SpriteFont>(BokuGame.Settings.MediaPath + @"Fonts\SegoeUI24"); segoeUI30 = BokuGame.Load <SpriteFont>(BokuGame.Settings.MediaPath + @"Fonts\SegoeUI30"); CreateRenderTargets(device); if (blackButtonTexture == null) { blackButtonTexture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\GridElements\BlackTextTile"); } if (upDownArrowsTexture == null) { upDownArrowsTexture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\HelpCard\UpDownArrows"); } } // end of InitDeviceResources()
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); }
} // end of UIGridModularCameraModeElement Render() public override void LoadContent(bool immediate) { // Init the effect. if (effect == null) { effect = BokuGame.Load <Effect>(BokuGame.Settings.MediaPath + @"Shaders\UI2D"); ShaderGlobals.RegisterEffect("UI2D", effect); } // Load the normal map texture. if (normalMapName != null) { normalMap = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\UI2D\" + normalMapName); } // Load the check textures. if (white == null) { white = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\GridElements\SliderWhite"); } if (black == null) { black = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\GridElements\RadioBoxBlack"); } if (middleBlack == null) { middleBlack = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\GridElements\MiddleBlack"); } if (icons == null) { icons = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\GridElements\CameraModeIcons"); } if (indicatorLit == null) { indicatorLit = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\GridElements\IndicatorLit"); } if (indicatorUnlit == null) { indicatorUnlit = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\GridElements\IndicatorUnlit"); } } // end of UIGridModularCameraModeElement LoadContent()
/// <summary> /// Initialize data tables. Could be loaded from xml. /// </summary> public HiWallGen2() { widthTable = new float[] { 0.010f, 0.200f, 0.300f, 0.400f, 0.500f, 0.600f, 0.600f, 0.600f }; heightTable = new float[] { 0.409f, 0.408f, 0.405f, 0.403f, 0.400f, 0.390f, 0.390f, -1.00f }; tex0Source = new float[] { 1.000f, 1.000f, 1.000f, 1.000f, 1.000f, 1.000f, 0.000f, 0.00f }; uvSource = new float[] { 0.000f, 0.000f, 0.000f, 0.000f, 0.000f, 0.000f, 1.000f, 1.00f }; centerHeight = 0.410f; Shininess = 0.1f; uvXfm = new Vector4(0.3f, 0.3f, 0.3f, 0.3f); InitDelTables(); diffTex0 = null; diffTex1 = null; normTex0 = null; normTex1 = null; BokuGame.Load(this); }