protected override void CreatePassiveTexture(Clutter.CairoTexture texture, int with_state)
        {
            texture.Clear();
            Cairo.Context context = texture.Create();

            double lwidth = 1;
            double hlwidth = lwidth*0.5;

            //Draw outline rectangles:
            DrawSmallCovers (context, texture.Width, texture.Height, lwidth);

            //Draw play icon:
            context.MoveTo		((texture.Width-lwidth)*0.5, 0.3*(texture.Height-lwidth));
            context.LineTo		((texture.Width-lwidth)*0.5, texture.Height-hlwidth);
            context.LineTo		(texture.Width-hlwidth, 0.65*(texture.Height-lwidth));
            context.ClosePath	();
            context.LineWidth = lwidth;
            double sat = (with_state==0 ? 0.4 : (with_state==1 ? 0.6 : 0.8));
            context.SetSourceRGBA (sat, sat, sat, 1.0);
            context.FillPreserve ();
            context.SetSourceRGB (1.0,1.0,1.0);
            context.Stroke ();

            ((IDisposable) context.Target).Dispose();
            ((IDisposable) context).Dispose();
        }
 public static void RemoveAllFromGroup(Clutter.Group group)
 {
     /*foreach (Actor actor in group) {
         GC.SuppressFinalize (actor);
     }*/
     clutter_group_remove_all (group.Handle);
 }
 protected override void CreateTexture(Clutter.CairoTexture texture, int with_state)
 {
     if (createTexture != null) {
         createTexture (texture, with_state);
     } else {
         base.CreateTexture (texture, with_state);
     }
 }
Ejemplo n.º 4
0
    public bool rubbleIsSolid; //if true rubble has colliders and remains permanently

    public void Set(Clutter clutter)
    {
        //double check if this piece of clutter is a switch
        string name = clutter.name.ToLower();

        if (!isSwitch && IsSwitch(name))
        {
            isSwitch = true;
        }

        EnsureColliders();
    }
Ejemplo n.º 5
0
        public static Clutter Key(Vector2 position, int new_id)
        {
            Clutter key = new Clutter()
            {
                pos              = position,
                collectable      = true,
                ignore_collision = true,
                Sprite           = new AnimatedSprite(ModManager.Instance.AssetManager.LoadTexture2D(Globals.GraphicsDevice, "Key"), 16, 16),
                draw_height      = 16,
                keyid            = new_id,
                draw_width       = 16
            };

            return(key);
        }
Ejemplo n.º 6
0
        protected override bool OnScrollEvent(Clutter.ScrollEvent evnt)
        {
            switch (evnt.Direction)
            {
                case ScrollDirection.Up:
                    base.Depth += scroll_offset;
                    break;
                case ScrollDirection.Down:
                    base.Depth -= scroll_offset;
                    break;
                default:
                    break;
            }

            return base.OnScrollEvent (evnt);
        }
Ejemplo n.º 7
0
        public static Clutter CollisionBox(int width, int height, Vector2 position)
        {
            Clutter collisionBox = new Clutter()
            {
                col_width        = width,
                col_height       = height,
                draw_height      = 0,
                draw_width       = 0,
                ignore_collision = false,
                pos          = position,
                shootable    = true,
                invulnerable = true
            };

            return(collisionBox);
        }
        private void Render(Clutter.CairoTexture texture, int with_state, bool outwards)
        {
            texture.Clear ();
            Cairo.Context context = texture.Create ();

            double lwidth = 1;
            double hlwidth = lwidth*0.5;

            //Draw outline rectangles:
            context.Rectangle (hlwidth, hlwidth, texture.Width - lwidth, texture.Height - lwidth);
                context.SetSourceRGB (1.0, 1.0, 1.0);
                context.LineWidth = lwidth;
                context.StrokePreserve ();
                double sat = (with_state==0 ? 0.4 : (with_state==1 ? 0.6 : 0.8));
                context.SetSourceRGB (sat, sat, sat);
                context.Fill ();

            double dim = 4;
            context.MoveTo (-dim, 0);
            context.LineTo (outwards ? 0 : -dim, outwards ? 0 : dim);
            context.LineTo (0, dim);
            context.MoveTo (-dim, dim);
            context.LineTo (0, 0);
            context.ClosePath ();
            Cairo.Path arrow = context.CopyPath ();
            context.NewPath ();

            double margin = 2 + hlwidth ;
            PointD center = new PointD (texture.Width*0.5, texture.Height*0.5);
            PointD transl = new PointD (center.X - margin, -(center.Y - margin));
            context.LineWidth = lwidth;
            sat =  (with_state==1 ? 0.0 : 1.0);
            context.SetSourceRGB (sat,sat,sat);

            context.Translate (center.X, center.Y);
            for (int i = 0; i < 4; i++) {
                context.Rotate (Math.PI * 0.5 * i);
                context.Translate (transl.X, transl.Y);
                context.AppendPath (arrow);
                context.Stroke ();
                context.Translate (-transl.X, -transl.Y);
            }

            ((IDisposable) arrow).Dispose ();
            ((IDisposable) context.Target).Dispose ();
            ((IDisposable) context).Dispose ();
        }
Ejemplo n.º 9
0
        public static Clutter Button(Vector2 position, Door unlockdoor)
        {
            Clutter button = new Clutter()
            {
                Sprite           = new AnimatedSprite(ModManager.Instance.AssetManager.LoadTexture2D(Globals.GraphicsDevice, "Button"), 16, 16),
                button           = true,
                pos              = position,
                door_unlock      = unlockdoor,
                draw_height      = 16,
                draw_width       = 16,
                col_width        = 15,
                col_height       = 9,
                collision_offset = new Vector2(7, 11)
            };

            return(button);
        }
        protected override void CreateTexture(Clutter.CairoTexture texture, int with_state)
        {
            texture.Clear();
            Cairo.Context context = texture.Create();

            context.Translate(texture.Width*0.5,texture.Height*0.5);
            context.Arc(0,0,(texture.Height-1)*0.5,0,2*Math.PI);
            context.ClosePath();
            context.SetSourceRGBA(1.0,1.0,1.0, with_state==0 ? 0.3 : (with_state==1 ? 0.5 : 0.7));
            context.FillPreserve();
            context.SetSourceRGB(1.0,1.0,1.0);
            context.LineWidth = 1;
            context.Stroke();

            ((IDisposable) context.Target).Dispose();
            ((IDisposable) context).Dispose();
        }
Ejemplo n.º 11
0
        public int Main()
        {
            // Init declaration produces error:
            // Expression denotes a 'type', where a 'method group' was expected
            Clutter c = new Clutter();

            c.Init();

            Stage stage = Stage.Default;

            stage.Color = new Clutter.Color(0, 0, 0, 255);
            stage.SetSize(512, 512);

            stage.Show();

            // Main declaration produces error:
            // Expression denotes a 'type', where a 'method group' was expected
            c.Main();

            return(0);
        }
Ejemplo n.º 12
0
 public LevelData()
 {
     brushes          = new Brush[0];
     lights           = new UFLevelStructure.Light[0];
     ambSounds        = new AmbSound[0];
     events           = new UFLevelStructure.Event[0];
     spawnPoints      = new SpawnPoint[0];
     particleEmitters = new UFLevelStructure.ParticleEmitter[0];
     pushRegions      = new PushRegion[0];
     decals           = new Decal[0];
     climbingRegions  = new ClimbingRegion[0];
     boltEmitters     = new BoltEmitter[0];
     targets          = new UFTransform[0];
     entities         = new Entity[0];
     items            = new Item[0];
     clutter          = new Clutter[0];
     triggers         = new Trigger[0];
     movingGeometry   = new Brush[0];
     movingGroups     = new MovingGroup[0];
     geoRegions       = new GeoRegion[0];
 }
Ejemplo n.º 13
0
        public static Clutter Crate(Vector2 position)
        {
            Clutter crate = new Clutter()
            {
                Sprite           = new AnimatedSprite(ModManager.Instance.AssetManager.LoadTexture2D(Globals.GraphicsDevice, "Crate"), 32, 32),
                idleAnimation    = new Animation(1, 1, 500),
                destroyAnimation = new Animation(1, 8, 500),
                animated         = true,
                pos              = position,
                draw_width       = 32,
                col_width        = 32,
                draw_height      = 32,
                col_height       = 27,
                collision_offset = new Vector2(0, 2),
                hp               = 3,
                dead             = false,
                shootable        = true,
                ignore_collision = false
            };

            return(crate);
        }
        protected override void CreateTexture(Clutter.CairoTexture texture, int with_state)
        {
            texture.Clear ();
            Cairo.Context context = texture.Create ();

            double lwidth = 1;
            double hlwidth = lwidth*0.5;
            double rotation = Math.PI*(3 - (double) sense) * 0.5;
            PointD center = new PointD(texture.Width*0.5, texture.Height*0.5);

            //Set the correct orientation:
            context.Translate(center.X, center.Y);
            context.Rotate(rotation);
            context.Translate(-center.X, -center.Y);

            //Draw border:
            context.MoveTo        (texture.Width*0.5, hlwidth);
            context.ArcNegative    (texture.Width,center.Y,(texture.Height-lwidth)/2,1.5*Math.PI,0.5*Math.PI);
            context.LineTo        (texture.Width*0.5, texture.Height-hlwidth);
            context.Arc            (texture.Width*0.5,center.Y,(texture.Height-lwidth)/2,0.5*Math.PI,1.5*Math.PI);
            context.ClosePath    ();
            context.LineWidth = lwidth;
            context.SetSourceRGBA(1.0,1.0,1.0, with_state==0 ? 0.4 : (with_state==1 ? 0.6 : 0.8));
            context.FillPreserve();
            context.SetSourceRGB(1.0,1.0,1.0);
            context.Stroke();

            //Draw arrow:
            context.MoveTo        (center.X, center.Y-texture.Height*0.25);
            context.LineTo        (center.X-texture.Height*0.25, center.Y);
            context.LineTo        (center.X, center.Y+texture.Height*0.25);
            context.LineWidth = lwidth*1.5;
            context.SetSourceRGB(0.0,0.0,0.0);
            context.Stroke();

            ((IDisposable) context.Target).Dispose();
            ((IDisposable) context).Dispose();
        }
        protected override void CreateActiveTexture(Clutter.CairoTexture texture, int with_state)
        {
            texture.Clear ();
            Cairo.Context context = texture.Create ();

            double lwidth = 1;
            double hlwidth = lwidth*0.5;

            //Draw outline rectangles:
            DrawSmallCovers (context, texture.Width, texture.Height, lwidth);

            //Draw stop icon:
            double dim = Math.Min (texture.Width*0.6 - hlwidth, texture.Height*0.6 - hlwidth);
            context.Rectangle (texture.Width*0.4, texture.Height*0.4, dim, dim);
            context.LineWidth = lwidth;
            double sat = (with_state==0 ? 0.4 : (with_state==1 ? 0.6 : 0.8));
            context.SetSourceRGBA (sat, sat, sat, 1.0);
            context.FillPreserve ();
            context.SetSourceRGB (1.0,1.0,1.0);
            context.Stroke ();

            ((IDisposable) context.Target).Dispose ();
            ((IDisposable) context).Dispose ();
        }
 private void HandleScroll(object o, Clutter.ScrolledArgs args)
 {
     var evnt = (ScrollEvent)Clutter.Event.GetEvent (((Clutter.Event)args.Args[0]).Handle);
     if (evnt.Direction == Clutter.ScrollDirection.Down
         || evnt.Direction == Clutter.ScrollDirection.Left) {
         Scroll (true);
     } else {
         Scroll (false);
     }
 }
Ejemplo n.º 17
0
        public RoomMaps()
        {
            Room    newroom;
            Enemy   newenemy;
            Door    newdoor;
            Clutter newclutter;

            // Room 2
            newroom = new Room(320, 160, new List <Enemy>(), new List <Door>(), 2, "Time Machine");
            newroom.doors.Add(BasicDoor(100, Directions.Left));

            newclutter = new Clutter() // Big hand graphic
            {
                is_big_hand      = true,
                Sprite           = new AnimatedSprite(ModManager.Instance.AssetManager.LoadTexture2D(Globals.GraphicsDevice, "Part2"), 32, 32),
                pos              = new Vector2(147, 54),
                draw             = false,
                ignore_collision = true,
                draw_height      = 200
            };
            newroom.clutters.Add(newclutter);
            newclutter = new Clutter() // Small hand graphic
            {
                is_small_hand    = true,
                Sprite           = new AnimatedSprite(ModManager.Instance.AssetManager.LoadTexture2D(Globals.GraphicsDevice, "Part1"), 32, 32),
                pos              = new Vector2(128, 37),
                draw             = false,
                ignore_collision = true,
                draw_height      = 200
            };
            newroom.clutters.Add(newclutter);

            newclutter = new Clutter() // Clock repairer
            {
                Sprite       = null,
                draw         = false,
                col_width    = 1,
                col_height   = 1,
                clock_repair = true,
                pos          = new Vector2(130, 60)
            };
            newroom.clutters.Add(newclutter);

            /*newroom.clutters.Add(new Clutter() // Cheat big hand
             * {
             *  Sprite = new AnimatedSprite(ModManager.Instance.AssetManager.LoadTexture2D(Globals.GraphicsDevice, "Part1icon"), 16, 16),
             *  pos = new Vector2(20, 20),
             *  collectable = true,
             *  ignore_collision = true,
             *  draw_height = 16,
             *  draw_width = 16,
             *  col_height = 16,
             *  col_width = 16,
             *  clock_handle = 1
             * });
             *
             * newroom.clutters.Add(new Clutter() // Cheat small hand
             * {
             *  Sprite = new AnimatedSprite(ModManager.Instance.AssetManager.LoadTexture2D(Globals.GraphicsDevice, "Part2icon"), 16, 16),
             *  pos = new Vector2(60, 20),
             *  collectable = true,
             *  ignore_collision = true,
             *  draw_height = 16,
             *  draw_width = 16,
             *  col_height = 16,
             *  col_width = 16,
             *  clock_handle = 2
             * });*/

            newclutter = new Clutter()
            {
                Sprite           = new AnimatedSprite(ModManager.Instance.AssetManager.LoadTexture2D(Globals.GraphicsDevice, "TimeMachine"), 128, 112),
                pos              = new Vector2(96, 0),
                draw_width       = 128,
                col_width        = 125,
                draw_height      = 110,
                col_height       = 15,
                collision_offset = new Vector2(0, 85),
                invulnerable     = true,
                hp               = 1,
                dead             = false,
                draw             = true,
                shootable        = true,
                ignore_collision = false
            };
            newroom.clutters.Add(newclutter);
            newroom.clutters.Add(FloorCollisionBox(96, 20, new Vector2(96, 128)));
            newroom.clutters.Add(FloorCollisionBox(1, 30, new Vector2(96, 100)));
            newroom.clutters.Add(FloorCollisionBox(1, 43, new Vector2(222, 100)));
            newroom.clutters.Add(CollisionBox(320, 24, Vector2.Zero));       // Back wall
            newroom.clutters.Add(CollisionBox(5, 180, new Vector2(306, 0))); //  right
            newroom.clutters.Add(CollisionBox(15, 70, Vector2.Zero));        // Top left
            newroom.clutters.Add(CollisionBox(15, 70, new Vector2(0, 114))); // bottom left
            rooms.Add(newroom);

            // Room 100
            newroom = new Room(320, 160, new List <Enemy>(), new List <Door>(), 100, "Caveman 1");
            newroom.doors.Add(BasicDoor(101, Directions.Left));                    // Left door
            newroom.doors.Add(BasicDoor(2, Directions.Right));                     // Right door
            newroom.enemies.Add(CaveMan(new Vector2(160, 90)));
            newroom.clutters.Add(CollisionBox(320, 30, Vector2.Zero));             // Back wall
            newroom.clutters.Add(CollisionBox(46, 70, Vector2.Zero));              // Top left
            newroom.clutters.Add(CollisionBox(46, 70, new Vector2(0, 114)));       // bottom left
            newroom.clutters.Add(CollisionBox(46, 70, new Vector2(274, 0)));       // Top right
            newroom.clutters.Add(CollisionBox(46, 70, new Vector2(274, 114)));     // bottom right
            newroom.clutters.Add(FloorCollisionBox(61, 15, new Vector2(82, 30)));  // Left bench
            newroom.clutters.Add(FloorCollisionBox(61, 15, new Vector2(177, 30))); // Right bench
            rooms.Add(newroom);

            // Room 101
            newroom = new Room(320, 160, new List <Enemy>(), new List <Door>(), 101, "Caveman 2");
            newroom.doors.Add(BasicDoor(102, Directions.Left));  // Left door
            newroom.doors.Add(BasicDoor(100, Directions.Right)); // Right door
            newroom.doors.Add(BasicDoor(106, Directions.Up));    // Top door
            newroom.enemies.Add(CaveMan(new Vector2(80, 60)));
            newroom.enemies.Add(CaveMan(new Vector2(80, 120)));
            newroom.clutters.Add(CollisionBox(140, 24, Vector2.Zero));             // Back wall 1
            newroom.clutters.Add(CollisionBox(140, 24, new Vector2(180, 0)));      // Back wall 2
            newroom.clutters.Add(CollisionBox(46, 70, Vector2.Zero));              // Top left
            newroom.clutters.Add(CollisionBox(46, 70, new Vector2(0, 114)));       // bottom left
            newroom.clutters.Add(CollisionBox(46, 70, new Vector2(274, 0)));       // Top right
            newroom.clutters.Add(CollisionBox(46, 70, new Vector2(274, 114)));     // bottom right
            newroom.clutters.Add(FloorCollisionBox(10, 15, new Vector2(66, 30)));  // Left washer
            newroom.clutters.Add(FloorCollisionBox(9, 15, new Vector2(114, 30)));  // Right washer
            newroom.clutters.Add(FloorCollisionBox(61, 15, new Vector2(193, 30))); // Right bench

            rooms.Add(newroom);

            // Room 102
            newroom = new Room(320, 160, new List <Enemy>(), new List <Door>(), 102, "Caveman 3");
            newroom.doors.Add(BasicDoor(103, Directions.Left));  // Left door
            newroom.doors.Add(BasicDoor(101, Directions.Right)); // Right door
            newdoor = new Door()
            {
                pos              = new Vector2(144, 0),
                draw_width       = 32,
                draw_height      = 32,
                col_width        = 8,
                col_height       = 30,
                collision_offset = new Vector2(11, 0),
                Sprite           = new AnimatedSprite(ModManager.Instance.AssetManager.LoadTexture2D(Globals.GraphicsDevice, "Door"), 32, 32), //todo animate this door, ?add lock symbol
                openAnimation    = new Animation(18, 18, 1),
                unlockAnimation  = new Animation(1, 18, 2000),
                closedAnimation  = new Animation(1, 1, 1),
                lockAnimation    = new Animation(1, 18, 2000),
                anim_is_fade     = false,
                next_room_id     = 107,
                next_posX        = 144,
                next_posY        = 110,
                ignore_collision = true,
                unlock_id        = 1,
                locked           = true,
                animated         = true,
                open_time        = 2
            };
            newroom.doors.Add(newdoor);
            newroom.doors.Add(BasicDoor(112, Directions.Down));                 // Bottom door
            newroom.clutters.Add(CollisionBox(127, 54, Vector2.Zero));          // Top left wall
            newroom.clutters.Add(CollisionBox(140, 54, new Vector2(193, 0)));   // Top right wall
            newroom.clutters.Add(CollisionBox(320, 24, Vector2.Zero));          // Back wall
            newroom.clutters.Add(CollisionBox(125, 42, new Vector2(0, 114)));   // Bottom left wall
            newroom.clutters.Add(CollisionBox(125, 42, new Vector2(193, 114))); // Bottom right wall
            rooms.Add(newroom);

            // Room 103 - Room where a button is hidden in a destructable crate
            newroom                  = new Room(320, 160, new List <Enemy>(), new List <Door>(), 103, "Caveman 4");
            newdoor                  = BasicDoor(104, Directions.Left, true);                                                                            // Left door
            newdoor.Sprite           = new AnimatedSprite(ModManager.Instance.AssetManager.LoadTexture2D(Globals.GraphicsDevice, "ForceField"), 16, 32); //todo animate this door
            newdoor.openAnimation    = new Animation(1, 7, 1000);
            newdoor.animated         = true;
            newdoor.anim_is_fade     = true;
            newdoor.draw             = true;
            newdoor.pos             += new Vector2(25, 8);
            newdoor.draw_if_unlocked = true;
            newdoor.open_time        = 1;
            newdoor.col_width        = 15;
            newroom.doors.Add(newdoor);
            newclutter = Button(new Vector2(55, 119), newdoor);
            var offset = new Vector2(10, 10);

            newclutter.pos += offset;
            newclutter.collision_offset -= offset;
            newroom.clutters.Add(newclutter);
            newroom.doors.Add(BasicDoor(102, Directions.Right));               // Right door
            newroom.clutters.Add(CollisionBox(320, 24, Vector2.Zero));         // Back wall
            newroom.clutters.Add(CollisionBox(46, 70, Vector2.Zero));          // Top left
            newroom.clutters.Add(CollisionBox(46, 70, new Vector2(0, 114)));   // bottom left
            newroom.clutters.Add(CollisionBox(46, 70, new Vector2(274, 0)));   // Top right
            newroom.clutters.Add(CollisionBox(46, 70, new Vector2(274, 114))); // bottom right
            newroom.clutters.Add(Crate(new Vector2(60, 30)));
            newroom.clutters.Add(Crate(new Vector2(100, 30)));
            newroom.clutters.Add(Crate(new Vector2(140, 30)));
            newroom.clutters.Add(Crate(new Vector2(180, 30)));
            newroom.clutters.Add(Crate(new Vector2(220, 30)));
            newroom.clutters.Add(Crate(new Vector2(60, 120)));
            newroom.clutters.Add(Crate(new Vector2(100, 120)));
            newroom.clutters.Add(Crate(new Vector2(140, 120)));
            newroom.clutters.Add(Crate(new Vector2(180, 120)));
            newroom.clutters.Add(Crate(new Vector2(220, 120)));

            rooms.Add(newroom);

            // Room 104
            newroom = new Room(320, 160, new List <Enemy>(), new List <Door>(), 104, "Caveman 5");
            newroom.doors.Add(BasicDoor(103, Directions.Right));
            newroom.doors.Add(BasicDoor(105, Directions.Left));
            newroom.doors.Add(BasicDoor(108, Directions.Up));
            newroom.doors.Add(BasicDoor(114, Directions.Down));
            newroom.clutters.Add(CollisionBox(142, 55, Vector2.Zero));          // Top left
            newroom.clutters.Add(CollisionBox(142, 55, new Vector2(0, 114)));   // bottom left
            newroom.clutters.Add(CollisionBox(142, 55, new Vector2(178, 0)));   // Top right
            newroom.clutters.Add(CollisionBox(142, 55, new Vector2(178, 114))); // bottom right
            rooms.Add(newroom);

            // Room 105
            newroom           = new Room(320, 160, new List <Enemy>(), new List <Door>(), 105, "Caveman 6");
            newroom.trap_room = true;
            newdoor           = TrapDoor(104, Directions.Right);
            newroom.trap_door = newdoor;
            newdoor.pos.Y    += 8;
            newroom.doors.Add(newdoor);    // Right door
            newroom.enemies.Add(CaveMan(new Vector2(80, 40)));
            newroom.enemies.Add(CaveMan(new Vector2(80, 80)));
            newroom.enemies.Add(CaveMan(new Vector2(80, 120)));
            newroom.enemies.Add(CaveMan(new Vector2(40, 40)));
            newroom.enemies.Add(CaveMan(new Vector2(40, 80)));
            newroom.enemies.Add(CaveMan(new Vector2(40, 120)));
            newroom.clutters.Add(CollisionBox(80, 72, new Vector2(242, 0))); //topright
            newroom.clutters.Add(CollisionBox(80, 80, new Vector2(242, 113)));
            newroom.clutters.Add(CollisionBox(320, 24, Vector2.Zero));       // Back wall
            newroom.clutters.Add(CollisionBox(15, 180, Vector2.Zero));       //  left wall
            newroom.clutters.Add(CollisionBox(320, 5, new Vector2(0, 146))); // bottom
            rooms.Add(newroom);

            // Room 106
            newroom           = new Room(320, 160, new List <Enemy>(), new List <Door>(), 106, "Caveman 7");
            newroom.trap_room = true;
            newdoor           = TrapDoor(101, Directions.Down);
            newroom.trap_door = newdoor;
            newroom.doors.Add(newdoor);  // Bottom door
            newenemy = RoomMaps.CaveMan();
            newenemy.SetPosCentre(160, 60);
            newroom.enemies.Add(newenemy);
            newroom.clutters.Add(CollisionBox(320, 39, Vector2.Zero));          // Back wall
            newroom.clutters.Add(CollisionBox(95, 180, Vector2.Zero));          //  left
            newroom.clutters.Add(CollisionBox(100, 180, new Vector2(224, 0)));  //  right
            newroom.clutters.Add(CollisionBox(142, 55, new Vector2(0, 130)));   // bottom left
            newroom.clutters.Add(CollisionBox(142, 55, new Vector2(178, 130))); // bottom right
            rooms.Add(newroom);

            // Room 107
            newroom            = new Room(320, 160, new List <Enemy>(), new List <Door>(), 107, "BOSS ROOM");
            newdoor            = BasicDoor(102, Directions.Down);
            newdoor.next_posY += 20;
            newroom.doors.Add(newdoor);
            newroom.enemies.Add(CaveBorg(new Vector2(160, 90)));
            newroom.trap_room = true;
            newdoor           = TrapDoor(109, Directions.Up);
            newroom.trap_door = newdoor;
            newroom.doors.Add(newdoor);
            newroom.clutters.Add(CollisionBox(140, 24, Vector2.Zero));         // Back wall 1
            newroom.clutters.Add(CollisionBox(140, 24, new Vector2(180, 0)));  // Back wall 2
            newroom.clutters.Add(CollisionBox(15, 180, Vector2.Zero));         //  left
            newroom.clutters.Add(CollisionBox(5, 180, new Vector2(306, 0)));   //  right
            newroom.clutters.Add(CollisionBox(142, 5, new Vector2(0, 146)));   // bottom left
            newroom.clutters.Add(CollisionBox(142, 5, new Vector2(178, 146))); // bottom right
            rooms.Add(newroom);

            // Room 108
            newroom = new Room(320, 160, new List <Enemy>(), new List <Door>(), 108, "Caveman 9");
            newroom.doors.Add(BasicDoor(104, Directions.Down));  // Bottom door
            newroom.enemies.Add(CaveMan(new Vector2(160, 120)));
            newroom.doors.Add(BasicDoor(110, Directions.Up));
            newroom.clutters.Add(CollisionBox(140, 24, Vector2.Zero));         // Back wall 1
            newroom.clutters.Add(CollisionBox(140, 24, new Vector2(180, 0)));  // Back wall 2
            newroom.clutters.Add(CollisionBox(15, 180, Vector2.Zero));         //  left
            newroom.clutters.Add(CollisionBox(5, 180, new Vector2(306, 0)));   //  right
            newroom.clutters.Add(CollisionBox(142, 5, new Vector2(0, 146)));   // bottom left
            newroom.clutters.Add(CollisionBox(142, 5, new Vector2(178, 146))); // bottom right
            newroom.enemies.Add(CaveMan(new Vector2(290, 40)));
            newroom.enemies.Add(CaveMan(new Vector2(290, 80)));
            newroom.enemies.Add(CaveMan(new Vector2(290, 120)));
            newroom.enemies.Add(CaveMan(new Vector2(40, 40)));
            newroom.enemies.Add(CaveMan(new Vector2(40, 80)));
            newroom.enemies.Add(CaveMan(new Vector2(40, 120)));
            rooms.Add(newroom);

            // Room 109
            newroom = new Room(320, 160, new List <Enemy>(), new List <Door>(), 109, "PRIZE ROOM");
            newroom.doors.Add(BasicDoor(107, Directions.Down));                 // Bottom door
            newroom.clutters.Add(CollisionBox(320, 39, Vector2.Zero));          // Back wall
            newroom.clutters.Add(CollisionBox(95, 180, Vector2.Zero));          //  left
            newroom.clutters.Add(CollisionBox(100, 180, new Vector2(224, 0)));  //  right
            newroom.clutters.Add(CollisionBox(142, 55, new Vector2(0, 130)));   // bottom left
            newroom.clutters.Add(CollisionBox(142, 55, new Vector2(178, 130))); // bottom right
            newroom.clutters.Add(new Clutter()
            {
                Sprite           = new AnimatedSprite(ModManager.Instance.AssetManager.LoadTexture2D(Globals.GraphicsDevice, "Part1icon"), 16, 16),
                pos              = new Vector2(150, 70),
                collectable      = true,
                ignore_collision = true,
                draw_height      = 16,
                draw_width       = 16,
                col_height       = 16,
                col_width        = 16,
                clock_handle     = 1
            });
            rooms.Add(newroom);

            // Room 110
            newroom = new Room(320, 160, new List <Enemy>(), new List <Door>(), 110, "KEY ROOM");
            newroom.doors.Add(BasicDoor(108, Directions.Down));                 // Bottom door
            newroom.clutters.Add(CollisionBox(320, 39, Vector2.Zero));          // Back wall
            newroom.clutters.Add(CollisionBox(95, 180, Vector2.Zero));          //  left
            newroom.clutters.Add(CollisionBox(100, 180, new Vector2(224, 0)));  //  right
            newroom.clutters.Add(CollisionBox(142, 55, new Vector2(0, 130)));   // bottom left
            newroom.clutters.Add(CollisionBox(142, 55, new Vector2(178, 130))); // bottom right
            newroom.clutters.Add(Key(new Vector2(150, 70), 1));

            rooms.Add(newroom);

            // Room 111
            newroom = new Room(320, 160, new List <Enemy>(), new List <Door>(), 111, "PASSWORD ROOM");
            newroom.clutters.Add(new Clutter() // Cheat small hand
            {
                Sprite           = new AnimatedSprite(ModManager.Instance.AssetManager.LoadTexture2D(Globals.GraphicsDevice, "Part2icon"), 16, 16),
                pos              = new Vector2(150, 70),
                collectable      = true,
                ignore_collision = true,
                draw_height      = 16,
                draw_width       = 16,
                col_height       = 16,
                col_width        = 16,
                clock_handle     = 2
            });
            newroom.doors.Add(BasicDoor(115, Directions.Down));                 // Bottom door
            newroom.clutters.Add(CollisionBox(320, 39, Vector2.Zero));          // Back wall
            newroom.clutters.Add(CollisionBox(95, 180, Vector2.Zero));          //  left
            newroom.clutters.Add(CollisionBox(100, 180, new Vector2(224, 0)));  //  right
            newroom.clutters.Add(CollisionBox(142, 55, new Vector2(0, 130)));   // bottom left
            newroom.clutters.Add(CollisionBox(142, 55, new Vector2(178, 130))); // bottom right
            rooms.Add(newroom);

            // Room 112
            newroom = new Room(320, 160, new List <Enemy>(), new List <Door>(), 112, "Caveman 9");
            newroom.doors.Add(BasicDoor(113, Directions.Left));
            newdoor            = BasicDoor(102, Directions.Up);
            newdoor.col_width += 5;
            newroom.doors.Add(newdoor);
            newdoor            = BasicDoor(116, Directions.Down);
            newdoor.col_width += 5;
            newroom.doors.Add(newdoor);
            newroom.enemies.Add(Cyborg(new Vector2(165, 110)));
            newroom.clutters.Add(CollisionBox(142, 55, Vector2.Zero));         // Top left
            newroom.clutters.Add(CollisionBox(142, 55, new Vector2(0, 114)));  // bottom left
            newroom.clutters.Add(CollisionBox(142, 180, new Vector2(194, 0))); // Top right
            rooms.Add(newroom);

            // Room 113
            newroom           = new Room(320, 160, new List <Enemy>(), new List <Door>(), 113, "Caveman 10");
            newroom.trap_room = true;
            newdoor           = TrapDoor(112, Directions.Right);
            newroom.trap_door = newdoor;
            newdoor.pos.Y    += 8;
            newroom.doors.Add(newdoor);    // Right door
            newenemy = RoomMaps.Cyborg();
            newenemy.SetPosCentre(80, 40);
            newroom.enemies.Add(newenemy);
            newenemy = RoomMaps.Cyborg();
            newenemy.SetPosCentre(80, 80);
            newroom.enemies.Add(newenemy);
            newenemy = RoomMaps.Cyborg();
            newenemy.SetPosCentre(80, 120);
            newroom.enemies.Add(newenemy);
            newroom.clutters.Add(CollisionBox(80, 72, new Vector2(242, 0))); //topright
            newroom.clutters.Add(CollisionBox(80, 80, new Vector2(242, 113)));
            newroom.clutters.Add(CollisionBox(320, 24, Vector2.Zero));       // Back wall
            newroom.clutters.Add(CollisionBox(15, 180, Vector2.Zero));       //  left wall
            newroom.clutters.Add(CollisionBox(320, 5, new Vector2(0, 146))); // bottom
            rooms.Add(newroom);

            // Room 114
            newroom           = new Room(320, 160, new List <Enemy>(), new List <Door>(), 114, "Caveman 11");
            newroom.trap_room = true;
            newdoor           = TrapDoor(104, Directions.Up);
            newroom.trap_door = newdoor;
            newroom.doors.Add(newdoor);  // Top door
            newroom.enemies.Add(CaveMan(new Vector2(160, 90)));
            newroom.enemies.Add(CaveMan(new Vector2(160, 115)));
            newroom.clutters.Add(CollisionBox(320, 39, new Vector2(0, 130)));  // Back wall
            newroom.clutters.Add(CollisionBox(95, 180, Vector2.Zero));         //  left
            newroom.clutters.Add(CollisionBox(100, 180, new Vector2(224, 0))); //  right
            newroom.clutters.Add(CollisionBox(142, 39, new Vector2(0, 0)));    // top left
            newroom.clutters.Add(CollisionBox(142, 39, new Vector2(178, 0)));  // top right
            rooms.Add(newroom);

            // Room 115
            newroom = new Room(320, 160, new List <Enemy>(), new List <Door>(), 115, "Caveman 12");
            newroom.doors.Add(BasicDoor(116, Directions.Left)); // Left door
            newdoor           = TrapDoor(111, Directions.Up);
            newroom.trap_room = true;
            newroom.trap_door = newdoor;
            newroom.doors.Add(newdoor);
            newroom.clutters.Add(CollisionBox(140, 24, Vector2.Zero));        // Back wall 1
            newroom.clutters.Add(CollisionBox(140, 24, new Vector2(180, 0))); // Back wall 2
            newroom.clutters.Add(CollisionBox(46, 70, Vector2.Zero));         // Top left
            newroom.clutters.Add(CollisionBox(46, 70, new Vector2(0, 114)));  // bottom left
            newroom.clutters.Add(CollisionBox(46, 180, new Vector2(274, 0))); // Top right
            newroom.enemies.Add(CaveBorg(new Vector2(240, 90)));
            rooms.Add(newroom);

            // Room 116
            newroom = new Room(320, 160, new List <Enemy>(), new List <Door>(), 116, "Caveman 13");
            newroom.doors.Add(BasicDoor(117, Directions.Down));  // Bottom door
            newroom.doors.Add(BasicDoor(112, Directions.Up));
            newroom.doors.Add(BasicDoor(115, Directions.Right));
            newroom.clutters.Add(CollisionBox(140, 24, Vector2.Zero));         // Back wall 1
            newroom.clutters.Add(CollisionBox(140, 24, new Vector2(180, 0)));  // Back wall 2
            newroom.clutters.Add(CollisionBox(15, 180, Vector2.Zero));         //  left
            newroom.clutters.Add(CollisionBox(46, 70, new Vector2(306, 0)));   // Top right
            newroom.clutters.Add(CollisionBox(46, 70, new Vector2(306, 99)));  // bottom right
            newroom.clutters.Add(CollisionBox(142, 5, new Vector2(0, 146)));   // bottom left
            newroom.clutters.Add(CollisionBox(142, 5, new Vector2(178, 146))); // bottom right
            newroom.enemies.Add(Cyborg(new Vector2(40, 85)));
            newroom.enemies.Add(Cyborg(new Vector2(280, 85)));
            rooms.Add(newroom);

            // Room 117
            newroom           = new Room(320, 160, new List <Enemy>(), new List <Door>(), 117, "Caveman 14");
            newroom.trap_room = true;
            newdoor           = TrapDoor(116, Directions.Up);
            newroom.trap_door = newdoor;
            newroom.doors.Add(newdoor);  // Bottom door
            newroom.enemies.Add(CaveMan(new Vector2(130, 120)));
            newroom.enemies.Add(CaveMan(new Vector2(190, 120)));
            newroom.clutters.Add(CollisionBox(320, 39, new Vector2(0, 130)));  // Back wall
            newroom.clutters.Add(CollisionBox(95, 180, Vector2.Zero));         //  left
            newroom.clutters.Add(CollisionBox(100, 180, new Vector2(224, 0))); //  right
            newroom.clutters.Add(CollisionBox(142, 39, new Vector2(0, 0)));    // top left
            newroom.clutters.Add(CollisionBox(142, 39, new Vector2(178, 0)));  // top right
            rooms.Add(newroom);
        }
 void HandleParentSet(object o, Clutter.ParentSetArgs args)
 {
     if (this.Stage != null) {
         if (delayed_shade_swap) SetShadeSwap ();
         //if (delayed_cover_swap) SetCoverSwap ();
     }
 }
 private void HandleScroll(object o, Clutter.ScrollEventArgs args)
 {
     if (args.Event.Direction==Clutter.ScrollDirection.Down)
         Scroll(true);
     else
         Scroll(false);
 }
 protected override void CreatePassiveTexture(Clutter.CairoTexture texture, int with_state)
 {
     Render (texture, with_state, true);
 }
        protected void HandleMotionEvent(object o, Clutter.MotionArgs args)
        {
            float x1; float y1;
            args.Event.GetCoords (out x1, out y1);

            float tx; float ty;
            GetTransformedPosition (out tx, out ty);

            if (x1 <=  tx+Width && x1 >= tx && (args.Event.State & ModifierType.Button1Mask)!=0 && (button.State & 2)!=0) {
                float deltaX = (x1 - mouseX);
                SetValueSilently (posval + (deltaX / (width - height)));
            }
            mouseX = x1;
            args.RetVal = true;
        }
 public static void RemoveFromGroup(System.IntPtr group, Clutter.Actor actor)
 {
     GC.SuppressFinalize (actor);
     clutter_container_remove (group, actor.Handle);
 }
 private void HandleButtonPressEvent(object o, Clutter.ButtonPressedArgs args)
 {
     args.Event.GetCoords (out drag_x0, out drag_y0);
     args.RetVal = true;
 }
 protected abstract void CreatePassiveTexture(Clutter.CairoTexture texture, int with_state);
Ejemplo n.º 25
0
 public ScrollActor(Clutter.Color color, int scroll_offset)
     : base(color)
 {
     this.scroll_offset = scroll_offset;
     Reactive = true;
 }
Ejemplo n.º 26
0
 public ScrollActor(Clutter.Color color)
     : this(color, 20)
 {
 }
        private void Render(Clutter.CairoTexture texture, int with_state, bool outwards)
        {
            texture.Clear ();
            Cairo.Context context = texture.Create ();

            double alpha_f = with_state == 0 ? 0.5 : (with_state == 1 ? 0.8 : 1);

            double lwidth = 1;
            double hlwidth = lwidth*0.5;
            context.LineWidth = lwidth;

            if (outwards) {
                context.MoveTo (texture.Width*0.5-texture.Height*0.45, texture.Height*0.9);
                context.CurveTo (texture.Width*0.3, texture.Height, texture.Width*0.6, texture.Height, texture.Width*0.5+texture.Height*0.45, texture.Height*0.9);
                context.ArcNegative (texture.Width*0.5, texture.Height*0.9, texture.Height*0.45, 0, Math.PI);
                context.ClosePath ();
                Gradient g1 = new LinearGradient (0, texture.Height/2, 0, texture.Height);
                g1.AddColorStop (0, new Cairo.Color (0.6, 0.6, 0.6, 1.0*alpha_f));
                g1.AddColorStop (1.0, new Cairo.Color (1.0, 1.0, 1.0, 1.0*alpha_f));
                context.Pattern = g1;
                context.FillPreserve ();
                context.SetSourceRGBA (1.0, 1.0, 1.0, 1.0*alpha_f);
                context.Stroke ();
                ((IDisposable) g1).Dispose ();

                context.Arc (Width*0.5, Height*0.33+lwidth, Height*0.33, 0, Math.PI*2);
                context.ClosePath ();
                context.Operator = Operator.Source;
                Gradient g2 = new RadialGradient (texture.Width*0.5, texture.Height*0.25, 0, texture.Width*0.5, texture.Height*0.25, texture.Width*0.5);
                g2.AddColorStop (0, new Cairo.Color (1.0, 1.0, 1.0, 1.0*alpha_f));
                g2.AddColorStop (1.0, new Cairo.Color (0.6, 0.6, 0.6, 1.0*alpha_f));
                context.Pattern = g2;
                //context.SetSourceRGBA (1.0, 1.0, 1.0, 1.0*alpha_f);
                context.FillPreserve ();
                Gradient g3 = new LinearGradient (0, 0, 0, texture.Height*0.5);
                g3.AddColorStop (0, new Cairo.Color (1.0, 1.0, 1.0, 1.0*alpha_f));
                g3.AddColorStop (1.0, new Cairo.Color (0, 0, 0, 1.0*alpha_f));
                context.Pattern = g3;
                //context.SetSourceRGBA (1.0, 1.0, 1.0, 1.0*alpha_f);
                context.Stroke ();
                ((IDisposable) g2).Dispose ();
                ((IDisposable) g3).Dispose ();

            } else {
                Cairo.PointD c = new Cairo.PointD (texture.Width*0.5, texture.Height*0.5);
                double max_r = Math.Min (c.X, c.Y) - hlwidth;

                context.Arc (c.X, c.Y, max_r, 0, Math.PI*2);
                context.ArcNegative (c.X, c.Y, max_r*0.25, Math.PI*2, 0);
                context.ClosePath ();
                context.SetSourceRGBA (0.5, 0.5, 0.5, 1.0*alpha_f);
                context.StrokePreserve ();
                Gradient g1 = new LinearGradient (0, texture.Height, texture.Width, 0);
                g1.AddColorStop(0, new Cairo.Color (1.0, 1.0, 1.0, 1.0*alpha_f));
                g1.AddColorStop(0.5, new Cairo.Color (0.7, 0.7, 0.7, 1.0*alpha_f));
                g1.AddColorStop(1, new Cairo.Color (0.9, 0.9, 0.9, 1.0*alpha_f));
                context.Pattern = g1;
                context.Fill ();
                ((IDisposable) g1).Dispose ();

                context.ArcNegative (c.X, c.Y, max_r*0.25+lwidth, Math.PI*1.75, Math.PI*0.75);
                context.Arc (c.X, c.Y, max_r, Math.PI*0.75, Math.PI*1.75);
                context.ClosePath ();
                Gradient g2 = new LinearGradient (c.X, c.Y, c.X*0.35, c.Y*0.35);
                g2.AddColorStop(0, new Cairo.Color (1.0, 1.0, 1.0, 1.0*alpha_f));
                g2.AddColorStop(1, new Cairo.Color (1.0, 1.0, 1.0, 0.0));
                context.Pattern = g2;
                context.Fill ();
                ((IDisposable) g2).Dispose ();

                context.ArcNegative (c.X, c.Y, max_r*0.25+lwidth, Math.PI*2, 0);
                context.Arc (c.X, c.Y, max_r*0.45, 0, Math.PI*2);
                context.SetSourceRGBA (1.0, 1.0, 1.0, 0.8*alpha_f);
                context.Fill ();

                context.Arc (c.X, c.Y, max_r-lwidth, 0, Math.PI*2);
                Gradient g3 = new LinearGradient (0, texture.Height, texture.Width, 0);
                g3.AddColorStop(0, new Cairo.Color (1.0, 1.0, 1.0, 0.0));
                g3.AddColorStop(1, new Cairo.Color (0.9, 0.9, 0.9, 1.0*alpha_f));
                context.Pattern = g3;
                context.Stroke ();
                ((IDisposable) g3).Dispose ();
            }

            ((IDisposable) context.Target).Dispose ();
            ((IDisposable) context).Dispose ();
        }
        private void HandleMotionEvent(object o, Clutter.MotionArgs args)
        {
            if ((args.Event.State & Clutter.ModifierType.Button1Mask) != 0) {
                float drag_x; float drag_y;
                args.Event.GetCoords (out drag_x, out drag_y);
                if (!dragging) {
                    if (Math.Abs(drag_x0 - drag_x) > 2 && Math.Abs(drag_y0 - drag_y) > 2) {
                        start_index = CoverManager.TargetIndex;
                        Clutter.Global.GrabPointer (Stage);
                        dragging = true;
                    }
                } else {
                    if ((args.Event.State & Clutter.ModifierType.ControlMask)!=0) {
                        if (!dragging) {
                            Clutter.Global.GrabPointer (Stage);
                        }
                        ViewportAngleY += (float) (mouse_x - ((MotionEvent)args.Event).X)*rotSens;
                        ViewportAngleX += (float) (mouse_y - ((MotionEvent)args.Event).Y)*rotSens;
                    } else {
                        CoverManager.TargetIndex = start_index + (int) ((drag_x0 - drag_x)*drag_sens);
                    }
                }
            } else {
                if (dragging) {
                    Clutter.Global.UngrabPointer ();
                }
                dragging = false;
            }
            mouse_x = ((MotionEvent)Clutter.Event.GetEvent(args.Event.Handle)).X;
            mouse_y = ((MotionEvent)Clutter.Event.GetEvent(args.Event.Handle)).Y;

            args.RetVal = dragging;
        }
 private void HandleButtonPressEvent(object o, Clutter.ButtonPressEventArgs args)
 {
     Clutter.EventHelper.GetCoords (args.Event, out drag_x0, out drag_y0);
     args.RetVal = true;
 }
 protected override void CreateActiveTexture(Clutter.CairoTexture texture, int with_state)
 {
     Render (texture, with_state, false);
 }
 void HandleButtonReleaseEvent(object o, Clutter.ButtonReleaseEventArgs args)
 {
     //if (args.Event.Button==1 && !dragging  && coverManager.CurrentCover!=null && ActiveAlbum != CurrentAlbum)
     //	UpdateAlbum ();
     if (dragging) Clutter.Ungrab.Pointer ();
     dragging = false;
     args.RetVal = true;
 }
        private void HandleMotionEvent(object o, Clutter.MotionEventArgs args)
        {
            if ((args.Event.ModifierState.value__ & Clutter.ModifierType.Button1Mask.value__)!=0) {
                float drag_x; float drag_y;
                Clutter.EventHelper.GetCoords (args.Event, out drag_x, out drag_y);
                if (!dragging) {
                    if (Math.Abs(drag_x0 - drag_x) > 2 && Math.Abs(drag_y0 - drag_y) > 2) {
                        start_index = CoverManager.TargetIndex;
                        Clutter.Grab.Pointer (Stage);
                        dragging = true;
                    }
                } else {
                    if ((args.Event.ModifierState.value__ & Clutter.ModifierType.ControlMask.value__)!=0) {
                        if (!dragging) Clutter.Grab.Pointer (Stage);
                        ViewportAngleY += (float) (mouse_x - args.Event.X)*rotSens;
                        ViewportAngleX += (float) (mouse_y - args.Event.Y)*rotSens;
                    } else {
                        CoverManager.TargetIndex = start_index + (int) ((drag_x0 - drag_x)*drag_sens);
                    }
                }
            } else {
                if (dragging) Clutter.Ungrab.Pointer ();
                dragging = false;
            }
            mouse_x = args.Event.X;
            mouse_y = args.Event.Y;

            args.RetVal = dragging;
        }
 public static void DestroyActor(Clutter.Actor actor)
 {
     GC.SuppressFinalize (actor);
     clutter_actor_destroy (actor.Handle);
 }