コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Vetao22/Doom-Fire
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);
            dc   = new DrawableCanvas();
            fire = new Fire(37, 37);

            canvas.Children.Add(dc);
        }
コード例 #2
0
        public void Draw(DrawableCanvas dc, int initialX, int initialY)
        {
            int    curX = initialX, curY = initialY, index = levels.Count - 1;
            double bmpWidth = 1, bmpHeight = 1;
            Rect   destRect;

            for (int y = 0; y < rows; y++)
            {
                for (int x = 0; x < cols; x++)
                {
                    int lvl = levels[index];
                    index--;

                    curX    += (int)bmpWidth;
                    destRect = new Rect(curX, curY, bmpWidth, bmpHeight);

                    dc.DrawImage(colors[lvl], destRect);
                }
                curY -= (int)bmpHeight;
                curX  = initialX;
            }
        }