Exemple #1
0
 static internal void InitializeControl()
 {
     _hero      = new Hero(HERO_LEVEL);
     _labyrinth = new Labyrinth(_hero.Level);
     Draw.RedrawMainImage();
     Draw.DrawBackgroundImage(_labyrinth, _hero.Level);
     Draw.ReDrawHero(_hero.HeroPositionX, _hero.HeroPositionY, _hero.HeroPositionX, _hero.HeroPositionY, _hero.Level);
 }
Exemple #2
0
        internal static void DrawBackgroundImage(Labyrinth labyrinth, int Level)
        {
            Graphics g = Graphics.FromImage(backgroundBitmap);



            g.FillRectangle(Brushes.White, 0, 0, LAB_SIZE, LAB_SIZE);
            g.DrawRectangle(new Pen(Color.Red, 1.0f), 0, 0, (LAB_SIZE - 1), (LAB_SIZE - 1));
            float cellWeight = (float)LAB_SIZE / ((float)Level * 2.0f - 1.0f);

            g.FillRectangle(Brushes.Blue, cellWeight * labyrinth.Finish.X, cellWeight * labyrinth.Finish.Y, cellWeight, cellWeight);


            DrawGeneratedLabirinth(labyrinth.GeneratedLabirint(), g, Level);
        }