Пример #1
0
 public static void initgraph(int Width, int Height, bool fullScreen, Glass glass, AnaglyphMethod method)
 {
     initgraph(Width, Height);
     Graph3d.set3DGlass(glass);
     Graph3d.SetAnaglyphMethod(method);
 }
Пример #2
0
        public static void delay(int milisecound)
        {
            if (bitmap != null)
            {
                byte[] bytesToShow = (byte[])bitmap.Pixels.Clone();

                Bitmap temp = null;
                if (Graph3d.mouse3da && Graph3d.MouseX != -1)
                {
                    temp        = new Bitmap(width, height);
                    temp.Pixels = bytesToShow;
                    Graph3d.DrawMouse(bitmap);
                    bytesToShow = (byte[])bitmap.Pixels.Clone();
                }

                form.BeginInvoke((MethodInvoker) delegate
                {
                    Image p = form.pictureBox1.Image;

                    Bitmap bitmapToShow    = new Bitmap(width, height);
                    bitmapToShow.Pixels    = bytesToShow;
                    form.pictureBox1.Image = bitmapToShow.SysDraw;

                    if (p != null)
                    {
                        p.Dispose();
                    }
                    if (imediateDrawing)
                    {
                        form.pictureBox1.Update();
                        form.Activate();
                        semaphore.Release();
                    }
                });

                if (temp != null)
                {
                    bitmap.Pixels = temp.Pixels;
                }

                if (imediateDrawing)
                {
                    semaphore.WaitOne();
                }
            }


            if (lastRefresh.Year == 1)
            {
                lastRefresh = DateTime.Now;
            }

            if (milisecound > 0)
            {
                TimeSpan temp;
                DateTime until = lastRefresh.AddMilliseconds(milisecound);
                temp = until - DateTime.Now;
                if (temp > TimeSpan.Zero)
                {
                    Thread.Sleep(temp);
                }
            }
            MSPF        = (DateTime.Now - lastRefresh).TotalMilliseconds;
            lastRefresh = DateTime.Now;
        }