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


C# Flags.HasFlag方法代码示例

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


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

示例1: Move

        /// <summary>
        /// Constructor for pawn promotions moves
        /// </summary>
        public Move(int from_cell, int to_cell, Flags flags, Exports.Pieces promote_to)
        {
            Debug.Assert(flags.HasFlag(Flags.Promotion));
            Debug.Assert(!(flags.HasFlag(Flags.EnPassantCapture)
                || flags.HasFlag(Flags.ShortCastle) || flags.HasFlag(Flags.LongCastle)));
            Debug.Assert(promote_to == Exports.Pieces.Knight
                || promote_to == Exports.Pieces.Bishop
                || promote_to == Exports.Pieces.Rook
                || promote_to == Exports.Pieces.Queen);

            m_data = new Bitmask32();
            Init((int)Exports.Pieces.Pawn, from_cell, to_cell, (int)flags,
                (int)promote_to);
        }
开发者ID:maksimbulva,项目名称:chesshive,代码行数:17,代码来源:Move.cs

示例2: Save

        public static void Save(BinaryWriter bw, DDS dds)
        {
            Flags flags = (Flags.Caps | Flags.Height | Flags.Width | Flags.PixelFormat | Flags.MipMapCount);
            flags |= (dds.format == D3DFormat.A8R8G8B8 ? Flags.Pitch : Flags.LinearSize);

            bw.Write(new byte[] { 0x44, 0x44, 0x53, 0x20 });    // 'DDS '
            bw.Write(124);
            bw.Write((int)flags);
            bw.Write(dds.Height);
            bw.Write(dds.Width);
            bw.Write((flags.HasFlag(Flags.Pitch) ? dds.width * 4 : dds.MipMaps[0].Data.Length));
            bw.Write(dds.Depth);
            bw.Write(dds.MipMaps.Count);

            for (int i = 0; i < 11; i++) { bw.Write(0); }

            // PixelFormat
            bw.Write(32);

            switch (dds.Format)
            {
                case D3DFormat.DXT1:
                case D3DFormat.DXT3:
                case D3DFormat.DXT5:
                    bw.Write(4);        // fourCC length
                    bw.Write(dds.Format.ToString().ToCharArray());
                    bw.Write(0);
                    bw.Write(0);
                    bw.Write(0);
                    bw.Write(0);
                    bw.Write(0);
                    break;

                default:
                    bw.Write(0);    // fourCC length
                    bw.Write(0);
                    bw.Write(32);   //  RGB bit count
                    bw.Write(255 << 16);    // R mask
                    bw.Write(255 << 8);     // G mask
                    bw.Write(255 << 0);     // B mask
                    bw.Write(255 << 24);    // A mask
                    break;
            }

            bw.Write((int)DDSCaps.DDSCAPS_TEXTURE);
            bw.Write(0);    // Caps 2
            bw.Write(0);    // Caps 3
            bw.Write(0);    // Caps 4
            bw.Write(0);    // Reserved

            for (int i = 0; i < dds.mipMaps.Count; i++)
            {
                bw.Write(dds.mipMaps[i].Data);
            }
        }
开发者ID:DevilboxGames,项目名称:ToxicRagers,代码行数:55,代码来源:cDDS.cs

示例3: Execute


//.........这里部分代码省略.........

                // HALT
                case 0x76:
                    cycles = 1;
                    halted = true;
                    break;

                // STOP
                case 0x10:
                    cycles = 1;
                    if (mmu.ReadByte(pc) == 0x00)
                    {
                        pc++; halted = true;
                        // Dunno what to do from here.
                    }
                    break;

                // Disable Interrupt
                case 0xF3:
                    cycles = 1;
                    diTimer = 1;
                    break;

                // Enable Interrupt
                case 0xFB:
                    cycles = 1;
                    eiTimer = 1;
                    break;

                // Rotate Left
                case 0x07: cycles = 1; a = rotateLeft(a); break;

                // Rotate Left through Carry
                case 0x17: cycles = 1; a = rotateLeft(a); if (f.HasFlag(Flags.Carry)) a++; break;

                // Rotate Right
                case 0x0F: cycles = 1; a = rotateRight(a); break;

                // Rotate Right through Carry
                case 0x1F: cycles = 1; a = rotateRight(a); if (f.HasFlag(Flags.Carry)) a += 0x80; break;

                // Restart
                case 0xC7: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x00; break;
                case 0xCF: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x08; break;
                case 0xD7: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x10; break;
                case 0xDF: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x18; break;
                case 0xE7: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x20; break;
                case 0xEF: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x28; break;
                case 0xF7: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x30; break;
                case 0xFF: cycles = 8; mmu.WriteWord(sp++, pc); pc = 0x38; break;

            #endregion

            #region Jumps
                // Jump
                case 0xC3:
                    cycles = 3;
                    pc = (ushort)(mmu.ReadByte(pc++) | ((mmu.ReadByte(pc++)) << 8));
                    break;

                case 0xE9:
                    cycles = 1;
                    pc = mmu.ReadByte(hl); break;
                case 0x18:
                    cycles = 2;
                    pc = (ushort)((short)pc + (short)(unchecked((sbyte)mmu.ReadByte(pc++))));
开发者ID:Goatmancer,项目名称:GameBoySharp,代码行数:67,代码来源:CPU.cs


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