コード例 #1
0
        /// <summary>
        /// Return max normal pressure supported by tablet.
        /// </summary>
        /// <param name="getNormalPressure_I">TRUE=> normal pressure;
        /// FALSE=> tangential pressure (not supported on all tablets)</param>
        /// <returns>maximum pressure value or zero on error</returns>
        public static Int32 GetMaxPressure(bool getNormalPressure_I = true)
        {
            WintabAxis pressureAxis = new WintabAxis();
            IntPtr     buf          = CMemUtils.AllocUnmanagedBuf(pressureAxis);

            EWTIDevicesIndex devIdx = (getNormalPressure_I ?
                                       EWTIDevicesIndex.DVC_NPRESSURE : EWTIDevicesIndex.DVC_TPRESSURE);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)devIdx, buf);

                pressureAxis = CMemUtils.MarshalUnmanagedBuf <WintabAxis>(buf, size);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetMaxPressure: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return(pressureAxis.axMax);
        }
コード例 #2
0
ファイル: CWintabInfo.cs プロジェクト: Bgoon/GKit
        /// <summary>
        /// Return the WintabAxis object for the specified dimension.
        /// </summary>
        /// <param name="dimension_I">Dimension to fetch (eg: x, y)</param>
        /// <returns></returns>
        public static WintabAxis GetTabletAxis(EAxisDimension dimension_I)
        {
            WintabAxis axis = new WintabAxis();
            IntPtr     buf  = CMemUtils.AllocUnmanagedBuf(axis);

            try
            {
                int size = (int)CWintabFuncs.WTInfo(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)dimension_I, buf);

                axis = CMemUtils.MarshalUnmanagedBuf <WintabAxis>(buf, size);
            }
            finally
            {
                CMemUtils.FreeUnmanagedBuf(buf);
            }

            return(axis);
        }
コード例 #3
0
ファイル: WInfo.cs プロジェクト: AcrylicShrimp/GKit
        /// <summary>
        /// Returns the WintabAxis object for specified device and dimension.
        /// </summary>
        /// <param name="devIndex_I">Device index (-1 = virtual device)</param>
        /// <param name="dim_I">Dimension: AXIS_X, AXIS_Y or AXIS_Z</param>
        /// <returns></returns>
        public static WintabAxis GetDeviceAxis(Int32 devIndex_I, EAxisDimension dim_I)
        {
            WintabAxis axis = new WintabAxis();
            IntPtr     buf  = WMemUtils.AllocUnmanagedBuf(axis);

            try {
                int size = (int)WNativeMethods.WTInfo(
                    (uint)(EWTICategoryIndex.WTI_DEVICES + devIndex_I),
                    (uint)dim_I, buf);

                // If size == 0, then returns a zeroed struct.
                axis = WMemUtils.MarshalUnmanagedBuf <WintabAxis>(buf, size);
            } catch (Exception ex) {
                throw new Exception("FAILED GetDeviceAxis: " + ex.ToString());
            }

            WMemUtils.FreeUnmanagedBuf(buf);

            return(axis);
        }
コード例 #4
0
ファイル: CWintabInfo.cs プロジェクト: Bgoon/GKit
        /// <summary>
        /// Returns the WintabAxis object for specified device and dimension.
        /// </summary>
        /// <param name="devIndex_I">Device index (-1 = virtual device)</param>
        /// <param name="dim_I">Dimension: AXIS_X, AXIS_Y or AXIS_Z</param>
        /// <returns></returns>
        public static WintabAxis GetDeviceAxis(Int32 devIndex_I, EAxisDimension dim_I)
        {
            WintabAxis axis = new WintabAxis();
            IntPtr     buf  = CMemUtils.AllocUnmanagedBuf(axis);

            try
            {
                int size = (int)CWintabFuncs.WTInfo(
                    (uint)(EWTICategoryIndex.WTI_DEVICES + devIndex_I),
                    (uint)dim_I, buf);

                // If size == 0, then returns a zeroed struct.
                axis = CMemUtils.MarshalUnmanagedBuf <WintabAxis>(buf, size);
            }
            finally
            {
                CMemUtils.FreeUnmanagedBuf(buf);
            }

            return(axis);
        }
コード例 #5
0
        /// <summary>
        /// Return the WintabAxis object for the specified dimension.
        /// </summary>
        /// <param name="dimension_I">Dimension to fetch (eg: x, y)</param>
        /// <returns></returns>
        public static WintabAxis GetTabletAxis(EAxisDimension dimension_I)
        {
            WintabAxis axis = new WintabAxis();
            IntPtr     buf  = CMemUtils.AllocUnmanagedBuf(axis);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)dimension_I, buf);

                axis = CMemUtils.MarshalUnmanagedBuf <WintabAxis>(buf, size);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetMaxPressure: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return(axis);
        }
コード例 #6
0
ファイル: CWintabInfo.cs プロジェクト: Bgoon/GKit
        /// <summary>
        /// Return max normal pressure supported by tablet.
        /// </summary>
        /// <param name="getNormalPressure_I">TRUE=> normal pressure;
        /// FALSE=> tangential pressure (not supported on all tablets)</param>
        /// <returns>maximum pressure value or zero on error</returns>
        public static Int32 GetMaxPressure(bool getNormalPressure_I = true)
        {
            WintabAxis pressureAxis = new WintabAxis();
            IntPtr     buf          = CMemUtils.AllocUnmanagedBuf(pressureAxis);

            EWTIDevicesIndex devIdx = (getNormalPressure_I ?
                                       EWTIDevicesIndex.DVC_NPRESSURE : EWTIDevicesIndex.DVC_TPRESSURE);

            try
            {
                int size = (int)CWintabFuncs.WTInfo(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)devIdx, buf);

                pressureAxis = CMemUtils.MarshalUnmanagedBuf <WintabAxis>(buf, size);
            }
            finally
            {
                CMemUtils.FreeUnmanagedBuf(buf);
            }

            return(pressureAxis.axMax);
        }
コード例 #7
0
        /// <summary>
        /// Return the WintabAxis object for the specified dimension.
        /// </summary>
        /// <param name="dimension_I">Dimension to fetch (eg: x, y)</param>
        /// <returns></returns>
        public static WintabAxis GetTabletAxis(EAxisDimension dimension_I)
        {
            WintabAxis axis = new WintabAxis();
            IntPtr buf = CMemUtils.AllocUnmanagedBuf(axis);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)dimension_I, buf);

                axis = CMemUtils.MarshalUnmanagedBuf<WintabAxis>(buf, size);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetMaxPressure: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return axis;
        }
コード例 #8
0
        /// <summary>
        /// Return max normal pressure supported by tablet.
        /// </summary>
        /// <param name="getNormalPressure_I">TRUE=> normal pressure; 
        /// FALSE=> tangential pressure (not supported on all tablets)</param>
        /// <returns>maximum pressure value or zero on error</returns>
        public static Int32 GetMaxPressure(bool getNormalPressure_I = true)
        {
            WintabAxis pressureAxis = new WintabAxis();
            IntPtr buf = CMemUtils.AllocUnmanagedBuf(pressureAxis);

            EWTIDevicesIndex devIdx = (getNormalPressure_I ?
                EWTIDevicesIndex.DVC_NPRESSURE : EWTIDevicesIndex.DVC_TPRESSURE);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)devIdx, buf);

                pressureAxis = CMemUtils.MarshalUnmanagedBuf<WintabAxis>(buf, size);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetMaxPressure: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return pressureAxis.axMax;
        }
コード例 #9
0
        /// <summary>
        /// Returns the WintabAxis object for specified device and dimension.
        /// </summary>
        /// <param name="devIndex_I">Device index (-1 = virtual device)</param>
        /// <param name="dim_I">Dimension: AXIS_X, AXIS_Y or AXIS_Z</param>
        /// <returns></returns>
        public static WintabAxis GetDeviceAxis(Int32 devIndex_I, EAxisDimension dim_I)
        {
            WintabAxis axis = new WintabAxis();
            IntPtr buf = CMemUtils.AllocUnmanagedBuf(axis);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)(EWTICategoryIndex.WTI_DEVICES + devIndex_I), 
                    (uint)dim_I, buf);

                // If size == 0, then returns a zeroed struct.
                axis = CMemUtils.MarshalUnmanagedBuf<WintabAxis>(buf, size);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetDeviceAxis: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return axis;
        }