当前位置: 首页>>代码示例>>C#>>正文


C# InputManager.InputSystemName方法代码示例

本文整理汇总了C#中InputManager.InputSystemName方法的典型用法代码示例。如果您正苦于以下问题:C# InputManager.InputSystemName方法的具体用法?C# InputManager.InputSystemName怎么用?C# InputManager.InputSystemName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InputManager的用法示例。


在下文中一共展示了InputManager.InputSystemName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoStartup

        static void DoStartup()
        {
            ParamList pl = new ParamList();
            Form1 form = new Form1();
            form.Show();
            pl.Insert("WINDOW", form.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
            g_InputManager = InputManager.CreateInputSystem(pl);

            uint v = InputManager.VersionNumber;
            Console.WriteLine("OIS Version: " + (v >> 16) + "." + ((v >> 8) & 0x000000FF) + "." + (v & 0x000000FF)
                + "\n\tRelease Name: " //+ InputManager.VersionName
                + "\n\tPlatform: " + g_InputManager.InputSystemName()
                + "\n\tNumber of Mice: " + g_InputManager.GetNumberOfDevices(MOIS.Type.OISMouse)
                + "\n\tNumber of Keyboards: " + g_InputManager.GetNumberOfDevices(MOIS.Type.OISKeyboard)
                + "\n\tNumber of Joys/Pads = " + g_InputManager.GetNumberOfDevices(MOIS.Type.OISJoyStick));

            //List all devices
            DeviceList list = g_InputManager.ListFreeDevices();
            foreach (KeyValuePair<MOIS.Type, string> pair in list)
                Console.WriteLine("\n\tDevice: " + g_DeviceType[(int)pair.Key] + " Vendor: " + pair.Value);

            g_kb = (Keyboard)g_InputManager.CreateInputObject(MOIS.Type.OISKeyboard, true);
            g_kb.KeyPressed += new KeyListener.KeyPressedHandler(KeyPressed);
            g_kb.KeyReleased += new KeyListener.KeyReleasedHandler(KeyReleased);

            g_m = (Mouse)g_InputManager.CreateInputObject(MOIS.Type.OISMouse, true);
            g_m.MouseMoved += new MouseListener.MouseMovedHandler(MouseMoved);
            g_m.MousePressed += new MouseListener.MousePressedHandler(MousePressed);
            g_m.MouseReleased += new MouseListener.MouseReleasedHandler(MouseReleased);

            MouseState_NativePtr ms = g_m.MouseState;
            ms.width = form.Width;
            ms.height = form.Height;

            //This demo only uses at max 4 joys
            int numSticks = g_InputManager.GetNumberOfDevices(MOIS.Type.OISJoyStick);
            if (numSticks > 4) numSticks = 4;

            g_joys = new JoyStick[numSticks];

            for (int i = 0; i < numSticks; ++i)
            {
                g_joys[i] = (JoyStick)g_InputManager.CreateInputObject(MOIS.Type.OISJoyStick, true);
                g_joys[i].AxisMoved += new JoyStickListener.AxisMovedHandler(AxisMoved);
                g_joys[i].ButtonPressed += new JoyStickListener.ButtonPressedHandler(JoyButtonPressed);
                g_joys[i].ButtonReleased += new JoyStickListener.ButtonReleasedHandler(JoyButtonReleased);
                g_joys[i].PovMoved += new JoyStickListener.PovMovedHandler(PovMoved);
                g_joys[i].Vector3Moved += new JoyStickListener.Vector3MovedHandler(Vector3Moved);
            }
        }
开发者ID:andyhebear,项目名称:extramegablob,代码行数:56,代码来源:Program.cs


注:本文中的InputManager.InputSystemName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。