/// <summary> /// This method initializes the element of the interface /// </summary> /// <param name="name"> A name to pass to generate the overaly </param> protected override void Load(string name) { base.Load(name); scoreText = OverlayManager.Singleton.GetOverlayElement("ScoreText2"); scoreText.Caption = score + ((PlayerStats)characterStats).Score.Value.ToString(); scoreText.Left = mWindow.Width * 0.65f; timeText = OverlayManager.Singleton.GetOverlayElement("TimeText2"); timeText.Caption = time; timeText.Left = mWindow.Width * 0.5f; if (winLose) { winLoseText = OverlayManager.Singleton.GetOverlayElement("Win"); winLoseText.Caption = "You Win!"; winLoseText.Left = mWindow.Width * 0.5f; winLoseText.Top = mWindow.Height * 0.5f; } else { winLoseText = OverlayManager.Singleton.GetOverlayElement("Win"); winLoseText.Caption = "You Lose! Try Again!"; winLoseText.Left = mWindow.Width * 0.5f; winLoseText.Top = mWindow.Height * 0.5f; } panel = (PanelOverlayElement)OverlayManager.Singleton.GetOverlayElement("BigBackground"); panel.Width = mWindow.Width; panel.Height = panel.Height; }
protected static bool IsWithin(Point point, OverlayElement element) { return point.X >= element.Left && point.X <= element.Left + element.Width && point.Y >= element.Top && point.Y <= element.Top + element.Height; }
public void Start(RenderWindow window, ushort numGroupsInit, ushort numGroupsLoad, float initProportion) { this.window = window; this.numGroupsInit = numGroupsInit; this.numGroupsLoad = numGroupsLoad; this.initProportion = initProportion; // We need to pre-initialise the 'Bootstrap' group so we can use // the basic contents in the loading screen ResourceGroupManager.Singleton.InitialiseResourceGroup("Bootstrap"); OverlayManager omgr = OverlayManager.Singleton; loadOverlay = omgr.GetByName("Core/LoadOverlay"); if (loadOverlay == null) System.Windows.Forms.MessageBox.Show("Cannot find loading overlay", "ExampleLoadingBar::start", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); loadOverlay.Show(); // Save links to the bar and to the loading text, for updates as we go loadingBarElement = omgr.GetOverlayElement("Core/LoadPanel/Bar/Progress"); loadingCommentElement = omgr.GetOverlayElement("Core/LoadPanel/Comment"); loadingDescriptionElement = omgr.GetOverlayElement("Core/LoadPanel/Description"); OverlayElement barContainer = omgr.GetOverlayElement("Core/LoadPanel/Bar"); progressBarMaxSize = barContainer.Width; loadingBarElement.Width = 0F; ResourceGroupManager.Singleton.ResourceGroupScriptingStarted += ResourceGroupScriptingStarted; ResourceGroupManager.Singleton.ScriptParseStarted += ScriptParseStarted; ResourceGroupManager.Singleton.ScriptParseEnded += ScriptParseEnded; ResourceGroupManager.Singleton.ResourceGroupLoadStarted += ResourceGroupLoadStarted; ResourceGroupManager.Singleton.ResourceLoadStarted += ResourceLoadStarted; ResourceGroupManager.Singleton.WorldGeometryStageStarted += WorldGeometryStageStarted; ResourceGroupManager.Singleton.WorldGeometryStageEnded += WorldGeometryStageEnded; }
//private bool dragging; public ListView(string name, float left, float top, float height, float width, List <string> columnNames) { listview = OverlayManager.Singleton.CreateOverlayElementFromTemplate("AMGE/UI/ListView", "BorderPanel", name) as OverlayContainer; scroll = listview.GetChild(name + "/ListViewScroll") as BorderPanelOverlayElement; drag = scroll.GetChild(name + "/ListViewScroll" + "/ListViewDrag") as OverlayElement; this.name = name; this.top = top; this.height = height; this.width = width; this.left = left; listview.Top = top; listview.Left = left; listview.Height = height; listview.Width = width; scroll.Height = height - 0.016f; drag.Hide(); //remove column's height maxShowItem = System.Math.Floor(Convert.ToDouble(float.Parse((height - 0.04f).ToString("0.00")) / 0.045f)); columns = new List <ListViewColumn>(); items = new List <ListViewItem>(); visibleItems = new List <ListViewItem>(); allUsedElements = new List <OverlayElement>(); mElement = listview; LoadColumns(columnNames); }
public static void nukeOverlayElement(OverlayElement element) { Mogre.OverlayContainer container = element as Mogre.OverlayContainer; if (container != null) { List <Mogre.OverlayElement> toDelete = new List <Mogre.OverlayElement>(); Mogre.OverlayContainer.ChildIterator children = container.GetChildIterator(); while (children.MoveNext()) { toDelete.Add(children.Current); } for (int i = 0; i < toDelete.Count; i++) { nukeOverlayElement(toDelete[i]); } } if (element != null) { Mogre.OverlayContainer parent = element.Parent; if (parent != null) { parent.RemoveChild(element.Name); } Mogre.OverlayManager.Singleton.DestroyOverlayElement(element); } }
/// <summary> /// Static utility method to recursively delete an overlay element plus<para></para> /// all of its children from the system. /// </summary> /// <param name="element"></param> public static void NukeOverlayElement(OverlayElement element) { var container = element as OverlayElementContainer; if (container != null) { var toDelete = new List <OverlayElement>(); foreach (OverlayElement child in container.Children.Values) { toDelete.Add(child); } for (int i = 0; i < toDelete.Count; i++) { NukeOverlayElement(toDelete[i]); } } if (element != null) { OverlayElementContainer parent = element.Parent; if (parent != null) { parent.RemoveChild(element.Name); } OverlayManager.Instance.Elements.DestroyElement(element.Name); } }
/// <summary> /// Static utility method used to get the cursor's offset from the center<para></para> /// of an overlay element in pixels. /// </summary> /// <param name="element"></param> /// <param name="cursorPos"></param> /// <returns></returns> public static Vector2 CursorOffset(OverlayElement element, Vector2 cursorPos) { OverlayManager om = OverlayManager.Instance; return(new Vector2(cursorPos.x - (element.DerivedLeft * om.ViewportWidth + element.Width / 2), cursorPos.y - (element.DerivedTop * om.ViewportHeight + element.Height / 2))); }
public static void NukeOverlayElement(OverlayElement element) { var container = element as OverlayContainer; if (container != null) { var toDelete = new List <OverlayElement>(); //Ogre::OverlayContainer::ChildIterator children = container->getChildIterator(); //while (children.hasMoreElements()) //{ // toDelete.push_back(children.getNext()); //} //for (int i = 0; i < toDelete.Count; i++) //{ // NukeOverlayElement(toDelete[i]); //} } if (element != null) { OverlayContainer parent = element.Parent; if (parent != null) { parent.RemoveChild(element.Name); } OverlayManager.Singleton.DestroyOverlayElement(element); } }
/// <summary> /// Updates the debug overlay /// </summary> protected virtual void UpdateOverlay(object source, FrameEventArgs e) { if (Root.Instance.Timer.Milliseconds - m_lastOverlayUpdate >= 1000) { m_lastOverlayUpdate = Root.Instance.Timer.Milliseconds; OverlayElement element = OverlayElementManager.Instance.GetElement("Core/DebugText"); element.Text = m_renderWindow.DebugText; element = OverlayElementManager.Instance.GetElement("Core/CurrFps"); element.Text = string.Format("Current FPS: {0}", Root.Instance.CurrentFPS); element = OverlayElementManager.Instance.GetElement("Core/BestFps"); element.Text = string.Format("Best FPS: {0}", Root.Instance.BestFPS); element = OverlayElementManager.Instance.GetElement("Core/WorstFps"); element.Text = string.Format("Worst FPS: {0}", Root.Instance.WorstFPS); element = OverlayElementManager.Instance.GetElement("Core/AverageFps"); element.Text = string.Format("Average FPS: {0}", Root.Instance.AverageFPS); element = OverlayElementManager.Instance.GetElement("Core/NumTris"); element.Text = string.Format("Triangle Count: {0}", m_sceneManager.TargetRenderSystem.FacesRendered); } }
/// <summary> /// This method initializes the element of the interface /// </summary> /// <param name="name"> A name to pass to generate the overaly </param> protected override void Load(string name) { base.Load(name); lives = new List <SceneNode>(); healthBar = OverlayManager.Singleton.GetOverlayElement("HealthBar"); hRatio = healthBar.Width / (float)characterStats.Health.Max; shieldBar = OverlayManager.Singleton.GetOverlayElement("ShieldBar"); sRatio = shieldBar.Width / (float)characterStats.Shield.Max; scoreText = OverlayManager.Singleton.GetOverlayElement("ScoreText"); scoreText.Caption = score; scoreText.Left = mWindow.Width * 0.5f; timeText = OverlayManager.Singleton.GetOverlayElement("TimeText"); timeText.Caption = timeX; timeText.Left = mWindow.Width * 0.5f; lifeArea = OverlayManager.Singleton.GetOverlayElement("LifeArea"); //hRatio = lifeBar.Width / (float)characterStats.Lives.Max; panel = (PanelOverlayElement)OverlayManager.Singleton.GetOverlayElement("GreenBackground"); panel.Width = mWindow.Width; LoadOverlay3D(); }
/// <summary> /// This method is called when Level Timer = max time /// </summary> public void MaxTime() { levelTime = OverlayManager.Singleton.GetOverlayElement("GameOverText"); levelTime.Caption = lTText; levelTime.Left = mWindow.Width * 0.5f; levelTime.Top = mWindow.Height * 0.5f; }
// Create text area for SkyX parameters private void _createTextArea() { // Create a panel OverlayContainer panel = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement("Panel", "SkyXParametersPanel"); panel.MetricsMode = GuiMetricsMode.GMM_PIXELS; panel.SetPosition(10, 10); panel.SetDimensions(400, 400); // Create a text area _textArea = OverlayManager.Singleton.CreateOverlayElement("TextArea", "SkyXParametersTextArea"); _textArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; _textArea.SetPosition(0, 0); _textArea.SetDimensions(100, 100); // _textArea.Text = "MogreLib SkyX plugin demo"; _textArea._setHeight(16); //_textArea.FontName = "BlueHighway"; // _textArea.ColorBottom = new ColorEx(0.3f, 0.5f, 0.3f); //_textArea.ColorTop = new ColorEx(0.5f, 0.7f, 0.5f); // Create an overlay, and add the panel Overlay overlay = OverlayManager.Singleton.Create("OverlayName"); overlay.Add2D(panel); // Add the text area to the panel panel.AddChild(_textArea); // Show the overlay overlay.Show(); }
private void UpdateStats() { string currFps = "Current FPS: "; string avgFps = "Average FPS: "; string bestFps = "Best FPS: "; string worstFps = "Worst FPS: "; string tris = "Triangle Count: "; // update stats when necessary try { OverlayElement guiAvg = OverlayManager.Singleton.GetOverlayElement("Core/AverageFps"); OverlayElement guiCurr = OverlayManager.Singleton.GetOverlayElement("Core/CurrFps"); OverlayElement guiBest = OverlayManager.Singleton.GetOverlayElement("Core/BestFps"); OverlayElement guiWorst = OverlayManager.Singleton.GetOverlayElement("Core/WorstFps"); RenderTarget.FrameStats stats = this.renderWindow.GetStatistics(); guiAvg.Caption = avgFps + stats.AvgFPS; guiCurr.Caption = currFps + stats.LastFPS; guiBest.Caption = bestFps + stats.BestFPS + " " + stats.BestFrameTime + " ms"; guiWorst.Caption = worstFps + stats.WorstFPS + " " + stats.WorstFrameTime + " ms"; OverlayElement guiTris = OverlayManager.Singleton.GetOverlayElement("Core/NumTris"); guiTris.Caption = tris + stats.TriangleCount; } catch { // ignore } }
private void CreateAmmoContainer() { ammoElement = OverlayManager.Singleton.CreateOverlayElement( "TextArea", "ammoElement " + DateTime.Now.Ticks); ammoContainer = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement( "Panel", "ammoContainer " + DateTime.Now.Ticks); int count = 0; switch (gameScreen.CurrentLevel.UserPlane.Weapon.SelectWeapon) { case WeaponType.Bomb: count = gameScreen.CurrentLevel.UserPlane.Weapon.BombCount; break; case WeaponType.Rocket: count = gameScreen.CurrentLevel.UserPlane.Weapon.RocketCount; break; case WeaponType.Torpedo: count = gameScreen.CurrentLevel.UserPlane.Weapon.TorpedoCount; break; } ConfigureElement(ammoElement, minimapViewport.ActualWidth, minimapViewport.ActualHeight, count.ToString()); ConfigureContainer(ammoContainer, ammoElement, minimapViewport.ActualWidth, minimapViewport.ActualHeight, UnitConverter.AspectDependentHorizontalProportion(0.061f, viewport), (int)(viewport.ActualHeight - minimapViewport.ActualHeight * 0.276f)); }
/// <summary> /// This method is called when Lives = 0 /// </summary> public void GameOver() { gameOver = OverlayManager.Singleton.GetOverlayElement("GameOverText"); gameOver.Caption = gmText; gameOver.Left = mWindow.Width * 0.5f; gameOver.Top = mWindow.Height * 0.5f; }
/// <summary> /// This method initializes the element of the interface /// </summary> /// <param name="name"> A name to pass to generate the overaly </param> protected override void Load(string name) { base.Load(name); ConvertTime(2); lives = new List <SceneNode>(); healthBar = OverlayManager.Singleton.GetOverlayElement("HealthBar"); hRatio = healthBar.Width / (float)characterStats.Health.Max; /*healthBarText = OverlayManager.Singleton.GetOverlayElement("HealthBar"); * healthBarText.Caption = health; * healthBarText.Left = mWindow.Width * 0.5f; */ shieldBar = OverlayManager.Singleton.GetOverlayElement("ShieldBar"); sRatio = shieldBar.Width / (float)characterStats.Shield.Max; scoreText = OverlayManager.Singleton.GetOverlayElement("ScoreText"); scoreText.Caption = score; scoreText.Left = mWindow.Width * 0.5f; timeText = OverlayManager.Singleton.GetOverlayElement("TimeText"); timeText.Caption = timer; timeText.Left = mWindow.Width * 0.3f; gameOverText = OverlayManager.Singleton.GetOverlayElement("GameOver"); panel = (PanelOverlayElement)OverlayManager.Singleton.GetOverlayElement("GreenBackground"); panel.Width = mWindow.Width; LoadOverlay3D(); }
/// <summary> /// Disposes of the ExampleApplication instance. /// </summary> public virtual void Dispose() { mSceneManager.ClearScene(); mPanel = null; mOverlay = null; mODebugText1 = null; mODebugText2 = null; mODebugText3 = null; mODebugText4 = null; mRenderWindow = null; mCamera = null; mViewport = null; mEventHandler = null; mDebugOverlay = null; mAverageFPS = null; mBestFPS = null; mWorstFPS = null; mCurrentFPS = null; mTriangleCount = null; mSceneManager = null; mRoot.Dispose(); }
public override void Exit() { UIManager.Instance.HideCursor(); editor.Dispose(); OverlayContainer.ChildIterator children = editorPanel.GetChildIterator(); while (children.MoveNext()) { OverlayElement currentElement = children.Current; editorPanel.RemoveChild(currentElement.Name); } UIManager.Instance.DestroyWidget(btnAddObject); UIManager.Instance.DestroyWidget(btnAIMeshCreateLine); UIManager.Instance.DestroyWidget(btnAIMeshCreateVertex); UIManager.Instance.DestroyWidget(btnClose); UIManager.Instance.DestroyWidget(btnSave); UIManager.Instance.DestroyWidget(lbAIMesh); UIManager.Instance.DestroyWidget(lbGeneral); UIManager.Instance.DestroyWidget(lbObjects); UIManager.Instance.DestroyWidget(lsvObjects); Widget.NukeOverlayElement(horline); Widget.NukeOverlayElement(horline2); UIManager.Instance.GetTraysLayer().Remove2D(editorPanel); Widget.NukeOverlayElement(editorPanel); }
public virtual void copyFromTemplate(OverlayElement templateOverlay) { OgreOverlayPINVOKE.OverlayElement_copyFromTemplate(swigCPtr, OverlayElement.getCPtr(templateOverlay)); if (OgreOverlayPINVOKE.SWIGPendingException.Pending) { throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual void addChildImpl(OverlayElement elem) { OgreOverlayPINVOKE.OverlayContainer_addChildImpl__SWIG_0(swigCPtr, OverlayElement.getCPtr(elem)); if (OgreOverlayPINVOKE.SWIGPendingException.Pending) { throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual void destroyOverlayElement(OverlayElement pElement) { OgreOverlayPINVOKE.OverlayElementFactory_destroyOverlayElement(swigCPtr, OverlayElement.getCPtr(pElement)); if (OgreOverlayPINVOKE.SWIGPendingException.Pending) { throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve(); } }
/// <summary> /// /// </summary> public void Cleanup() { if (this.element != null) { NukeOverlayElement(this.element); } this.element = null; }
public static void ChangeElementColour(OverlayElement element, ColourValue c1, ColourValue c2) { string colour1 = String.Format("{0:f} {1:f} {2:f}", StringConverter.ToString(c1.r), StringConverter.ToString(c1.g), StringConverter.ToString(c1.b)); string colour2 = String.Format("{0:f} {1:f} {2:f}", StringConverter.ToString(c2.r), StringConverter.ToString(c2.g), StringConverter.ToString(c2.b)); element.SetParameter("colour_top", colour1); element.SetParameter("colour_bottom", colour2); }
public void _removeChild(OverlayElement elem) { OgreOverlayPINVOKE.OverlayContainer__removeChild__SWIG_0(swigCPtr, OverlayElement.getCPtr(elem)); if (OgreOverlayPINVOKE.SWIGPendingException.Pending) { throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve(); } }
public void destroyOverlayElement(OverlayElement pInstance) { OgreOverlayPINVOKE.OverlayManager_destroyOverlayElement__SWIG_3(swigCPtr, OverlayElement.getCPtr(pInstance)); if (OgreOverlayPINVOKE.SWIGPendingException.Pending) { throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve(); } }
public static void AlignTextAreaHorzRight(OverlayElement textArea, Viewport viewport, float rMargin) { string fontName = textArea.GetParameter("font_name"); Font font = (Font)(FontManager.Singleton.GetByName(fontName).Target); Vector2 dim = ViewHelper.GetTextDimensions(textArea.Caption, font, viewport); textArea.SetPosition((1 - dim.x) - rMargin, textArea.Top); }
public void Cleanup() { if (element != null) { NukeOverlayElement(element); } element = null; Dispose(); }
private void ApplyBase(OverlayElement element) { element.MetricsMode = GuiMetricsMode.GMM_PIXELS; element.Colour = Color ?? ColourValue.Black; element.Width = Dimension != null ? Dimension.Value.Width : 50; element.Height = Dimension != null ? Dimension.Value.Height : 50; element.Left = Position != null ? Position.Value.X : 0; element.Top = Position != null ? Position.Value.Y : 0; element.MaterialName = Material ?? ""; }
// HasCustomIconPosition /* public GameMessages(Viewport mainViewport, float xMargin, float yMargin) : this(mainViewport) * { * this.xMargin = xMargin; * this.yMargin = yMargin; * }*/ public GameMessages(Viewport mainViewport) { messageQueue = new List <MessageEntry>(); this.mainViewport = mainViewport; messageOverlay = OverlayManager.Singleton.GetByName("Wof/HUD"); messageBgOverlay = OverlayManager.Singleton.GetByName("Wof/MessageBarBg"); backgroundElement = OverlayManager.Singleton.GetOverlayElement("Wof/MessageBarIconBg"); CreateMessageContainer(); }
/// <summary> /// /// </summary> /// <param name="element"></param> /// <param name="cursorPos"></param> /// <param name="voidBorder"></param> /// <returns></returns> public static bool IsCursorOver(OverlayElement element, Vector2 cursorPos, Real voidBorder) { OverlayManager om = OverlayManager.Instance; var l = (int)(element.DerivedLeft * om.ViewportWidth); var t = (int)(element.DerivedTop * om.ViewportHeight); int r = l + (int)element.Width; int b = t + (int)element.Height; return(cursorPos.x >= l + voidBorder && cursorPos.x <= r - voidBorder && cursorPos.y >= t + voidBorder && cursorPos.y <= b - voidBorder); }
public override OverlayElement createOverlayElement(string instanceName) { global::System.IntPtr cPtr = OgreOverlayPINVOKE.TextAreaOverlayElementFactory_createOverlayElement(swigCPtr, instanceName); OverlayElement ret = (cPtr == global::System.IntPtr.Zero) ? null : new OverlayElement(cPtr, true); if (OgreOverlayPINVOKE.SWIGPendingException.Pending) { throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public OverlayElement createOverlayElementFromFactory(string typeName, string instanceName) { global::System.IntPtr cPtr = OgreOverlayPINVOKE.OverlayManager_createOverlayElementFromFactory(swigCPtr, typeName, instanceName); OverlayElement ret = (cPtr == global::System.IntPtr.Zero) ? null : new OverlayElement(cPtr, true); if (OgreOverlayPINVOKE.SWIGPendingException.Pending) { throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public OverlayElement getOverlayElement(string name) { global::System.IntPtr cPtr = OgreOverlayPINVOKE.OverlayManager_getOverlayElement__SWIG_1(swigCPtr, name); OverlayElement ret = (cPtr == global::System.IntPtr.Zero) ? null : new OverlayElement(cPtr, true); if (OgreOverlayPINVOKE.SWIGPendingException.Pending) { throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public DebugOverlayManager() { this.overlay = OverlayManager.Singleton.GetByName("Core/DebugOverlay"); Launch.OnEveryUnpausedTenthOfASecondEvent += EveryTenth; #if DEBUG ShowDebugOverlay(true); #endif guiAvg = OverlayManager.Singleton.GetOverlayElement("Core/AverageFps", false); guiCurr = OverlayManager.Singleton.GetOverlayElement("Core/CurrFps", false); guiTris = OverlayManager.Singleton.GetOverlayElement("Core/NumTris", false); guiBatches = OverlayManager.Singleton.GetOverlayElement("Core/NumBatches", false); }
public static void Show() { DebugOverlay = OverlayManager.Singleton.GetByName("Core/DebugOverlay"); myAvg = OverlayManager.Singleton.GetOverlayElement("Core/AverageFps"); myCurr = OverlayManager.Singleton.GetOverlayElement("Core/CurrFps"); myBest = OverlayManager.Singleton.GetOverlayElement("Core/BestFps"); myWorst = OverlayManager.Singleton.GetOverlayElement("Core/WorstFps"); myNumTris = OverlayManager.Singleton.GetOverlayElement("Core/NumTris"); myNumBatches = OverlayManager.Singleton.GetOverlayElement("Core/NumBatches"); DebugOverlay.Show(); }
public DebugOverlay(RenderWindow window) { mWindow = window; var debugOverlay = OverlayManager.Singleton.GetByName("Core/DebugOverlay"); debugOverlay.Show(); mGuiAvg = OverlayManager.Singleton.GetOverlayElement("Core/AverageFps"); mGuiCurr = OverlayManager.Singleton.GetOverlayElement("Core/CurrFps"); mGuiBest = OverlayManager.Singleton.GetOverlayElement("Core/BestFps"); mGuiWorst = OverlayManager.Singleton.GetOverlayElement("Core/WorstFps"); mGuiTris = OverlayManager.Singleton.GetOverlayElement("Core/NumTris"); mModesText = OverlayManager.Singleton.GetOverlayElement("Core/NumBatches"); }
public override void CreateScene() { //Check to see if vertex and fragment programs are supported if(!Root.Singleton.RenderSystem.Capabilities.HasCapability(Capabilities.RSC_VERTEX_PROGRAM)) MessageBox.Show("Your graphics card does not support vertex shaders and cannot run this demo.\nDot3Bump.CreateScene"); else if(!Root.Singleton.RenderSystem.Capabilities.HasCapability(Capabilities.RSC_FRAGMENT_PROGRAM)|| !Root.Singleton.RenderSystem.Capabilities.HasCapability(Capabilities.RSC_DOT3)) MessageBox.Show("Your graphics card does not support dot3 blending or fragment programs and cannot run this demo.\nDot3Bump.CreatScene"); else { //set ambient light sceneMgr.AmbientLight=new ColourValue(0f,0f,0f); mMainNode=sceneMgr.RootSceneNode.CreateChildSceneNode(); //Load the meshes with nond default HBU options for(int mn=0;mn<NUM_ENTITIES;mn++) { MeshPtr pMesh=MeshManager.Singleton.Load(mEntityMeshes[mn], ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, HardwareBuffer.Usage.HBU_DYNAMIC_WRITE_ONLY, HardwareBuffer.Usage.HBU_STATIC_WRITE_ONLY, true, true);//can still read it ushort src, dest; if(!pMesh.SuggestTangentVectorBuildParams(VertexElementSemantic.VES_TANGENT, out src,out dest)) pMesh.BuildTangentVectors(VertexElementSemantic.VES_TANGENT, src,dest); //create entity mEntities[mn]=sceneMgr.CreateEntity("Ent"+mn.ToString(),mEntityMeshes[mn]); //attach to main node mMainNode.AttachObject(mEntities[mn]); //make invisible except for index 0 if(mn==0) mEntities[mn].SetMaterialName(mMaterialNames[mCurrentEntity][mCurrentMaterial]); else mEntities[mn].Visible=false; } for(int i=0;i<NUM_LIGHTS;i++) { mLightPivots[i]=sceneMgr.RootSceneNode.CreateChildSceneNode(); mLightPivots[i].Rotate(mLightRotationAxes[i],mLightRotationAngles[i]); //create a light, use default parameters mLights[i]=sceneMgr.CreateLight("Light"+i.ToString()); mLights[i].Position=mLightPositions[i]; mLights[i].DiffuseColour=mDiffuseLightColours[i]; mLights[i].SpecularColour=mSpecularLightColours[i]; mLights[i].Visible=mLightState[i]; //attach light to pivot mLightPivots[i].AttachObject(mLights[i]); //create billboard for the light mLightFlareSets[i]=sceneMgr.CreateBillboardSet("Flare"+i.ToString()); mLightFlareSets[i].SetMaterialName("Examples/Flare"); mLightPivots[i].AttachObject(mLightFlareSets[i]); mLightFlares[i]=mLightFlareSets[i].CreateBillboard(mLightPositions[i]); mLightFlares[i].Colour=mDiffuseLightColours[i]; mLightFlareSets[i].Visible=true; } //move the camera to the right and make it look at the mesh camera.MoveRelative(new Vector3(50f,0f,20f)); camera.LookAt(0f,0f,0f); //show overlay Overlay Over=OverlayManager.Singleton.GetByName("Example/DP3Overlay"); mObjectInfo=OverlayManager.Singleton.GetOverlayElement("Example/DP3/ObjectInfo"); mMaterialInfo=OverlayManager.Singleton.GetOverlayElement("Example/DP3/MaterialInfo"); mInfo=OverlayManager.Singleton.GetOverlayElement("Example/DP3/Info"); mObjectInfo.Caption="Current"+mEntityMeshes[mCurrentEntity]; mMaterialInfo.Caption="Current"+mMaterialNames[mCurrentEntity][mCurrentMaterial]; if(!Root.Singleton.RenderSystem.Capabilities.HasCapability(Capabilities.RSC_FRAGMENT_PROGRAM)) mInfo.Caption="NOTE: Light colours and specular highlights are not supported by your card"; Over.Show(); //register key event monitor } }
/// <summary> /// This method initializes the element of the interface /// </summary> /// <param name="name"> A name to pass to generate the overaly </param> protected override void Load(string name) { base.Load(name); lives = new List<SceneNode>(); healthBar = OverlayManager.Singleton.GetOverlayElement("HealthBar"); hRatio = healthBar.Width / (float)characterStats.Health.Max; shieldBar = OverlayManager.Singleton.GetOverlayElement("ShieldBar"); sRatio = shieldBar.Width / (float)characterStats.Shield.Max; scoreText = OverlayManager.Singleton.GetOverlayElement("ScoreText"); scoreText.Caption = score; scoreText.Left = mWindow.Width * 0.5f; timeText = OverlayManager.Singleton.GetOverlayElement("TimeText"); timeText.Caption = timeX; timeText.Left = mWindow.Width * 0.5f; lifeArea = OverlayManager.Singleton.GetOverlayElement("LifeArea"); //hRatio = lifeBar.Width / (float)characterStats.Lives.Max; panel = (PanelOverlayElement) OverlayManager.Singleton.GetOverlayElement("GreenBackground"); panel.Width = mWindow.Width; LoadOverlay3D(); }