void RecreateDevice(Game game)
        {
            PresentParameters args = GetPresentArgs(game.Width, game.Height);

            for (int i = 0; i < dynamicvBuffers.Length; i++)
            {
                DynamicDataBuffer buffer = dynamicvBuffers[i];
                if (buffer != null)
                {
                    buffer.Dispose();
                }
            }

            while ((uint)device.Reset(args) == (uint)Direct3DError.DeviceLost)
            {
                LoopUntilRetrieved();
            }

            SetDefaultRenderStates();
            RestoreRenderStates();
            for (int i = 0; i < dynamicvBuffers.Length; i++)
            {
                DynamicDataBuffer buffer = dynamicvBuffers[i];
                if (buffer != null)
                {
                    dynamicvBuffers[i]         = device.CreateDynamicVertexBuffer(buffer.MaxSize, buffer.Format);
                    dynamicvBuffers[i].Format  = buffer.Format;
                    dynamicvBuffers[i].MaxSize = buffer.MaxSize;
                    buffer = dynamicvBuffers[i];
                }
            }
        }
        public override int CreateDynamicVb(VertexFormat format, int maxVertices)
        {
            int size = maxVertices * strideSizes[(int)format];
            DynamicDataBuffer buffer = device.CreateDynamicVertexBuffer(size, formatMapping[(int)format]);

            buffer.Format  = formatMapping[(int)format];
            buffer.MaxSize = size;
            return(GetOrExpand(ref dynamicvBuffers, buffer, iBufferSize));
        }