Пример #1
0
        public GUI(SpaceGame.units.Spaceman player, SpaceGame.units.BlackHole blackhole)
        {
            this.screenHeight = Game1.SCREENHEIGHT;
            this.screenWidth = Game1.SCREENWIDTH;

            targetWheelRec.X = (screenWidth / 2) - 32;
            targetWheelRec.Y = screenHeight - targetWheel.Height;
            targetWheelRec.Width = targetWheel.Width;
            targetWheelRec.Height = targetWheel.Height;

            leftClickRec.X = (screenWidth / 2) - 99;
            leftClickRec.Y = screenHeight - leftClick.Height;
            leftClickRec.Width = leftClick.Width;
            leftClickRec.Height = leftClick.Height;

            rightClickRec.X = (screenWidth / 2) + 148;
            rightClickRec.Y = screenHeight - rightClick.Height;
            rightClickRec.Width = rightClick.Width;
            rightClickRec.Height = rightClick.Height;

            spaceClickRec.X = (screenWidth / 2) + 256;
            spaceClickRec.Y = screenHeight - spaceClick.Height;
            spaceClickRec.Width = spaceClick.Width;
            spaceClickRec.Height = spaceClick.Height;

            shiftClickRec.X = (screenWidth / 2) - 340;
            shiftClickRec.Y = screenHeight - shiftClick.Height;
            shiftClickRec.Width = shiftClick.Width;
            shiftClickRec.Height = shiftClick.Height;

            button1Rec.X = (screenWidth / 2) - 412;
            button1Rec.Y = screenHeight - button1.Height;
            button1Rec.Width = button1.Width;
            button1Rec.Height = button1.Height;

            button3Rec.X = button1Rec.X;
            button3Rec.Y = button1Rec.Y - button1.Height - 5;
            button3Rec.Width = button3.Width;
            button3Rec.Height = button3.Height;

            button5Rec.X = button1Rec.X;
            button5Rec.Y = button1Rec.Y - 2*button1.Height - 2*5;
            button5Rec.Width = button5.Width;
            button5Rec.Height = button5.Height;

            button2Rec.X = (screenWidth / 2) - 484;
            button2Rec.Y = screenHeight - button2.Height;
            button2Rec.Width = button2.Width;
            button2Rec.Height = button2.Height;

            button4Rec.X = button2Rec.X;
            button4Rec.Y = button2Rec.Y - button2.Height - 5;
            button4Rec.Width = button4.Width;
            button4Rec.Height = button4.Height;

            button6Rec.X = button2Rec.X;
            button6Rec.Y = button2Rec.Y - 2 * button2.Height - 2 * 5;
            button6Rec.Width = button6.Width;
            button6Rec.Height = button6.Height;

            voidWheelRec.X = targetWheelRec.X + targetWheel.Width / 2 - voidWheel.Width / 2;
            voidWheelRec.Y = 0;
            voidWheelRec.Width = voidWheel.Width;
            voidWheelRec.Height = voidWheel.Height;

            this.player = player;
            this.blackhole = blackhole;

            //Initialize health bar in its location
            Vector2 healthBarLoc = new Vector2(targetWheelRec.X + targetWheelRec.Width / 2, (int)(targetWheelRec.Y + HEIGHT_ADJUST * targetWheelRec.Height));
            healthBar = new RadialBar(healthBarLoc, targetWheelRec.Width / RADIUS_ADJUST, 25, -(float)Math.PI / ARC_ADJUST, (float)Math.PI / ARC_ADJUST, Color.Red);

            //Initialize void bar in its location
            Vector2 voidBarLoc = new Vector2(voidWheelRec.X + voidWheelRec.Width / 2, (int)(voidWheelRec.Y + voidWheelRec.Height - 10));
            voidBar = new RadialBar(voidBarLoc, voidWheelRec.Width / RADIUS_ADJUST, 25, (float)(2 * Math.PI - (float)Math.PI / VOID_ARC_ADJUST), (float)Math.PI / VOID_ARC_ADJUST, Color.Purple);
        }
Пример #2
0
        public GUI(SpaceGame.units.Spaceman player, SpaceGame.units.BlackHole blackhole)
        {
            this.screenHeight = Game1.SCREENHEIGHT;
            this.screenWidth  = Game1.SCREENWIDTH;

            targetWheelRec.X      = (screenWidth / 2) - 32;
            targetWheelRec.Y      = screenHeight - targetWheel.Height;
            targetWheelRec.Width  = targetWheel.Width;
            targetWheelRec.Height = targetWheel.Height;

            leftClickRec.X      = (screenWidth / 2) - 99;
            leftClickRec.Y      = screenHeight - leftClick.Height;
            leftClickRec.Width  = leftClick.Width;
            leftClickRec.Height = leftClick.Height;

            rightClickRec.X      = (screenWidth / 2) + 148;
            rightClickRec.Y      = screenHeight - rightClick.Height;
            rightClickRec.Width  = rightClick.Width;
            rightClickRec.Height = rightClick.Height;

            spaceClickRec.X      = (screenWidth / 2) + 256;
            spaceClickRec.Y      = screenHeight - spaceClick.Height;
            spaceClickRec.Width  = spaceClick.Width;
            spaceClickRec.Height = spaceClick.Height;

            shiftClickRec.X      = (screenWidth / 2) - 340;
            shiftClickRec.Y      = screenHeight - shiftClick.Height;
            shiftClickRec.Width  = shiftClick.Width;
            shiftClickRec.Height = shiftClick.Height;

            button1Rec.X      = (screenWidth / 2) - 412;
            button1Rec.Y      = screenHeight - button1.Height;
            button1Rec.Width  = button1.Width;
            button1Rec.Height = button1.Height;

            button3Rec.X      = button1Rec.X;
            button3Rec.Y      = button1Rec.Y - button1.Height - 5;
            button3Rec.Width  = button3.Width;
            button3Rec.Height = button3.Height;

            button5Rec.X      = button1Rec.X;
            button5Rec.Y      = button1Rec.Y - 2 * button1.Height - 2 * 5;
            button5Rec.Width  = button5.Width;
            button5Rec.Height = button5.Height;

            button2Rec.X      = (screenWidth / 2) - 484;
            button2Rec.Y      = screenHeight - button2.Height;
            button2Rec.Width  = button2.Width;
            button2Rec.Height = button2.Height;

            button4Rec.X      = button2Rec.X;
            button4Rec.Y      = button2Rec.Y - button2.Height - 5;
            button4Rec.Width  = button4.Width;
            button4Rec.Height = button4.Height;

            button6Rec.X      = button2Rec.X;
            button6Rec.Y      = button2Rec.Y - 2 * button2.Height - 2 * 5;
            button6Rec.Width  = button6.Width;
            button6Rec.Height = button6.Height;

            voidWheelRec.X      = targetWheelRec.X + targetWheel.Width / 2 - voidWheel.Width / 2;
            voidWheelRec.Y      = 0;
            voidWheelRec.Width  = voidWheel.Width;
            voidWheelRec.Height = voidWheel.Height;

            this.player    = player;
            this.blackhole = blackhole;

            //Initialize health bar in its location
            Vector2 healthBarLoc = new Vector2(targetWheelRec.X + targetWheelRec.Width / 2, (int)(targetWheelRec.Y + HEIGHT_ADJUST * targetWheelRec.Height));

            healthBar = new RadialBar(healthBarLoc, targetWheelRec.Width / RADIUS_ADJUST, 25, -(float)Math.PI / ARC_ADJUST, (float)Math.PI / ARC_ADJUST, Color.Red);

            //Initialize void bar in its location
            Vector2 voidBarLoc = new Vector2(voidWheelRec.X + voidWheelRec.Width / 2, (int)(voidWheelRec.Y + voidWheelRec.Height - 10));

            voidBar = new RadialBar(voidBarLoc, voidWheelRec.Width / RADIUS_ADJUST, 25, (float)(2 * Math.PI - (float)Math.PI / VOID_ARC_ADJUST), (float)Math.PI / VOID_ARC_ADJUST, Color.Purple);
        }