Ejemplo n.º 1
0
        public override void Resume()
        {
            GResource.LoadTextures();

            var imageFon = new GImage(Game);

            imageFon.SetTexture(GResource.game_fon);
            imageFon.SetWidth(Game.GetWindowWidth());
            imageFon.SetHeight(Game.GetWindowHeight());
            imageFon.SetX(Game.GetWindowWidth() / 2);
            imageFon.SetY(Game.GetWindowHeight() / 2);
            AddElement(imageFon);

            tree = new ChristmasTree(Game);
            tree.GenerateDecorations(3);

            train = new Train(Game, GResource.train);
            train.Initialize(Game.GetWindowWidth() / 2, 65, 90, 30);
            train.SetChristmasTree(tree);

            cat = new Cat(Game, Game.GetWindowWidth() / 2, Game.GetWindowHeight() / 2, 50, 50);
            cat.AddTextures(GResource.lcat, Cat.STATE.LEFT);
            cat.AddTextures(GResource.rcat, Cat.STATE.RIGHT);
            cat.Bump();
            cat.SetChristmasTree(tree);
            //	AddElement(imageCat);
        }
Ejemplo n.º 2
0
        public override void Resume()
        {
            GResource.LoadTextures();

            imgLMD = new GImage(Game);
            imgLMD.SetTexture(GResource.game_fon);
            imgLMD.SetWidth(250);
            imgLMD.SetHeight(200);
            imgLMD.SetX(Game.GetWindowWidth() / 2);
            imgLMD.SetY(Game.GetWindowHeight() / 2 + 100);
            AddElement(imgLMD);

            CircleButton but = new CircleButton(Game);

            but.onClick += ScreenStart_onClick;
            but.SetX(Game.GetWindowWidth() / 2);
            but.SetY(150);
            but.SetRadius(80);
            but.SetImage(GImage.LoadTexture(@"C:\Users\User\Desktop\WarBugs\button_play.png"));

            GameFramewerk.UI.Animations.AnimationScale anim = new GameFramewerk.UI.Animations.AnimationScale();
            anim.Initialize(but.GetWidth(), but.GetHeight(), but.GetWidth() + 20, but.GetHeight() + 20, 4, 4, but);

            AddElement(but);
        }
Ejemplo n.º 3
0
        public InfoBody AddVert(float x, float y, Vec2[] vert, float angle, float density,
                                float friction, float restetution, Bitmap image, Object userDate = null)
        {
            float max_w = vert[0].X;
            float max_h = vert[0].Y;

            for (int i = 0; i < vert.Length; i++)
            {
                if (vert[i].X > max_w)
                {
                    max_w = vert[i].X;
                }

                if (vert[i].Y > max_h)
                {
                    max_h = vert[i].Y;
                }

                vert[i].X /= 2;
                vert[i].Y /= 2;

                vert[i].X /= metric;
                vert[i].Y /= metric;
            }

            GImage g_image = new GImage(game);

            g_image.SetImage(image);
            g_image.SetWidth(max_w);
            g_image.SetHeight(max_h);

            BodyDef bDef = new BodyDef();

            bDef.Position.Set(x / metric, y / metric);
            bDef.Angle = angle;

            PolygonDef pDef = new PolygonDef();

            pDef.Restitution = restetution;
            pDef.Friction    = friction;
            pDef.Density     = density;
            pDef.SetAsBox(max_w / metric / 2, max_h / metric / 2);
            pDef.Vertices = vert;

            Body body = world.CreateBody(bDef);

            body.CreateShape(pDef);
            body.SetMassFromShapes();

            InfoBody info = new InfoBody();

            info.image    = g_image;
            info.body     = body;
            info.userDate = userDate;

            body.SetUserData(info);

            return(info);
        }
Ejemplo n.º 4
0
        public ScreenLoading(IGame game) : base(game)
        {
            image = new GImage(game);
            image.SetWidth(100);
            image.SetHeight(100);
            image.SetX(200);
            image.SetY(100);
            image.SetImage(GameResource.text_lmd);

            AddElement(image);
        }
Ejemplo n.º 5
0
        public void AddDecoration(float x, float y, float w, float h, uint texture)
        {
            GImage img = new GImage(game);

            img.SetTexture(texture);
            img.SetX(x);
            img.SetY(y);
            img.SetWidth(w);
            img.SetHeight(h);
            img.UserObject = "decoration";
            Decorations.Add(img);
        }
Ejemplo n.º 6
0
        private GImage CreateImage(float x, float y, float width, float height, Bitmap b_img)
        {
            GImage img = new GImage(Game);

            img.SetWidth(width);
            img.SetHeight(height);
            img.SetImage(b_img);
            img.SetX(x);
            img.SetY(y);
            AddElement(img);

            return(img);
        }
Ejemplo n.º 7
0
        public override void Resume()
        {
            imgLMD = new GImage(Game);
            imgLMD.SetImage(GameResource.text_lmd);
            imgLMD.SetWidth(50);
            imgLMD.SetHeight(1);
            imgLMD.SetX(Game.GetWindowWidth() / 2 + 90);
            imgLMD.SetY(200);
            ScaleImg_x = imgLMD.GetWidth();
            ScaleImg_y = imgLMD.GetHeight();
            AddElement(imgLMD);

            intent_to_menu = new Intent(Game);
            intent_to_menu.SetScreenLoading(null);
        }
Ejemplo n.º 8
0
        public Cat(IGame game, float x, float y, float w, float h)
        {
            EnableAnimation = false;

            if (x > game.GetWindowWidth())
            {
                State = STATE.RIGHT;
            }
            else
            {
                State = STATE.LEFT;
            }

            texturesL = new uint[16];
            texturesR = new uint[16];

            image = new GImage(game);
            image.SetWidth(w);
            image.SetHeight(h);
            image.SetX(x);
            image.SetY(y);
        }
Ejemplo n.º 9
0
        public override void Step(float dt)
        {
            this.dt = dt;

            if (ScaleImg_x < 250)
            {
                ScaleImg_x += 2;
            }
            if (ScaleImg_y < 200)
            {
                ScaleImg_y += 2;
            }
            else
            {
                Time -= 0.1f;
                if (Time <= 0)
                {
                    StartMenu();
                }
            }

            imgLMD.SetWidth(ScaleImg_x);
            imgLMD.SetHeight(ScaleImg_y);
        }
Ejemplo n.º 10
0
        public InfoBody AddRect(float x, float y, float w, float h, float angle, float density,
                                float friction, float restetution, Bitmap image, Object userDate = null)
        {
            GImage g_image = new GImage(game);

            g_image.SetImage(image);
            g_image.SetWidth(w);
            g_image.SetHeight(h);

            BodyDef bDef = new BodyDef();

            bDef.Position.Set(x / metric, y / metric);
            bDef.Angle = angle;

            PolygonDef pDef = new PolygonDef();

            pDef.Restitution = restetution;
            pDef.Friction    = friction;
            pDef.Density     = density;
            pDef.SetAsBox(w / metric / 2, h / metric / 2);

            Body body = world.CreateBody(bDef);

            body.CreateShape(pDef);
            body.SetMassFromShapes();

            InfoBody info = new InfoBody();

            info.image    = g_image;
            info.body     = body;
            info.userDate = userDate;

            body.SetUserData(info);

            return(info);
        }
Ejemplo n.º 11
0
        public InfoBody AddCircle(float x, float y, float radius, float angle, float density,
                                  float friction, float restetution, Bitmap image, Object userDate = null)
        {
            GImage g_image = new GImage(game);

            g_image.SetImage(image);
            g_image.SetWidth(radius * 2);
            g_image.SetHeight(radius * 2);

            BodyDef bDef = new BodyDef();

            bDef.Position.Set(x / metric, y / metric);
            bDef.Angle = angle;

            CircleDef pDef = new CircleDef();

            pDef.Restitution = restetution;
            pDef.Friction    = friction;
            pDef.Density     = density;
            pDef.Radius      = radius / metric;

            Body body = world.CreateBody(bDef);

            body.CreateShape(pDef);
            body.SetMassFromShapes();

            InfoBody info = new InfoBody();

            info.image    = g_image;
            info.body     = body;
            info.userDate = userDate;

            body.SetUserData(info);

            return(info);
        }
Ejemplo n.º 12
0
        public override void Resume()
        {
            // Initialize particle parameters
            partParams    = new GSystemParticles.ParticleParameters[1];
            partParams[0] = new GSystemParticles.ParticleParameters()
            {
                Type   = GSystemParticles.TypeParticle.Circle,
                Color  = Color.DarkTurquoise,
                TTL    = 100,
                radius = 10
            };

            // Initialize Physics
            Game.GetPhysics().Initialize(-1000, -1000, 1000, 1000, 0, 0, false);
            Game.GetPhysics().GetSolver().onAdd += ScreenGame_onAdd;

            // Create circles
            InfoBody foeBody = Game.GetPhysics().AddCircle(Game.GetWindowWidth() / 2, 100, 50, 0, 1f, 1f, 1f, GameResource.circle_3, "I");

            myBody   = Game.GetPhysics().AddCircle(Game.GetWindowWidth() / 2, Game.GetWindowHeight() - 100, 50, 0, 1f, 1f, 1f, GameResource.circle_1, "FOE");
            ballBody = Game.GetPhysics().AddCircle(Game.GetWindowWidth() / 2, Game.GetWindowHeight() / 2 + 40, 30, 0, 1f, 1f, 1f, GameResource.circle_2, "BALL");
            LFoe     = new LogicFoe(Game, foeBody, ballBody);

            // Create borders
            Game.GetPhysics().AddRect(0, Game.GetWindowHeight() / 2, 20, Game.GetWindowHeight(), 0, 0f, 0f, 0f, GameResource.rect_3, "BORDER");
            Game.GetPhysics().AddRect(Game.GetWindowWidth() - 15, Game.GetWindowHeight() / 2, 20, Game.GetWindowHeight(), 0, 0f, 0f, 0f, GameResource.rect_3, "BORDER");

            // Decor
            image_line = new GImage(Game);
            image_line.SetImage(GameResource.rect_1);
            image_line.SetX(Game.GetWindowWidth() / 2);
            image_line.SetY(Game.GetWindowHeight() / 2);
            image_line.SetWidth(Game.GetWindowWidth());
            image_line.SetHeight(10);

            // Create intent to menu
            Intent intent_to_menu = new Intent(Game);

            intent_to_menu.SetScreenLoading(null);

            // Create top panel
            topPanel = new GTopPanel(Game);
            topPanel.ClearBalls();
            topPanel.onCommand += (cmd) =>
            {
                switch (cmd)
                {
                case GTopPanel.CommandTopPanel.menu:
                    intent_to_menu.screenFrom = this;
                    intent_to_menu.screenTo   = new ScreenMenu(Game);
                    intent_to_menu.Start();
                    break;

                case GTopPanel.CommandTopPanel.play:
                    IsPause = false;
                    break;

                case GTopPanel.CommandTopPanel.pause:
                    IsPause = true;
                    break;
                }
            };
            AddElement(topPanel);
        }