コード例 #1
0
ファイル: InputsManager.cs プロジェクト: MrAntonioG/ProgFor3D
 /// <summary>
 /// Initializes the keyboad, mouse and the input manager systems
 /// </summary>
 /// <param name="windowHandle">An handle to the game windonw</param>
 public void InitInput(ref int windowHandle)
 {
     mInputMgr             = MOIS.InputManager.CreateInputSystem((uint)windowHandle);
     mKeyboard             = (MOIS.Keyboard)mInputMgr.CreateInputObject(MOIS.Type.OISKeyboard, true);
     mMouse                = (MOIS.Mouse)mInputMgr.CreateInputObject(MOIS.Type.OISMouse, false);
     mKeyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(OnKeyPressed);
 }
コード例 #2
0
        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;
        }
コード例 #3
0
ファイル: App.cs プロジェクト: RainsSoft/ogreflow
        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);
            }
        }
コード例 #4
0
ファイル: InputsManager.cs プロジェクト: Bobbylon5/Mogre14
        /// <summary>
        /// Initializes the keyboad, mouse and the input manager systems
        /// </summary>
        /// <param name="windowHandle">An handle to the game windonw</param>
        public void InitInput(ref int windowHandle)
        {
            mInputMgr = MOIS.InputManager.CreateInputSystem((uint)windowHandle);
            mKeyboard = (MOIS.Keyboard)mInputMgr.CreateInputObject(MOIS.Type.OISKeyboard, true);
            mMouse = (MOIS.Mouse)mInputMgr.CreateInputObject(MOIS.Type.OISMouse, false);

            mKeyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(OnKeyPressed);
        }
コード例 #5
0
        protected virtual void InitializeInput()
        {
            int windowHandle;

            mRenderWindow.GetCustomAttribute("WINDOW", out windowHandle);
            mInputMgr = MOIS.InputManager.CreateInputSystem((uint)windowHandle);

            mKeyboard = (MOIS.Keyboard)mInputMgr.CreateInputObject(MOIS.Type.OISKeyboard, false);
            mMouse    = (MOIS.Mouse)mInputMgr.CreateInputObject(MOIS.Type.OISMouse, false);
        }
コード例 #6
0
        /// <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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
ファイル: Control.cs プロジェクト: CharcoalStyles/3DRL
        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);
            }
        }
コード例 #9
0
ファイル: Example.cs プロジェクト: andyhebear/likeleon
        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);
        }
コード例 #10
0
ファイル: CompositorDemo.cs プロジェクト: andyhebear/likeleon
        public bool Update(MOIS.Keyboard input)
        {
            if (input.IsKeyDown(keyCode))
            {
                if (!keyPressed)
                {
                    keyPressed = true;
                    ToggleCompositor();
                    debugText = compositorName + " " + (compositorIsOn ? "Enabled" : "Disabled");
                    return(true);
                }
            }
            else
            {
                keyPressed = false;
            }

            return(false);
        }
コード例 #11
0
        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;
        }
コード例 #12
0
ファイル: core.cs プロジェクト: Marchew/Tachycardia
        public Core()
        {
            m_config = 0;
            //!config
            m_stateManager = 0;

            m_root = null;
            m_renderWnd = null;
            m_viewport = null;
            m_log = null;
            m_timer = null;

            m_inputMgr = null;
            m_keyboard = null;
            m_mouse = null;

            m_update = 1.0f / 120;
            m_elapsed = 0.0f;

            /*
            for (int i = 0; i < 256; ++i)
                m_keyStates[i] = false;
            */
        }
コード例 #13
0
ファイル: core.cs プロジェクト: Marchew/Tachycardia
        private void SetupInputSystem(MOIS.KeyListener pKeyListener, MOIS.MouseListener pMouseListener)
        {
            ulong hWnd = 0;
            MOIS.ParamList paramList;
            paramList.Insert( "WINDOW", Mogre.StringConverter.ToString(hWnd));

            m_inputMgr = MOIS.InputManager.CreateInputSystem(paramList);
            m_keyboard = (MOIS.Keyboard) m_inputMgr.CreateInputObject( MOIS.Type.OISKeyboard, true);
            m_mouse = (MOIS.Mouse) m_inputMgr.CreateInputObject(MOIS.Type.OISMouse, true));
            /*m_mouse.MouseState.height = m_renderWnd.height;
            m_mouse.MouseState.width  = m_renderWnd.width;

            if(pKeyListener == 0)
                m_Keyboard->setEventCallback(this);
            else
                m_Keyboard->setEventCallback(pKeyListener);

            if(pMouseListener == 0)
                m_Mouse->setEventCallback(this);
            else
                m_Mouse->setEventCallback(pMouseListener);
             */
        }
コード例 #14
0
        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();
        }
コード例 #15
0
ファイル: Engine.cs プロジェクト: janPierdolnikParda/RPG
        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");
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: aRkker/Survival
        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);
        }
コード例 #17
0
ファイル: Core.cs プロジェクト: Marchew/Tachycardia
        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();
        }
コード例 #18
0
ファイル: Core.cs プロジェクト: secred/Tachycardia
        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;
        }
コード例 #19
0
ファイル: Engine.cs プロジェクト: janPierdolnikParda/RPG
        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");
        }
コード例 #20
0
        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();
        }
コード例 #21
0
ファイル: App.cs プロジェクト: RainsSoft/ogreflow
        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);
            }
        }
コード例 #22
0
ファイル: Tutorial.cs プロジェクト: scauglog/sma_mogre
        protected virtual void InitializeInput()
        {
            int windowHandle;
            mRenderWindow.GetCustomAttribute("WINDOW", out windowHandle);
            mInputMgr = MOIS.InputManager.CreateInputSystem((uint)windowHandle);

            mKeyboard = (MOIS.Keyboard)mInputMgr.CreateInputObject(MOIS.Type.OISKeyboard, false);
            mMouse = (MOIS.Mouse)mInputMgr.CreateInputObject(MOIS.Type.OISMouse, false);
        }
コード例 #23
0
ファイル: Example.cs プロジェクト: joproulx/FrisbeeSimulator
        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);
        }
コード例 #24
0
ファイル: Example.cs プロジェクト: andyhebear/mogresdk
        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;
        }