public static Panel createPanel(this SdkTrayManager trayMgr, TrayLocation trayLoc, string name, float width, float height, float left, float top) { Panel panel = new Panel(name, width, height, left, top); trayMgr.moveWidgetToTray(panel, trayLoc); return(panel); }
/// <summary> /// /// </summary> protected override void Shutdown() { if (this.TrayManager != null) { this.TrayManager = null; } if (CurrentSample == null) { DestroyDummyScene(); } this.CategoryMenu = null; this.SampleMenu = null; this.SampleSlider = null; this.TitleLabel = null; this.DescBox = null; this.RendererMenu = null; this.HiddenOverlays.Clear(); this.Thumbs.Clear(); this.CarouselPlace = 0; base.Shutdown(); UnloadSamples(); }
public static Panel createPanel(this SdkTrayManager trayMgr, TrayLocation trayLoc, string name) { Panel panel = new Panel(name); trayMgr.moveWidgetToTray(panel, trayLoc); return(panel); }
public static InputBox createInputBox(this SdkTrayManager trayMgr, TrayLocation trayLoc, string name, string caption, float width, float boxWidth, string text = null, bool onlyAcceptNum = false) { InputBox ib = new InputBox(name, caption, width, boxWidth, text, onlyAcceptNum); trayMgr.moveWidgetToTray(ib, trayLoc); ib.Text = text; //ib._assignListener(mListener); return(ib); }
public SdkSample() { // so we don't have to worry about checking if these keys exist later Metadata["Title"] = "Untitled"; Metadata["Description"] = String.Empty; Metadata["Category"] = "Unsorted"; Metadata["Thumbnail"] = String.Empty; Metadata["Help"] = String.Empty; this.TrayManager = null; this.CameraManager = null; }
public AdvancedMogreFramework() { m_pRoot = null; m_pRenderWnd = null; m_pViewport = null; m_pLog = null; m_pTimer = null; m_pInputMgr = null; m_pKeyboard = null; m_pMouse = null; m_pTrayMgr = null; }
private bool Setup() { createLogManager(); this.mRoot = new Root(PLUGINS_CFG); //mOverlaySystem = new Mogre.OverlaySystem(); setupResources(); if (!this.Configure()) { return(false); } this.ChooseSceneManager(); this.CreateCamera(); this.CreateViewports(); createCompositor(); TextureManager.Singleton.DefaultNumMipmaps = 5; this.LoadResources(); // this.mInput = new MoisManager(); int windowHnd; this.mWindow.GetCustomAttribute("WINDOW", out windowHnd); this.mInput.Startup(windowHnd, this.mWindow.Width, this.mWindow.Height); //System.Windows.Forms.Control form = System.Windows.Forms.Form.FromHandle(new IntPtr(windowHnd)); //form.MinimumSize = new System.Drawing.Size(800, 600); this.mTrayMgr = new SdkTrayManager("trayMgr", this.mWindow, this.mInput.Mouse, this); this.mTrayMgr.showFrameStats(TrayLocation.TL_BOTTOMLEFT); this.mTrayMgr.hideCursor(); //this.mTrayMgr.hideFrameStats(); //this.mTrayMgr.showFrameStats(TrayLocation.TL_BOTTOMLEFT); //this.mTrayMgr.showLogo(TrayLocation.TL_BOTTOMLEFT); //this.mTrayMgr.showOkDialog("context...", "this is a test"); //this.mTrayMgr.showLoadingBar(); this.mPanel = this.mTrayMgr.createParamsPanel(TrayLocation.TL_NONE, "DetailsPanel", 200, new string[] { "cam.pX", "cam.pY", "cam.pZ", "cam.oW", "cam.oX", "cam.oY", "cam.oZ", "Filtering", "Poly Mode" }); this.mPanel.setParamValue(7, "Bilinear"); this.mPanel.setParamValue(8, "Solid"); this.mPanel.hide(); MaterialManager.Singleton.SetDefaultTextureFiltering(TextureFilterOptions.TFO_NONE); // this.CreateScene(); // this.mTrayMgr._HookMouseEvent(); // this.AddFrameLstn(new RootLstn(RootLstn.TypeLstn.FrameRendering, this.OnFrameRendering)); return(true); }
/// <summary> /// Extendeded to setup a default tray interface and camera controller. /// </summary> /// <param name="window"></param> /// <param name="keyboard"></param> /// <param name="mouse"></param> protected internal override void Setup(RenderWindow window, SIS.Keyboard keyboard, SIS.Mouse mouse) { Window = window; Keyboard = keyboard; Mouse = mouse; LocateResources(); CreateSceneManager(); SetupView(); this.TrayManager = new SdkTrayManager("SampleControls", window, mouse, this as ISdkTrayListener); // create a tray interface LoadResources(); ResourcesLoaded = true; // Show stats and logo and Hide the cursor this.TrayManager.ShowFrameStats(TrayLocation.BottomLeft); this.TrayManager.ShowLogo(TrayLocation.BottomRight); this.TrayManager.HideCursor(); // create a params panel for displaying sample details var items = new List <string> { "cam.pX", "cam.pY", "cam.pZ", String.Empty, "cam.oW", "cam.oX", "cam.oY", "cam.oZ", String.Empty, "Filtering", "Poly Mode" }; this.DetailsPanel = this.TrayManager.CreateParamsPanel(TrayLocation.None, "DetailsPanel", 180, items); this.DetailsPanel.SetParamValue(9, "Bilinear"); this.DetailsPanel.SetParamValue(10, "Solid"); this.DetailsPanel.Hide(); SetupContent(); ContentSetup = true; IsDone = false; }
protected virtual void Shutdown() { if (mInput != null) { mInput.Shutdown(); mInput = null; } if (this.mTrayMgr != null) { this.mTrayMgr.destroyAllWidgets(); //this.mTrayMgr.clearAllTrays(); this.mTrayMgr = null; } if (mRoot != null) { mRoot.Shutdown(); } mRoot = null; }
public PhysxBasicCubeState() { rnd = new Random(); physx = Physics.Create(); SceneDesc desc = new SceneDesc(); scene = physx.CreateScene(desc); scene.Gravity = new Mogre.Vector3(0, -9.81f, 0); var defm = scene.Materials[0]; defm.Restitution = 0.5f; defm.DynamicFriction = defm.StaticFriction = 0.6f; trayMgr = AdvancedMogreFramework.instance.m_pTrayMgr; cubes = new List <Entity>(); cubeActors = new List <Actor>(); }
public GameManager() { root = null; renderWindow = null; viewport = null; log = null; timer = null; inputMgr = null; keyboard = null; mouse = null; trayMgr = null; appStateMgr = null; soundMgr = null; videoMode = new NameValuePairList(); isEditMode = false; isCheatMode = false; loadingData = new LoadingData(LoadingType.NONE, null, null, null); GlobalValueTable = new Dictionary <string, object>(); }
/// <summary> /// /// </summary> protected override void Setup() { CreateWindow(); SetupInput(); LocateResources(); ResourceGroupManager.Instance.InitializeResourceGroup("Essential"); this.TrayManager = new SdkTrayManager("BrowserControls", RenderWindow, Mouse, this); this.TrayManager.ShowBackdrop("SdkTrays/Bands"); this.TrayManager.TrayContainer[(int)TrayLocation.None].Hide(); CreateDummyScene(); LoadResources(); Sample startupSample = LoadSamples(); TextureManager.Instance.DefaultMipmapCount = 5; // adds context as listener to process context-level (above the sample level) events Root.FrameStarted += FrameStarted; Root.FrameEnded += FrameEnded; Root.FrameRenderingQueued += FrameRenderingQueued; WindowEventMonitor.Instance.RegisterListener(RenderWindow, this); // create template material for sample thumbnails var thumbMat = (Material)MaterialManager.Instance.Create("SampleThumbnail", "Essential"); thumbMat.GetTechnique(0).GetPass(0).CreateTextureUnitState(); SetupWidgets(); WindowResized(RenderWindow); // adjust menus for resolution if (startupSample != null) { RunSample(startupSample); } }
private bool InitRender(string wndTitle, ref Dictionary <string, string> gameOptions) { root = Root.Singleton == null ? new Root() : Root.Singleton; root.FrameStarted += new FrameListener.FrameStartedHandler(frameStarted); log = EngineLogManager.Instance.CreateLog("./Log/Engine.log"); rendererLog = LogManager.Singleton.CreateLog("./Log/Mogre.log", true, true, false); rendererLog.SetDebugOutputEnabled(true); RenderSystem rs = null; IniConfigFileParser parser = new IniConfigFileParser(); if (gameOptions == null) { gameOptions = new Dictionary <string, string>(); IniConfigFile cf = (IniConfigFile)parser.Load("Game.cfg"); var sections = cf.Sections; foreach (var section in sections) { foreach (var kpl in section.KeyValuePairs) { gameOptions.Add(kpl.Key, kpl.Value); } } cf = (IniConfigFile)parser.Load("ogre.cfg"); sections = cf.Sections; string renderSystem = null; foreach (var section in sections) { if (section.Name == "") { foreach (var kpl in section.KeyValuePairs) { renderSystem = kpl.Value; gameOptions.Add(kpl.Key, kpl.Value); } } else if (section.Name == renderSystem) { foreach (var kpl in section.KeyValuePairs) { gameOptions.Add("Render Params_" + kpl.Key, kpl.Value); } } } } defaultRenderSystemName = gameOptions.Where(o => o.Key == "Render System").First().Value; var renderParams = gameOptions.Where(o => o.Key.StartsWith("Render Params")); if (!string.IsNullOrEmpty(defaultRenderSystemName)) { var videModeRenderParam = renderParams.Where(o => o.Key == "Render Params_Video Mode").First(); rs = root.GetRenderSystemByName(defaultRenderSystemName); string strVideoMode = Regex.Match( videModeRenderParam.Value, "[0-9]{3,4} x [0-9]{3,4}").Value; videoMode["Width"] = strVideoMode.Split('x')[0].Trim(); videoMode["Height"] = strVideoMode.Split('x')[1].Trim(); } var ogreConfigMap = rs.GetConfigOptions(); if (rs != null && renderParams != null) { foreach (var kpl in renderParams) { string renderParamKey = kpl.Key.Split('_')[1]; string renderParamValue = kpl.Value; //Validate the render parameter if (!ogreConfigMap[renderParamKey].possibleValues.Contains(renderParamValue)) { renderParamValue = ogreConfigMap[renderParamKey].possibleValues[0]; } rs.SetConfigOption(renderParamKey, renderParamValue); } root.RenderSystem = rs; } renderWindow = root.Initialise(true, wndTitle); viewport = renderWindow.AddViewport(null); ColourValue cv = new ColourValue(0.5f, 0.5f, 0.5f); viewport.BackgroundColour = cv; viewport.Camera = null; int hWnd = 0; renderWindow.GetCustomAttribute("WINDOW", out hWnd); inputMgr = InputManager.CreateInputSystem((uint)hWnd); keyboard = (Keyboard)inputMgr.CreateInputObject(MOIS.Type.OISKeyboard, true); mouse = (Mouse)inputMgr.CreateInputObject(MOIS.Type.OISMouse, true); mouse.MouseMoved += new MouseListener.MouseMovedHandler(mouseMoved); mouse.MousePressed += new MouseListener.MousePressedHandler(mousePressed); mouse.MouseReleased += new MouseListener.MouseReleasedHandler(mouseReleased); keyboard.KeyPressed += new KeyListener.KeyPressedHandler(keyPressed); keyboard.KeyReleased += new KeyListener.KeyReleasedHandler(keyReleased); MouseState_NativePtr mouseState = mouse.MouseState; mouseState.width = viewport.ActualWidth; mouseState.height = viewport.ActualHeight; string secName, typeName, archName; IniConfigFile conf = new IniConfigFile(); conf = (IniConfigFile)parser.Load("resources.cfg"); for (int i = 0; i < conf.Sections.Count; i++) { secName = conf.Sections[i].Name; for (int j = 0; j < conf.Sections[i].KeyValuePairs.Count; j++) { typeName = conf.Sections[i].KeyValuePairs[j].Key; archName = conf.Sections[i].KeyValuePairs[j].Value; ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName); } } if (!LocateSystem.Singleton.IsInit) { LocateSystem.Singleton.InitLocateSystem(LocateSystem.Singleton.ConvertLocateShortStringToLocateInfo(gameOptions.Where(o => o.Key == "CurrentLocate").First().Value)); } ResourceGroupManager.Singleton.AddResourceLocation( string.Format("./Media/Engine/Fonts/{0}/", LocateSystem.Singleton.Locate.ToString()), "FileSystem", "General"); TextureManager.Singleton.DefaultNumMipmaps = 5; ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); trayMgr = new SdkTrayManager("AMOFTrayMgr", renderWindow, mouse, new SdkTrayListener()); timer = new Timer(); timer.Reset(); renderWindow.IsActive = true; this.gameOptions = gameOptions; log.LogMessage("Game Started!"); return(true); }
private bool InitRender(string wndTitle, ref GameConfigXml gameOptions) { root = Root.Singleton == null ? new Root() : Root.Singleton; root.FrameStarted += new FrameListener.FrameStartedHandler(frameStarted); log = EngineLogManager.Instance.CreateLog("./Log/Engine.log"); rendererLog = LogManager.Singleton.CreateLog("./Log/Mogre.log", true, true, false); rendererLog.SetDebugOutputEnabled(true); RenderSystem rs = null; IniConfigFileParser parser = new IniConfigFileParser(); if (gameOptions == null) { gameOptions = GameConfigXml.Load("game.xml"); } defaultRenderSystemName = gameOptions.GraphicConfig.CurrentRenderSystem; var renderParams = gameOptions.GraphicConfig[gameOptions.GraphicConfig.CurrentRenderSystem]; if (!string.IsNullOrEmpty(defaultRenderSystemName)) { var videModeRenderParam = renderParams.Where(o => o.Name == "Video Mode").First(); rs = root.GetRenderSystemByName(defaultRenderSystemName); string strVideoMode = Regex.Match( videModeRenderParam.Value, "[0-9]{3,4} x [0-9]{3,4}").Value; videoMode["Width"] = strVideoMode.Split('x')[0].Trim(); videoMode["Height"] = strVideoMode.Split('x')[1].Trim(); } var ogreConfigMap = rs.GetConfigOptions(); if (rs != null && renderParams != null) { foreach (var kpl in renderParams) { string renderParamKey = kpl.Name; string renderParamValue = kpl.Value; //Validate the render parameter if (!ogreConfigMap[renderParamKey].possibleValues.Contains(renderParamValue)) { renderParamValue = ogreConfigMap[renderParamKey].possibleValues[0]; } rs.SetConfigOption(renderParamKey, renderParamValue); } root.RenderSystem = rs; } renderWindow = root.Initialise(true, wndTitle); viewport = renderWindow.AddViewport(null); ColourValue cv = new ColourValue(0.5f, 0.5f, 0.5f); viewport.BackgroundColour = cv; viewport.Camera = null; int hWnd = 0; renderWindow.GetCustomAttribute("WINDOW", out hWnd); inputMgr = MOIS.InputManager.CreateInputSystem((uint)hWnd); keyboard = (Keyboard)inputMgr.CreateInputObject(MOIS.Type.OISKeyboard, true); mouse = (Mouse)inputMgr.CreateInputObject(MOIS.Type.OISMouse, true); keyMouseManager = new InputKeyMouseManager(); keyMouseManager.SomeKeyPressd += KeyMouseManager_SomeKeyPressd; MouseState_NativePtr mouseState = mouse.MouseState; mouseState.width = viewport.ActualWidth; mouseState.height = viewport.ActualHeight; foreach (var resource in gameOptions.ResourcesConfig.Resources) { foreach (var resLoc in resource.ResourceLocs) { ResourceGroupManager.Singleton.AddResourceLocation(resLoc, resource.Type, ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); } } foreach (var keyMapper in gameOptions.InputConfig.Mappers) { KeyMapperManager.Instance.AddKeyMapper(keyMapper.GameKeyCode, keyMapper.GetKeyCollections()); } if (!LocateSystem.Instance.IsInit) { LocateSystem.Instance.InitLocateSystem(LocateSystem.Instance.ConvertReadableStringToLocate(gameOptions.LocateConfig.CurrentLocate)); } ResourceGroupManager.Singleton.AddResourceLocation( string.Format("./Media/Engine/Fonts/{0}/", LocateSystem.Instance.Locate.ToString()), "FileSystem", "General"); TextureManager.Singleton.DefaultNumMipmaps = 5; ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); trayMgr = new SdkTrayManager("AMOFTrayMgr", renderWindow, mouse, new SdkTrayListener()); timer = new Timer(); timer.Reset(); renderWindow.IsActive = true; this.gameOptions = gameOptions; log.LogMessage("Game Started!"); return(true); }
private bool Setup() { createLogManager(); this.mRoot = new Root(PLUGINS_CFG); //mOverlaySystem = new Mogre.OverlaySystem(); setupResources(); if (!this.Configure()) return false; this.ChooseSceneManager(); this.CreateCamera(); this.CreateViewports(); createCompositor(); TextureManager.Singleton.DefaultNumMipmaps = 5; this.LoadResources(); this.mInput = new MoisManager(); int windowHnd; this.mWindow.GetCustomAttribute("WINDOW", out windowHnd); this.mInput.Startup(windowHnd, this.mWindow.Width, this.mWindow.Height); //System.Windows.Forms.Control form = System.Windows.Forms.Form.FromHandle(new IntPtr(windowHnd)); //form.MinimumSize = new System.Drawing.Size(800, 600); this.mTrayMgr = new SdkTrayManager("trayMgr", this.mWindow, this.mInput.Mouse, this); this.mTrayMgr.showFrameStats(TrayLocation.TL_BOTTOMLEFT); this.mTrayMgr.hideCursor(); //this.mTrayMgr.hideFrameStats(); //this.mTrayMgr.showFrameStats(TrayLocation.TL_BOTTOMLEFT); //this.mTrayMgr.showLogo(TrayLocation.TL_BOTTOMLEFT); //this.mTrayMgr.showOkDialog("context...", "this is a test"); //this.mTrayMgr.showLoadingBar(); this.mPanel = this.mTrayMgr.createParamsPanel(TrayLocation.TL_NONE, "DetailsPanel", 200, new string[] { "cam.pX", "cam.pY", "cam.pZ", "cam.oW", "cam.oX", "cam.oY", "cam.oZ", "Filtering", "Poly Mode" }); this.mPanel.setParamValue(7, "Bilinear"); this.mPanel.setParamValue(8, "Solid"); this.mPanel.hide(); MaterialManager.Singleton.SetDefaultTextureFiltering(TextureFilterOptions.TFO_NONE); // this.CreateScene(); // this.mTrayMgr._HookMouseEvent(); this.AddFrameLstn(new RootLstn(RootLstn.TypeLstn.FrameRendering, this.OnFrameRendering)); return true; }
protected virtual void Shutdown() { if (mInput != null) { mInput.Shutdown(); mInput = null; } if (this.mTrayMgr != null) { this.mTrayMgr.destroyAllWidgets(); //this.mTrayMgr.clearAllTrays(); this.mTrayMgr = null; } if (mRoot != null) { mRoot.Shutdown(); } mRoot = null; }
public bool initOgre(String wndTitle) { LogManager logMgr = new LogManager(); m_pLog = LogManager.Singleton.CreateLog("OgreLogfile.log", true, true, false); m_pLog.SetDebugOutputEnabled(true); m_pRoot = new Root(); if (!m_pRoot.ShowConfigDialog()) { return(false); } m_pRenderWnd = m_pRoot.Initialise(true, wndTitle); m_pViewport = m_pRenderWnd.AddViewport(null); ColourValue cv = new ColourValue(0.5f, 0.5f, 0.5f); m_pViewport.BackgroundColour = cv; m_pViewport.Camera = null; int hWnd = 0; //ParamList paramList; m_pRenderWnd.GetCustomAttribute("WINDOW", out hWnd); m_pInputMgr = InputManager.CreateInputSystem((uint)hWnd); m_pKeyboard = (MOIS.Keyboard)m_pInputMgr.CreateInputObject(MOIS.Type.OISKeyboard, true); m_pMouse = (MOIS.Mouse)m_pInputMgr.CreateInputObject(MOIS.Type.OISMouse, true); m_pMouse.MouseMoved += new MouseListener.MouseMovedHandler(mouseMoved); m_pMouse.MousePressed += new MouseListener.MousePressedHandler(mousePressed); m_pMouse.MouseReleased += new MouseListener.MouseReleasedHandler(mouseReleased); m_pKeyboard.KeyPressed += new KeyListener.KeyPressedHandler(keyPressed); m_pKeyboard.KeyReleased += new KeyListener.KeyReleasedHandler(keyReleased); MOIS.MouseState_NativePtr mouseState = m_pMouse.MouseState; mouseState.width = m_pViewport.ActualWidth; mouseState.height = m_pViewport.ActualHeight; //m_pMouse.MouseState = tempMouseState; String secName, typeName, archName; ConfigFile cf = new ConfigFile(); cf.Load("resources.cfg", "\t:=", true); ConfigFile.SectionIterator seci = cf.GetSectionIterator(); while (seci.MoveNext()) { secName = seci.CurrentKey; ConfigFile.SettingsMultiMap settings = seci.Current; foreach (KeyValuePair <string, string> pair in settings) { typeName = pair.Key; archName = pair.Value; ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName); } } TextureManager.Singleton.DefaultNumMipmaps = 5; ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); m_pTrayMgr = new SdkTrayManager("AOFTrayMgr", m_pRenderWnd, m_pMouse, null); m_pTimer = new Timer(); m_pTimer.Reset(); m_pRenderWnd.IsActive = true; return(true); }