コード例 #1
0
ファイル: ClientPeer.cs プロジェクト: taptapit/Server-Client
        public void DrawPlayer()
        {//user에 편입
            Font  thisfont  = null;
            Brush thisbrush = new SolidBrush(Color.Black);

            thisfont = new Font("AR CENA", 10);

            lock (player_locker)
            {
                for (int i = 0; i < 7; i++)
                {
                    User player = Players[i];
                    if (player != null)
                    {
                        Point point = getDrawPoint((int)player.x, (int)player.y);
                        DoubleBuffering.Instance().getGraphics.FillRectangle(player.brush, new Rectangle(point, new Size(dot, dot)));
                        DoubleBuffering.Instance().getGraphics.DrawRectangle(new Pen(Color.Black), point.X, point.Y, dot, dot);
                    }
                }
            }
            if (Players[my_no] != null)
            {
                DoubleBuffering.Instance().getGraphics.DrawString(Players[my_no].x + ", " + Players[my_no].y, thisfont, thisbrush, 10, 10);
            }
        }
コード例 #2
0
 public static DoubleBuffering Instance(BufferedGraphics graphics)
 {
     if (oInstance == null)
     {
         oInstance = new DoubleBuffering(graphics);
     }
     else
     {
         oInstance = null;
         oInstance = new DoubleBuffering(graphics);
     }
     return(oInstance);
 }
コード例 #3
0
ファイル: ClientPeer.cs プロジェクト: taptapit/Server-Client
 public void DrawMap()
 {
     for (int i = 0; i < 50; i++)
     {
         for (int j = 0; j < 75; j++)
         {
             int p = map[i, j] / 10;
             if (Players[p] != null)
             {
                 DoubleBuffering.Instance().getGraphics.FillRectangle(Players[p].brush, new Rectangle(j * dot - screen.X, i * dot - screen.Y, dot, dot));
             }
         }
     }
 }
コード例 #4
0
ファイル: MainProgram.cs プロジェクト: taptapit/Server-Client
 private void Draw()
 {
     DoubleBuffering.Instance().getGraphics.Clear(Color.LightBlue);
     if (callback_DrawMap != null)
     {
         callback_DrawMap();
     }
     if (callback_DrawUser != null)
     {
         callback_DrawUser();
     }
     if (callback_DrawLetter != null)
     {
         callback_DrawLetter();
     }
 }
コード例 #5
0
        public void DoubleBufferingSetting()
        {
            Graphics gg = CreateGraphics();

            DoubleBuffering.Instance(BufferedGraphicsManager.Current.Allocate(gg, this.ClientRectangle));
            gg.Dispose();

            void Render()
            {
                try
                {
                    DoubleBuffering.Work();

                    Invoke(new Action(delegate()
                    {
                        try
                        {
                            Graphics g = CreateGraphics();
                            DoubleBuffering.Instance().getBuffered.Render(g);
                            g.Dispose();
                        }
                        catch (Exception e)
                        {
                        }
                    }));
                }
                catch (Exception e)
                {
                }
            }

            Threading_Timer thread_FrameRender = new Threading_Timer();

            thread_FrameRender.setCallback(new Action(delegate() {
                //callback_Draw();
                Render();
            }));
            thread_FrameRender.setInterval(8);
            thread_FrameRender.Start();
        }
コード例 #6
0
ファイル: MainProgram.cs プロジェクト: taptapit/Server-Client
 public void Draw()
 {
     DoubleBuffering.Instance().getGraphics.DrawString(str, thisfont, thisbrush, Map.getDrawPoint((int)x, (int)y - 15));
 }
コード例 #7
0
 private static void Drawing()
 {
     DoubleBuffering.Instance().getGraphics.FillRectangle(thisbrush, rectangle);
     DoubleBuffering.Instance().getGraphics.DrawRectangle(greenpen, rectangle);
 }