public virtual void CreateInput() { LogManager.Singleton.LogMessage("*** Initializing OIS ***"); MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; window.GetCustomAttribute("WINDOW", out windowHnd); pl.Insert("WINDOW", windowHnd.ToString()); if (this.IsMouseNonExclusive) { pl.Insert("w32_mouse", "DISCL_FOREGROUND"); pl.Insert("w32_mouse", "DISCL_NONEXCLUSIVE"); } inputManager = MOIS.InputManager.CreateInputSystem(pl); //Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse) inputKeyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard, UseBufferedInput); inputMouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, UseBufferedInput); uint width; uint height; uint depth; int left; int top; window.GetMetrics(out width, out height, out depth, out left, out top); MOIS.MouseState_NativePtr cState = inputMouse.MouseState; cState.width = (int)width; cState.height = (int)height; }
private void CreateInput() { LogManager.Singleton.LogMessage("*** Initializing OIS ***"); MOIS.ParamList pl = new MOIS.ParamList(); if (AutoLockMouse == false) { pl.Insert("w32_mouse", "DISCL_FOREGROUND"); pl.Insert("w32_mouse", "DISCL_NONEXCLUSIVE"); } window.GetCustomAttribute("WINDOW", out WindowHandle); pl.Insert("WINDOW", WindowHandle.ToString()); inputManager = MOIS.InputManager.CreateInputSystem(pl); //Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse) inputKeyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard, UseBufferedInput); inputMouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, UseBufferedInput); if (inputKeyboard != null) { LogManager.Singleton.LogMessage("Setting up keyboard listeners"); inputKeyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(KeyPressed); inputKeyboard.KeyReleased += new MOIS.KeyListener.KeyReleasedHandler(KeyReleased); } if (inputMouse != null) { LogManager.Singleton.LogMessage("Setting up mouse listeners"); inputMouse.MousePressed += new MOIS.MouseListener.MousePressedHandler(MousePressed); inputMouse.MouseReleased += new MOIS.MouseListener.MouseReleasedHandler(MouseReleased); inputMouse.MouseMoved += new MOIS.MouseListener.MouseMovedHandler(MouseMoved); } }
public virtual void CreateInput() { LogManager.Singleton.LogMessage("*** Initializing OIS ***"); MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; window.GetCustomAttribute("WINDOW", out windowHnd); pl.Insert("WINDOW", windowHnd.ToString()); pl.Insert("w32_mouse", "DISCL_FOREGROUND"); pl.Insert("w32_mouse", "DISCL_NONEXCLUSIVE"); inputManager = MOIS.InputManager.CreateInputSystem(pl); //Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse) inputKeyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard, true); inputMouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, true); }
public virtual void CreateInput() { IntPtr handle; window.GetCustomAttribute("HWND", out handle); MOIS.ParamList pl = new MOIS.ParamList(); pl.Insert("WINDOW", handle.ToString()); //Default mode is foreground exclusive..but, we want to show mouse - so nonexclusive pl.Insert("w32_mouse", "DISCL_FOREGROUND"); pl.Insert("w32_mouse", "DISCL_NONEXCLUSIVE"); //This never returns null.. it will raise an exception on errors MOIS.InputManager g_InputManager = MOIS.InputManager.CreateInputSystem(pl); input = (MOIS.Keyboard)g_InputManager.CreateInputObject(MOIS.Type.OISKeyboard, false); }
/// <summary> /// Sets up the keyboard/mouse for input. /// </summary> void SetUpInput() { MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; window.GetCustomAttribute("WINDOW", out windowHnd); // window is your RenderWindow! pl.Insert("WINDOW", windowHnd.ToString()); inputManager = MOIS.InputManager.CreateInputSystem(pl); // Create all devices (except joystick, as most people have Keyboard/Mouse) using unbuffered input inputKeyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard, true); inputMouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, true); }
public Control(RenderWindow window) { // Create input manager MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; window.GetCustomAttribute("WINDOW", out windowHnd); pl.Insert("WINDOW", windowHnd.ToString()); mInputManager = MOIS.InputManager.CreateInputSystem(pl); mKeyBoard = (MOIS.Keyboard)mInputManager.CreateInputObject(MOIS.Type.OISKeyboard, true); mMouse = (MOIS.Mouse)mInputManager.CreateInputObject(MOIS.Type.OISMouse, true); try { mJoystick = (MOIS.JoyStick)mInputManager.CreateInputObject(MOIS.Type.OISJoyStick, true); Program.Instance.gameManager.hasJoy = true; try { mFF = (MOIS.ForceFeedback)mJoystick.QueryInterface(MOIS.Interface.IType.ForceFeedback); mSupportedEffectList = mFF.GetSupportedEffects(); } catch { //Console.WriteLine("No ForceFeedback"); } } catch { //Console.WriteLine("No Joystick"); } //Callbacks for Inputs mKeyBoard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(mKeyBoard_KeyPressed); mKeyBoard.KeyReleased += new MOIS.KeyListener.KeyReleasedHandler(mKeyBoard_KeyReleased); mMouse.MouseMoved += new MOIS.MouseListener.MouseMovedHandler(mMouse_MouseMoved); mMouse.MousePressed += new MOIS.MouseListener.MousePressedHandler(mMouse_MousePressed); mMouse.MouseReleased += new MOIS.MouseListener.MouseReleasedHandler(mMouse_MouseReleased); if (mInputManager.GetNumberOfDevices(MOIS.Type.OISJoyStick) > 0) { mJoystick.ButtonPressed += new MOIS.JoyStickListener.ButtonPressedHandler(mJoystick_ButtonPressed); mJoystick.ButtonReleased += new MOIS.JoyStickListener.ButtonReleasedHandler(mJoystick_ButtonReleased); mJoystick.AxisMoved += new MOIS.JoyStickListener.AxisMovedHandler(mJoystick_AxisMoved); } }
public void CreateInput() { LogManager.Singleton.LogMessage("*** Initializing OIS ***"); MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; OgreEngine.mWin.GetCustomAttribute("WINDOW", out windowHnd); pl.Insert("WINDOW", windowHnd.ToString()); mIMgr = MOIS.InputManager.CreateInputSystem(pl); mKeyb = (MOIS.Keyboard)mIMgr.CreateInputObject(MOIS.Type.OISKeyboard, true); mKeyb.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(Keyboard_KeyPressed); mKeyb.KeyReleased += new MOIS.KeyListener.KeyReleasedHandler(Keyboard_KeyReleased); mMouse = (MOIS.Mouse)mIMgr.CreateInputObject(MOIS.Type.OISMouse, true); mMouse.MouseReleased += new MOIS.MouseListener.MouseReleasedHandler(Mouse_MouseReleased); mMouse.MouseMoved += new MOIS.MouseListener.MouseMovedHandler(Mouse_MouseMoved); mMouse.MousePressed += new MOIS.MouseListener.MousePressedHandler(Mouse_MousePressed); MOIS.MouseState_NativePtr state = mMouse.MouseState; state.width = (int)OgreEngine.mWin.Width; state.height = (int)OgreEngine.mWin.Height; }
private void CreateInput() { LogManager.Singleton.LogMessage("*** Initializing OIS ***"); MOIS.ParamList pl = new MOIS.ParamList(); if (AutoLockMouse == false) { pl.Insert("w32_mouse", "DISCL_FOREGROUND"); pl.Insert("w32_mouse", "DISCL_NONEXCLUSIVE"); } window.GetCustomAttribute("WINDOW", out WindowHandle); pl.Insert("WINDOW", WindowHandle.ToString()); inputManager = MOIS.InputManager.CreateInputSystem(pl); //Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse) inputKeyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard, UseBufferedInput); inputMouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, UseBufferedInput); if (inputKeyboard != null) { LogManager.Singleton.LogMessage("Setting up keyboard listeners"); inputKeyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(KeyPressed); inputKeyboard.KeyReleased += new MOIS.KeyListener.KeyReleasedHandler(KeyReleased); } if (inputMouse != null) { LogManager.Singleton.LogMessage("Setting up mouse listeners"); inputMouse.MousePressed += new MOIS.MouseListener.MousePressedHandler(MousePressed); inputMouse.MouseReleased += new MOIS.MouseListener.MouseReleasedHandler(MouseReleased); inputMouse.MouseMoved += new MOIS.MouseListener.MouseMovedHandler(MouseMoved); } }
public void Initialise() { Root = new Root(); ConfigFile cf = new ConfigFile(); cf.Load("Resources.cfg", "\t:=", true); ConfigFile.SectionIterator seci = cf.GetSectionIterator(); while (seci.MoveNext()) { ConfigFile.SettingsMultiMap settings = seci.Current; foreach (KeyValuePair<string, string> pair in settings) ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey); } if (!Root.RestoreConfig()) if (!Root.ShowConfigDialog()) return; Root.RenderSystem.SetConfigOption("VSync", "Yes"); RenderWindow = Root.Initialise(true, "WorldCreator"); // @@@@@@@@@@@@@@@ Nazwa okna gry. ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); SceneManager = Root.CreateSceneManager(SceneType.ST_GENERIC); Camera = SceneManager.CreateCamera("MainCamera"); Viewport = RenderWindow.AddViewport(Camera); Camera.NearClipDistance = 0.1f; Camera.FarClipDistance = 1000.0f; Camera.AspectRatio = ((float)RenderWindow.Width / (float)RenderWindow.Height); MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; RenderWindow.GetCustomAttribute("WINDOW", out windowHnd); pl.Insert("WINDOW", windowHnd.ToString()); InputManager = MOIS.InputManager.CreateInputSystem(pl); Keyboard = (MOIS.Keyboard)InputManager.CreateInputObject(MOIS.Type.OISKeyboard, false); Mouse = (MOIS.Mouse)InputManager.CreateInputObject(MOIS.Type.OISMouse, false); NewtonWorld = new World(); NewtonDebugger = new Debugger(NewtonWorld); NewtonDebugger.Init(SceneManager); ObjectManager = new ObjectManager(); MaterialManager = new MaterialManager(); MaterialManager.Initialise(); //CharacterProfileManager = new CharacterProfileManager(); Items = new Items(); //PrizeManager = new PrizeManager(); //////////////////// @@ Brand nju staff. Nawet trochę działa :Δ //Quests = new Quests(); //NPCManager = new NPCManager(); Labeler = new TextLabeler(5); User = new Player(); CharacterProfileManager = new CharacterProfileManager(); NPCManager = new NPCManager(); HumanController = new HumanController(); TypedInput = new TypedInput(); //SoundManager = new SoundManager(); }
public void Initialise() { m_Root = new Root(); ConfigFile cf = new ConfigFile(); cf.Load("Resources.cfg", "\t:=", true); ConfigFile.SectionIterator seci = cf.GetSectionIterator(); while (seci.MoveNext()) { ConfigFile.SettingsMultiMap settings = seci.Current; foreach (KeyValuePair<string, string> pair in settings) ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey); } if (!m_Root.RestoreConfig()) if (!m_Root.ShowConfigDialog()) return; m_RenderWindow = m_Root.Initialise(true); ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); m_SceneManager = m_Root.CreateSceneManager(SceneType.ST_GENERIC); m_Camera = m_SceneManager.CreateCamera("MainCamera"); m_Viewport = m_RenderWindow.AddViewport(m_Camera); m_Camera.NearClipDistance = 0.1f; m_Camera.FarClipDistance = 1000.0f; MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; m_RenderWindow.GetCustomAttribute("WINDOW", out windowHnd); pl.Insert("WINDOW", windowHnd.ToString()); m_InputManager = MOIS.InputManager.CreateInputSystem(pl); m_Keyboard = (MOIS.Keyboard)m_InputManager.CreateInputObject(MOIS.Type.OISKeyboard, false); m_Mouse = (MOIS.Mouse)m_InputManager.CreateInputObject(MOIS.Type.OISMouse, false); m_NewtonWorld = new World(); m_NewtonDebugger = new Debugger(m_NewtonWorld); m_NewtonDebugger.Init(m_SceneManager); m_GameCamera = new GameCamera(); m_ObjectManager = new ObjectManager(); }
public void Initialise() { Root = new Root(); ConfigFile cf = new ConfigFile(); cf.Load("Resources.cfg", "\t:=", true); ConfigFile.SectionIterator seci = cf.GetSectionIterator(); while (seci.MoveNext()) { ConfigFile.SettingsMultiMap settings = seci.Current; foreach (KeyValuePair<string, string> pair in settings) ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey); } if (!Root.RestoreConfig()) if (!Root.ShowConfigDialog()) return; Root.RenderSystem.SetConfigOption("VSync", "Yes"); RenderWindow = Root.Initialise(true, "Kolejny epicki erpeg"); // @@@@@@@@@@@@@@@ Nazwa okna gry. ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); SceneManager = Root.CreateSceneManager(SceneType.ST_GENERIC); Camera = SceneManager.CreateCamera("MainCamera"); Viewport = RenderWindow.AddViewport(Camera); Camera.NearClipDistance = 0.1f; Camera.FarClipDistance = 1000.0f; Camera.AspectRatio = ((float)RenderWindow.Width / (float)RenderWindow.Height); MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; RenderWindow.GetCustomAttribute("WINDOW", out windowHnd); pl.Insert("WINDOW", windowHnd.ToString()); InputManager = MOIS.InputManager.CreateInputSystem(pl); Keyboard = (MOIS.Keyboard)InputManager.CreateInputObject(MOIS.Type.OISKeyboard, true); Mouse = (MOIS.Mouse)InputManager.CreateInputObject(MOIS.Type.OISMouse, true); NewtonWorld = new World(); NewtonDebugger = new Debugger(NewtonWorld); NewtonDebugger.Init(SceneManager); GameCamera = new GameCamera(); ObjectManager = new ObjectManager(); MaterialManager = new MaterialManager(); MaterialManager.Initialise(); Items = new Items(); PrizeManager = new PrizeManager(); //////////////////// @@ Brand nju staff. Nawet trochę działa :Δ CharacterProfileManager = new CharacterProfileManager(); Quests = new Quests(); NPCManager = new NPCManager(); Labeler = new TextLabeler(5); Random = new Random(); HumanController = new HumanController(); TypedInput = new TypedInput(); SoundManager = new SoundManager(); Dialog = new Dialog(); Mysz = new MOIS.MouseState_NativePtr(); Conversations = new Conversations(); TriggerManager = new TriggerManager(); Engine.Singleton.Keyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(TypedInput.onKeyPressed); Mouse.MouseReleased += new MOIS.MouseListener.MouseReleasedHandler(MouseReleased); IngameConsole = new IngameConsole(); IngameConsole.Init(); IngameConsole.AddCommand("dupa", "soundOddawajPiec"); IngameConsole.AddCommand("tp", "ZejscieDoPiwnicy"); IngameConsole.AddCommand("exit", "Exit", "Wychodzi z gry. Ale odkrywcze. Super. Musze sprawdzic jak sie zachowa konsola przy duzej dlugosci linii xD llllllllllllllllllllllllllllllllllllllllllllmmmmmmmmmmmmmmmmmmmmmiiiiiiiiiiiiiiii"); IngameConsole.AddCommand("play", "playSound", "Odtwarza dzwiek. Skladnia: play <sciezka do pliku>. Np. play other/haa.mp3"); IngameConsole.AddCommand("map", "ChangeMap"); IngameConsole.AddCommand("save", "SaveGame"); IngameConsole.AddCommand("load", "LoadGame"); IngameConsole.AddCommand("help", "ConsoleHelp"); IngameConsole.AddCommand("h", "CommandHelp"); }
public void Initialise() { Root = new Root(); ConfigFile cf = new ConfigFile(); cf.Load("Resources.cfg", "\t:=", true); ConfigFile.SectionIterator seci = cf.GetSectionIterator(); while (seci.MoveNext()) { ConfigFile.SettingsMultiMap settings = seci.Current; foreach (KeyValuePair <string, string> pair in settings) { ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey); } } if (!Root.RestoreConfig()) { if (!Root.ShowConfigDialog()) { return; } } Root.RenderSystem.SetConfigOption("VSync", "Yes"); RenderWindow = Root.Initialise(true, "WorldCreator"); // @@@@@@@@@@@@@@@ Nazwa okna gry. ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); SceneManager = Root.CreateSceneManager(SceneType.ST_GENERIC); Camera = SceneManager.CreateCamera("MainCamera"); Viewport = RenderWindow.AddViewport(Camera); Camera.NearClipDistance = 0.1f; Camera.FarClipDistance = 1000.0f; Camera.AspectRatio = ((float)RenderWindow.Width / (float)RenderWindow.Height); MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; RenderWindow.GetCustomAttribute("WINDOW", out windowHnd); pl.Insert("WINDOW", windowHnd.ToString()); InputManager = MOIS.InputManager.CreateInputSystem(pl); Keyboard = (MOIS.Keyboard)InputManager.CreateInputObject(MOIS.Type.OISKeyboard, false); Mouse = (MOIS.Mouse)InputManager.CreateInputObject(MOIS.Type.OISMouse, false); NewtonWorld = new World(); NewtonDebugger = new Debugger(NewtonWorld); NewtonDebugger.Init(SceneManager); ObjectManager = new ObjectManager(); MaterialManager = new MaterialManager(); MaterialManager.Initialise(); //CharacterProfileManager = new CharacterProfileManager(); Items = new Items(); //PrizeManager = new PrizeManager(); //////////////////// @@ Brand nju staff. Nawet trochę działa :Δ //Quests = new Quests(); //NPCManager = new NPCManager(); Labeler = new TextLabeler(5); User = new Player(); CharacterProfileManager = new CharacterProfileManager(); NPCManager = new NPCManager(); HumanController = new HumanController(); TypedInput = new TypedInput(); //SoundManager = new SoundManager(); }
protected static void InitialiseInput() { // var q = sceneMgr.CreateManualObject(); int windowHandle; _window.GetCustomAttribute("WINDOW", out windowHandle); viewport.BackgroundColour = ColourValue.Blue; SetForegroundWindow(windowHandle); MOIS.ParamList pl = new MOIS.ParamList(); pl.Insert("w32_mouse", "DISCL_FOREGROUND"); pl.Insert("w32_mouse", "DISCL_NONEXCLUSIVE"); pl.Insert("WINDOW", windowHandle.ToString()); input = MOIS.InputManager.CreateInputSystem(pl); kbd = (MOIS.Keyboard)input.CreateInputObject(MOIS.Type.OISKeyboard, false); mouse = (MOIS.Mouse)input.CreateInputObject(MOIS.Type.OISMouse, true); MOIS.MouseState_NativePtr state = mouse.MouseState; state.width = (int)_window.Width; state.height = (int)_window.Height; mouse.MousePressed += new MOIS.MouseListener.MousePressedHandler(mouse_MousePressed); mouse.MouseReleased += new MOIS.MouseListener.MouseReleasedHandler(mouse_MouseReleased); mouse.MouseMoved += new MOIS.MouseListener.MouseMovedHandler(mouse_MouseMoved); }
public void Initialise() { Root = new Root(); ConfigFile cf = new ConfigFile(); cf.Load("Resources.cfg", "\t:=", true); ConfigFile.SectionIterator seci = cf.GetSectionIterator(); while (seci.MoveNext()) { ConfigFile.SettingsMultiMap settings = seci.Current; foreach (KeyValuePair <string, string> pair in settings) { ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey); } } if (!Root.RestoreConfig()) { if (!Root.ShowConfigDialog()) { return; } } Root.RenderSystem.SetConfigOption("VSync", "Yes"); RenderWindow = Root.Initialise(true, "Kolejny epicki erpeg"); // @@@@@@@@@@@@@@@ Nazwa okna gry. ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); SceneManager = Root.CreateSceneManager(SceneType.ST_GENERIC); Camera = SceneManager.CreateCamera("MainCamera"); Viewport = RenderWindow.AddViewport(Camera); Camera.NearClipDistance = 0.1f; Camera.FarClipDistance = 1000.0f; Camera.AspectRatio = ((float)RenderWindow.Width / (float)RenderWindow.Height); MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; RenderWindow.GetCustomAttribute("WINDOW", out windowHnd); pl.Insert("WINDOW", windowHnd.ToString()); InputManager = MOIS.InputManager.CreateInputSystem(pl); Keyboard = (MOIS.Keyboard)InputManager.CreateInputObject(MOIS.Type.OISKeyboard, true); Mouse = (MOIS.Mouse)InputManager.CreateInputObject(MOIS.Type.OISMouse, true); NewtonWorld = new World(); NewtonDebugger = new Debugger(NewtonWorld); NewtonDebugger.Init(SceneManager); GameCamera = new GameCamera(); ObjectManager = new ObjectManager(); MaterialManager = new MaterialManager(); MaterialManager.Initialise(); Items = new Items(); PrizeManager = new PrizeManager(); //////////////////// @@ Brand nju staff. Nawet trochę działa :Δ CharacterProfileManager = new CharacterProfileManager(); Quests = new Quests(); NPCManager = new NPCManager(); Labeler = new TextLabeler(5); Random = new Random(); HumanController = new HumanController(); TypedInput = new TypedInput(); SoundManager = new SoundManager(); Dialog = new Dialog(); Mysz = new MOIS.MouseState_NativePtr(); Conversations = new Conversations(); TriggerManager = new TriggerManager(); Engine.Singleton.Keyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(TypedInput.onKeyPressed); Mouse.MouseReleased += new MOIS.MouseListener.MouseReleasedHandler(MouseReleased); IngameConsole = new IngameConsole(); IngameConsole.Init(); IngameConsole.AddCommand("dupa", "soundOddawajPiec"); IngameConsole.AddCommand("tp", "ZejscieDoPiwnicy"); IngameConsole.AddCommand("exit", "Exit", "Wychodzi z gry. Ale odkrywcze. Super. Musze sprawdzic jak sie zachowa konsola przy duzej dlugosci linii xD llllllllllllllllllllllllllllllllllllllllllllmmmmmmmmmmmmmmmmmmmmmiiiiiiiiiiiiiiii"); IngameConsole.AddCommand("play", "playSound", "Odtwarza dzwiek. Skladnia: play <sciezka do pliku>. Np. play other/haa.mp3"); IngameConsole.AddCommand("map", "ChangeMap"); IngameConsole.AddCommand("save", "SaveGame"); IngameConsole.AddCommand("load", "LoadGame"); IngameConsole.AddCommand("help", "ConsoleHelp"); IngameConsole.AddCommand("h", "CommandHelp"); }
public bool Initialise() { m_Shutdown = false; m_Rand = new Random(); new Mogre.LogManager(); m_Log = Mogre.LogManager.Singleton.CreateLog("OgreLogfile.log", true, true, false); m_Root = new Root(); ConfigFile cf = new ConfigFile(); cf.Load("Resources.cfg", "\t:=", true); ConfigFile.SectionIterator seci = cf.GetSectionIterator(); while (seci.MoveNext()) { ConfigFile.SettingsMultiMap settings = seci.Current; foreach (KeyValuePair<string, string> pair in settings) ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey); } if (!m_Root.RestoreConfig()) // comment this line to view configuration dialog box if (!m_Root.ShowConfigDialog()) return false; m_RenderWindow = m_Root.Initialise(true); ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); m_SceneManager = m_Root.CreateSceneManager(SceneType.ST_GENERIC); m_Camera = m_SceneManager.CreateCamera("MainCamera"); m_Viewport = m_RenderWindow.AddViewport(m_Camera); m_Camera.NearClipDistance = 0.1f; m_Camera.FarClipDistance = 1000.0f; MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; m_RenderWindow.GetCustomAttribute("WINDOW", out windowHnd); pl.Insert("WINDOW", windowHnd.ToString()); m_InputManager = MOIS.InputManager.CreateInputSystem(pl); m_Keyboard = (MOIS.Keyboard)m_InputManager.CreateInputObject(MOIS.Type.OISKeyboard, true); m_Mouse = (MOIS.Mouse)m_InputManager.CreateInputObject(MOIS.Type.OISMouse, true); m_NewtonWorld = new World(); m_NewtonWorld.SetWorldSize(new AxisAlignedBox(-500, -500, -500, 500, 500, 500)); m_NewtonDebugger = new Debugger(m_NewtonWorld); m_NewtonDebugger.Init(m_SceneManager); m_GameCamera = new GameCamera(); m_ObjectManager = new ObjectManager(); m_StateManager = new StateManager(); m_PhysicsManager = new PhysicsManager(); m_SoundDict = new SoundDict(); /* * To co tu mamy nalezy przeniesc jak najszybciej do ogitora * Materialy dla kazdej mapy moga byc inne inne parametry inne powiazania itp wiec tworzone * sa oddzielnie dla kazdej nowej mapy, a potem przy obiektach konkretny material jest przypsiywany * przy starcie ladowania physicsmanager powinien byc wyczyszczony */ //inicjalizacja konkretnych obiektow, w sumie tylko nadanie nazw w dictionary m_PhysicsManager.addMaterial("Metal"); //podstawowe m_PhysicsManager.addMaterial("Ground"); m_PhysicsManager.addMaterial("Trigger"); m_PhysicsManager.addMaterial("Player"); m_PhysicsManager.addMaterial("NPC"); //laczenie materialow w pary //dla kazdej mapy rozne powiazania (zapewne beda sie powtarzac ale im wieksza ilosc //materialow tym wieksze obciazenie dla silnika wiec nalezy to ograniczac //dla kazdej pary materialow mozna ustawic rozne parametry kolizji //jak tarcie, elastycznosc, miekkosc kolizji oraz callback ktory jest wywolywany przy kolizji m_PhysicsManager.addMaterialPair("Metal", "Metal"); m_PhysicsManager.getMaterialPair("MetalMetal").SetDefaultFriction(1.5f, 1.4f); m_PhysicsManager.setPairCallback("MetalMetal", "MetalCallback"); //obowiazkowe m_PhysicsManager.addMaterialPair("Trigger", "Player");//wyzwalacze pozycja obowiazkowa m_PhysicsManager.setPairCallback("TriggerPlayer", "TriggerCallback"); //obowiazkowe m_PhysicsManager.addMaterialPair("Ground", "Player");//ground material podstawowy m_PhysicsManager.getMaterialPair("GroundPlayer").SetDefaultElasticity(0); m_PhysicsManager.setPairCallback("GroundPlayer", "GroundPlayerCallback"); // NPC: //m_PhysicsManager.addMaterialPair("NPC", "NPC");//ground material podstawowy //m_PhysicsManager.getMaterialPair("NPCNPC").SetDefaultElasticity(0); //m_PhysicsManager.setPairCallback("NPCNPC", "NPCNPCCallback"); //m_PhysicsManager.addMaterialPair("Ground", "NPC");//ground material podstawowy //m_PhysicsManager.getMaterialPair("GroundNPC").SetDefaultElasticity(0); // m_PhysicsManager.setPairCallback("GroundNPC", "GroundPlayerCallback"); /* * Koniec inicjalizacji materialow ktora musi sie znalezc w opisie mapy, dla niekumatych w ogitorze. */ CreateOgitorScene(); //CreateScene(); /* * Rejestracja listenerów **/ m_Root.FrameRenderingQueued += new FrameListener.FrameRenderingQueuedHandler(Update); m_Keyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(KeyPressed); m_Keyboard.KeyReleased += new MOIS.KeyListener.KeyReleasedHandler(KeyReleased); m_Keyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(m_StateManager.KeyPressed); m_Keyboard.KeyReleased += new MOIS.KeyListener.KeyReleasedHandler(m_StateManager.KeyReleased); m_Mouse.MouseMoved += new MOIS.MouseListener.MouseMovedHandler(m_StateManager.MouseMoved); m_Mouse.MousePressed += new MOIS.MouseListener.MousePressedHandler(m_StateManager.MousePressed); m_Mouse.MouseReleased += new MOIS.MouseListener.MouseReleasedHandler(m_StateManager.MouseReleased); Tools.ConsoleParser.Init(); m_RenderWindow.SetDeactivateOnFocusChange(false); return true; }
public virtual void CreateInput() { LogManager.Singleton.LogMessage("*** Initializing OIS ***"); MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; window.GetCustomAttribute("WINDOW", out windowHnd); pl.Insert("WINDOW", windowHnd.ToString()); inputManager = MOIS.InputManager.CreateInputSystem(pl); //Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse) inputKeyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard, UseBufferedInput); inputMouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, UseBufferedInput); }
public virtual void CreateInput() { LogManager.Singleton.LogMessage("*** Initializing OIS ***"); MOIS.ParamList pl = new MOIS.ParamList(); IntPtr windowHnd; window.GetCustomAttribute("WINDOW", out windowHnd); pl.Insert("WINDOW", windowHnd.ToString()); if (this.IsMouseNonExclusive) { pl.Insert("w32_mouse", "DISCL_FOREGROUND"); pl.Insert("w32_mouse", "DISCL_NONEXCLUSIVE"); } inputManager = MOIS.InputManager.CreateInputSystem(pl); //Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse) inputKeyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard, UseBufferedInput); inputMouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, UseBufferedInput); uint width; uint height; uint depth; int left; int top; window.GetMetrics(out width, out height, out depth, out left, out top); MOIS.MouseState_NativePtr cState = inputMouse.MouseState; cState.width = (int)width; cState.height = (int)height; }