DrawString() public static method

public static DrawString ( int x, int y, string str ) : void
x int
y int
str string
return void
コード例 #1
0
        /// <summary>
        /// Con_DrawNotify
        /// </summary>
        public static void DrawNotify()
        {
            int v = 0;

            for (int i = _Current - NUM_CON_TIMES + 1; i <= _Current; i++)
            {
                if (i < 0)
                {
                    continue;
                }

                double time = _Times[i % NUM_CON_TIMES];
                if (time == 0)
                {
                    continue;
                }

                time = Host.RealTime - time;
                if (time > _NotifyTime.Value)
                {
                    continue;
                }

                int textOffset = (i % _TotalLines) * _LineWidth;

                Scr.ClearNotify = 0;
                Scr.CopyTop     = true;

                for (int x = 0; x < _LineWidth; x++)
                {
                    Drawer.DrawCharacter((x + 1) << 3, v, _Text[textOffset + x]);
                }

                v += 8;
            }

            if (Key.Destination == keydest_t.key_message)
            {
                Scr.ClearNotify = 0;
                Scr.CopyTop     = true;

                int x = 0;

                Drawer.DrawString(8, v, "say:");
                string chat = Key.ChatBuffer;
                for (; x < chat.Length; x++)
                {
                    Drawer.DrawCharacter((x + 5) << 3, v, chat[x]);
                }
                Drawer.DrawCharacter((x + 5) << 3, v, 10 + ((int)(Host.RealTime * _CursorSpeed) & 1));
                v += 8;
            }

            if (v > _NotifyLines)
            {
                _NotifyLines = v;
            }
        }
コード例 #2
0
ファイル: Sbar.cs プロジェクト: JakeSmokie/SharpQuake
 // Sbar_DrawString
 static void DrawString(int x, int y, string str)
 {
     if (Client.Cl.gametype == Protocol.GAME_DEATHMATCH)
     {
         Drawer.DrawString(x, y + Scr.vid.height - SBAR_HEIGHT, str);
     }
     else
     {
         Drawer.DrawString(x + ((Scr.vid.width - 320) >> 1), y + Scr.vid.height - SBAR_HEIGHT, str);
     }
 }
コード例 #3
0
ファイル: Sbar.cs プロジェクト: JakeSmokie/SharpQuake
        // Sbar_DeathmatchOverlay
        static void DeathmatchOverlay()
        {
            Scr.CopyEverithing = true;
            Scr.FullUpdate     = 0;

            glpic_t pic = Drawer.CachePic("gfx/ranking.lmp");

            Menu.DrawPic((320 - pic.width) / 2, 8, pic);

            // scores
            SortFrags();

            // draw the text
            int l = _ScoreBoardLines;

            int x = 80 + ((Scr.vid.width - 320) >> 1);
            int y = 40;

            for (int i = 0; i < l; i++)
            {
                int        k = _FragSort[i];
                Scoreboard s = Client.Cl.scores[k];
                if (String.IsNullOrEmpty(s.name))
                {
                    continue;
                }

                // draw background
                int top    = s.colors & 0xf0;
                int bottom = (s.colors & 15) << 4;
                top    = ColorForMap(top);
                bottom = ColorForMap(bottom);

                Drawer.Fill(x, y, 40, 4, top);
                Drawer.Fill(x, y + 4, 40, 4, bottom);

                // draw number
                string num = s.frags.ToString().PadLeft(3);

                Drawer.DrawCharacter(x + 8, y, num[0]);
                Drawer.DrawCharacter(x + 16, y, num[1]);
                Drawer.DrawCharacter(x + 24, y, num[2]);

                if (k == Client.Cl.viewentity - 1)
                {
                    Drawer.DrawCharacter(x - 8, y, 12);
                }

                // draw name
                Drawer.DrawString(x + 64, y, s.name);

                y += 10;
            }
        }
コード例 #4
0
ファイル: Sbar.cs プロジェクト: JakeSmokie/SharpQuake
        // Sbar_DeathmatchOverlay
        static void MiniDeathmatchOverlay()
        {
            if (Scr.vid.width < 512 || Sbar.Lines == 0)
            {
                return;
            }

            Scr.CopyEverithing = true;
            Scr.FullUpdate     = 0;

            // scores
            SortFrags();

            // draw the text
            int l        = _ScoreBoardLines;
            int y        = Scr.vid.height - Sbar.Lines;
            int numlines = Sbar.Lines / 8;

            if (numlines < 3)
            {
                return;
            }

            //find us
            int i;

            for (i = 0; i < _ScoreBoardLines; i++)
            {
                if (_FragSort[i] == Client.Cl.viewentity - 1)
                {
                    break;
                }
            }

            if (i == _ScoreBoardLines) // we're not there
            {
                i = 0;
            }
            else // figure out start
            {
                i = i - numlines / 2;
            }

            if (i > _ScoreBoardLines - numlines)
            {
                i = _ScoreBoardLines - numlines;
            }

            if (i < 0)
            {
                i = 0;
            }

            int x = 324;

            for (; i < _ScoreBoardLines && y < Scr.vid.height - 8; i++)
            {
                int        k = _FragSort[i];
                Scoreboard s = Client.Cl.scores[k];
                if (String.IsNullOrEmpty(s.name))
                {
                    continue;
                }

                // draw background
                int top    = s.colors & 0xf0;
                int bottom = (s.colors & 15) << 4;
                top    = ColorForMap(top);
                bottom = ColorForMap(bottom);

                Drawer.Fill(x, y + 1, 40, 3, top);
                Drawer.Fill(x, y + 4, 40, 4, bottom);

                // draw number
                string num = s.frags.ToString().PadLeft(3);
                Drawer.DrawCharacter(x + 8, y, num[0]);
                Drawer.DrawCharacter(x + 16, y, num[1]);
                Drawer.DrawCharacter(x + 24, y, num[2]);

                if (k == Client.Cl.viewentity - 1)
                {
                    Drawer.DrawCharacter(x, y, 16);
                    Drawer.DrawCharacter(x + 32, y, 17);
                }

                // draw name
                Drawer.DrawString(x + 48, y, s.name);

                y += 8;
            }
        }