Modding talk:Code page 437: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
(Created page with "You can use this code to draw all the symbols from the Code Page 437 table in-game. (You'll have to call it from your own function somewhere). <syntaxhighlight lang="c#">...")
 
 
(One intermediate revision by one other user not shown)
(No difference)

Latest revision as of 22:56, 22 November 2019

You can use this code to draw all the symbols from the Code Page 437 table in-game. (You'll have to call it from your own function somewhere).

        public void DebugDrawSymbolsForFun()
        {
            ScreenBuffer scrapBuffer = ScreenBuffer.GetScrapBuffer2(true);
            for (int i = 0; i <= 79; i++)
            {
                for (int j = 0; j <= 24; j++)
                {
                    if (i > 31 && i <= 47 && j > 4 && j <= 20)
                    {
                        string val1 = (i - 32).ToString("X");
                        string val2 = (j - 5).ToString("X");

                        string codePoint = "00" + val2 + val1;

                        int code = int.Parse(codePoint, System.Globalization.NumberStyles.HexNumber);
                        string unicodeString = char.ConvertFromUtf32(code);

                        scrapBuffer.Goto(i, j);
                        scrapBuffer.Write("&Y^k" + unicodeString[0]);
                    }
                    else
                    {
                        scrapBuffer.Goto(i, j);
                        scrapBuffer.Write("&y^k ");
                    }
                }
            }
            Popup._TextConsole.DrawBuffer(scrapBuffer, null, false);
        }