Example #1
0
        protected override Entity CreateItemEntity(ITile item)
        {
            var img = new TileImage(this.blocks, item, new Vector2(this.blocks.TileSize * 2, this.blocks.TileSize * 2), anchor: Anchor.AutoInline);

            img.Scale = 2f;
            return(img);
        }
Example #2
0
 public void ChooseColour()
 {
     if (MemoryGame.bUseColour)
     {
         if (tileImage != null)
         {
             Material newMat = ColourStash.instance.GetRandomMaterial().customMat;
             if (newMat != null)
             {
                 colourMaterial = newMat;
             }
         }
         else
         {
             Debug.Log("tileImage null");
         }
     }
     else
     {
         if (maskedImage != null)
         {
             TileImage data = ColourStash.instance.GetRandomMaterial().tileImageData;
             if (data != null)
             {
                 colouredSprite = data.tileSprite;
             }
         }
         else
         {
             Debug.Log("TileImage DATA null");
         }
     }
 }
Example #3
0
        public static TileImage CreateTileImage(GameObject parentGameObject, MapReader.Map mapData, MapReader.Layer layer, int tileIndex, int fringeSize = 0)
        {
            int tileID = layer.Data[tileIndex];

            TileImage image = CreateTileImageOfTileID(parentGameObject, mapData, tileID, fringeSize);

            MapReader.Tileset tileset = GetTilesetFromTileID(tileID, mapData.Tilesets);
            image.tileIndex = tileIndex;

            int yTilePos = (tileIndex / mapData.Width) * tileset.TileHeight;
            int xTilePos = (tileIndex % mapData.Width) * tileset.TileWidth;

            Vector3 position = new Vector3(xTilePos, -yTilePos, Game_bottomMapLayerDepth);

            if (layer.Name.Split(',').Length > 1)
            {
                float.TryParse(layer.Name.Split(',')[1], out position.z);
                //position.z += Game_bottomMapLayerDepth;
            }


            //print("position z: " + position.z);

            image.transform.localPosition = new Vector3(position.x, (position.y), (position.y * Game_depthDivision) + position.z);

            return(image);
        }
Example #4
0
        public static void Main()
        {
            DisplayControl     dc           = new DisplayControl();
            int                height       = dc.ShorterSide;
            int                width        = dc.LongerSide;
            int                delayBetween = 1100;
            DisplayOrientation orientation  = (DisplayOrientation)dc.Orientation;

            Bitmap fullScreenBitmap = new Bitmap(width, height);    // Use this bitmap as our buffered output to the screen.

            fullScreenBitmap.Clear();

            Font DisplayFont = Resource.GetFont(Resource.FontResources.SegoeUIRegular12);

            while (true)
            {
                RandomDrawLine rdlt = new RandomDrawLine(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                RotateImage ri = new RotateImage(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                ColourGradient colourGradient = new ColourGradient(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                Colours ColourExample = new Colours(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                PagedText pt = new PagedText(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                BouncingBalls bb = new BouncingBalls(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                TileImage ti = new TileImage(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                StretchImage si = new StretchImage(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                SetPixels sp = new SetPixels(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                FontExamples fe = new FontExamples(fullScreenBitmap);
                Thread.Sleep(delayBetween);

                RandomRectangles rr = new RandomRectangles(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                SliceScaling9 ss = new SliceScaling9(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                RandomClipping rc = new RandomClipping(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                MatrixRain mr = new MatrixRain(fullScreenBitmap);
                Thread.Sleep(Timeout.Infinite);
            }
        }
Example #5
0
        public static void Main()
        {
            int delayBetween = 1100;


            // Get full screen bitmap from displayControl to draw on.
            Bitmap fullScreenBitmap = DisplayControl.FullScreen;

            fullScreenBitmap.Clear();

            Font DisplayFont = Resource.GetFont(Resource.FontResources.SegoeUIRegular12);

            while (true)
            {
                RandomDrawLine rdlt = new RandomDrawLine(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                RotateImage ri = new RotateImage(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                ColourGradient colourGradient = new ColourGradient(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                Colours ColourExample = new Colours(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                PagedText pt = new PagedText(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                BouncingBalls bb = new BouncingBalls(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                TileImage ti = new TileImage(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                StretchImage si = new StretchImage(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                SetPixels sp = new SetPixels(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                FontExamples fe = new FontExamples(fullScreenBitmap);
                Thread.Sleep(delayBetween);

                RandomRectangles rr = new RandomRectangles(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                SliceScaling9 ss = new SliceScaling9(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                RandomClipping rc = new RandomClipping(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                MatrixRain mr = new MatrixRain(fullScreenBitmap);
                Thread.Sleep(Timeout.Infinite);
            }
        }
Example #6
0
        public void CreateTile()
        {
            int       x        = 1;
            int       y        = 1;
            int       z        = 1;
            string    fileName = "c:\\temp\\000.png";
            TileImage t        = new TileImage(x, y, z, fileName);

            Assert.AreEqual(1, t.X);
        }
Example #7
0
        public static void Main()
        {
            DisplayControl dc           = new DisplayControl();
            int            height       = dc.ShorterSide;
            int            width        = dc.LongerSide;
            int            bpp          = dc.BitsPerPixel;
            int            delayBetween = 3000;

            Bitmap fullScreenBitmap = new Bitmap(width, height);                            // Use this bitmap as our output to the screen.

            fullScreenBitmap.Clear();
            fullScreenBitmap.Flush();
            DisplayOrientation orientation = (DisplayOrientation)dc.Orientation;
            Font DisplayFont = Resource.GetFont(Resource.FontResources.SegoeUIRegular12);

            while (true)
            {
                SetPixels sp = new SetPixels(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                FontExamples fe = new FontExamples(fullScreenBitmap);
                Thread.Sleep(delayBetween);

                StretchImage si = new StretchImage(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                RandomDrawLine rdlt = new RandomDrawLine(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                TileImage ti = new TileImage(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                RandomEllipses re = new RandomEllipses(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                RandomRectangles rr = new RandomRectangles(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                SliceScaling9 ss = new SliceScaling9(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                RotateImage ri = new RotateImage(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                RandomClipping rc = new RandomClipping(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                MatrixRain mr = new MatrixRain(fullScreenBitmap, DisplayFont);
                Thread.Sleep(Timeout.Infinite);
            }
        }
Example #8
0
        public void Serialization_IsConsistent()
        {
            // Arrange
            TileImage image = new TileImage
            {
                Id            = 1,
                Src           = "Src",
                Alt           = "Alt",
                AddImageQuery = true
            };

            // Assert
            SerializationAssert.VerifySerialization(image, "{\"id\":1,\"src\":\"Src\",\"alt\":\"Alt\",\"addImageQuery\":true}");
        }
        public void Serialization_IsConsistent()
        {
            // Arrange
            TileImage image = new TileImage
            {
                Id = 1,
                Src = "Src",
                Alt = "Alt",
                AddImageQuery = true
            };

            // Assert
            SerializationAssert.VerifySerialization(image, "{\"id\":1,\"src\":\"Src\",\"alt\":\"Alt\",\"addImageQuery\":true}");
        }
Example #10
0
        private void FullItem_Click(object sender, EventArgs e)
        {
            Point ul = Point.Empty;
            Point ur = new Point(_tile.Width - 1, 0);
            Point lr = new Point(_tile.Width - 1, _tile.Height - 1);
            Point ll = new Point(0, _tile.Height - 1);

            _tile.Obstructions.Clear();
            _tile.Obstructions.Add(new Line(ul, ur));
            _tile.Obstructions.Add(new Line(ur, lr));
            _tile.Obstructions.Add(new Line(ll, lr));
            _tile.Obstructions.Add(new Line(ul, ll));
            TileImage.Refresh();
        }
Example #11
0
    private List <MapTile> getVisibleTiles()
    {
        float[]        bounds = viewRectToLatLng(latitude, longitude, zoom);
        int[]          tl     = mercator.latLonToTile(-bounds[0], bounds[1], zoom);
        int[]          br     = mercator.latLonToTile(-bounds[2], bounds[3], zoom);
        List <MapTile> tmp    = new List <MapTile>();

        for (int i = tl[0]; i <= br[0]; i++)
        {
            for (int j = tl[1]; j <= br[1]; j++)
            {
                string key = mercator.tileXYToQuadKey(i, j, zoom);

                bool exist = false;
                foreach (MapTile tile in tiles)
                {
                    if (key == tile.quadKey)
                    {
                        tmp.Add(tile);
                        exist = true;
                    }
                }

                if (!exist)
                {
                    MapTile tile;

                    if (parent.vectorTiles)
                    {
                        tile = new TileVector(this, key);
                    }
                    else if (parent.tilesElevetion)
                    {
                        tile = new TileElevation(this, key);
                    }
                    else
                    {
                        tile = new TileImage(this, key);
                    }

                    tileLoader.addTile(tile);
                    tiles.Add(tile);
                    keys.Add(key);
                }
            }
        }
        return(tmp);
    }
Example #12
0
        public TestScene()
        {
            /*p0 = new Position(6, 25);
             * p1 = new Position(15, 13);
             * p2 = new Position(25, 26);
             * p3 = new Position(35, 13);*/

            p0 = new Position(6, 25);
            p1 = new Position(6, 6);
            p2 = new Position(16, 6);
            p3 = new Position(26, 6);

            img = TileImageLoader.LoadImage("test");

            testMapping.SetBinding("ActionDown", new KeyBinding(Key.J));
        }
Example #13
0
 private void TileImage_MouseMove(object sender, MouseEventArgs e)
 {
     if (_paint)
     {
         last_x = cur_x;
         last_y = cur_y;
         cur_x  = e.X / _zoom;
         cur_y  = e.Y / _zoom;
         if (cur_x != last_x || cur_y != last_y)
         {
             _end_loc.X = e.X / _zoom;
             _end_loc.Y = e.Y / _zoom;
             TileImage.Refresh();
         }
     }
 }
Example #14
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Id != null?Id.GetHashCode() : 0;

                hashCode = hashCode * 397 ^ (Title != null ? Title.GetHashCode() : 0);
                hashCode = hashCode * 397 ^ (Body != null ? Body.GetHashCode() : 0);
                hashCode = hashCode * 397 ^ (Image != null ? Image.GetHashCode() : 0);
                hashCode = hashCode * 397 ^ (TileImage != null ? TileImage.GetHashCode() : 0);
                hashCode = hashCode * 397 ^ Hidden.GetHashCode();
                hashCode = hashCode * 397 ^ Spotlight.GetHashCode();
                hashCode = hashCode * 397 ^ (Type != null ? Type.GetHashCode() : 0);
                hashCode = hashCode * 397 ^ (EntryType != null ? EntryType.GetHashCode() : 0);
                return(hashCode);
            }
        }
Example #15
0
        public static TileImage CreateTileImageOfTileID(GameObject parentGameObject, MapReader.Map mapData, int tileID, int fringeSize = 0)
        {
            MapReader.Tileset tileset = GetTilesetFromTileID(tileID, mapData.Tilesets);
            int imageTileIndex        = tileID - tileset.FirstGID;

            int imageWidthInTiles  = tileset.Images[0].Width / tileset.TileWidth;
            int imageHeightInTiles = tileset.Images[0].Height / tileset.TileHeight;


            int yTileIndex = imageTileIndex / imageWidthInTiles;
            int xTileIndex = imageTileIndex % imageWidthInTiles;


            //print("TileIndex: " + yTileIndex + " " + xTileIndex);

            Texture2D texture2D = LoadTilePNG(tileset.Images[0].Source);

            //calc tile offset

            float u0 = (xTileIndex * tileset.TileWidth) - fringeSize;
            float v0 = (((imageHeightInTiles - 1) - yTileIndex) * tileset.TileHeight) - fringeSize;// WHY

            int   doubleFringe = fringeSize << 1;
            float u1           = (u0 + tileset.TileWidth) + doubleFringe;
            float v1           = (v0 + tileset.TileHeight) + doubleFringe;

            u0 /= tileset.Images[0].Width;
            v0 /= tileset.Images[0].Height;
            u1 /= tileset.Images[0].Width;
            v1 /= tileset.Images[0].Height;


            //print("tileset.Images[0]: " + tileset.Images[0].Width + " " + tileset.Images[0].Height);
            //print("tileset.TileWidth: " + tileset.TileWidth + " " + tileset.TileHeight);
            //print("UV: " + u0 + " " + v0 + " " + u1 + " " + v1);

            int       fullWidth  = tileset.TileWidth + doubleFringe;
            int       fullHeight = tileset.TileHeight + doubleFringe;
            TileImage image      = Image.CreateImage <TileImage>(parentGameObject.transform, texture2D, fullWidth, fullHeight, u0, v0, u1, v1);

            image.width   = fullWidth;
            image.height  = fullHeight;
            image.tileset = tileset;
            image.tileID  = tileID;
            return(image);
        }
Example #16
0
        public static LayerRenderer CreateRenderedLayerObject(GameObject mapObject, MapReader.Map mapData, MapReader.Layer layer, int fringeSize = 0)
        {
            LayerRenderer renderedLayer = new LayerRenderer();

            renderedLayer.goLayer = new GameObject("Layer " + layer.Name);
            renderedLayer.goLayer.transform.SetParent(mapObject.transform);
            renderedLayer.tileImages = new TileImage[layer.Data.Length];
            for (int i = 0; i < layer.Data.Length; i++)
            {
                renderedLayer.tileImages[i] = TileImage.CreateTileImage(renderedLayer.goLayer, mapData, layer, i, fringeSize);
            }

            renderedLayer.layer  = layer;
            renderedLayer.width  = mapData.Width;
            renderedLayer.height = mapData.Height;
            return(renderedLayer);
        }
Example #17
0
    public static void Setup()
    {
        TileImage asset = ScriptableObject.CreateInstance <TileImage>();

        SerializedObject info = new SerializedObject(asset);

        AssetDatabase.CreateAsset(asset, "Assets/ScriptableObjects/TileImageData.asset");

        //asset.tileSprite = info.FindProperty("rows").;

        AssetDatabase.SaveAssets();

        EditorUtility.FocusProjectWindow();

        Selection.activeObject = asset;

        EditorUtility.SetDirty(asset);
    }
        //TODO (CR May 2010): we could simplify the mouse and cursor handling by putting it in the mousehelper.
        private void OnCursorChanged(AppServiceReference.Cursor cursor)
        {
            ServerEntity.Cursor = cursor ?? new AppServiceReference.Cursor();
            if (!_mouseInside)
            {
                _serverCursorImage.Source = null;
                ApplicationRootVisual.Children.Remove(_serverCursorImage);
            }
            else
            {
                var theTilePoint = new Point((double)ServerEntity.MousePosition.X - ServerEntity.Cursor.HotSpot.X,
                                             (double)ServerEntity.MousePosition.Y - ServerEntity.Cursor.HotSpot.Y);
                var absolutePoint = TileImage.GetAbsolutePosition(theTilePoint);
                var rootPoint     = ApplicationRootVisual.GetAbsolutePosition(new Point());

                _serverCursorImage.SetValue(Canvas.LeftProperty, absolutePoint.X - rootPoint.X);
                _serverCursorImage.SetValue(Canvas.TopProperty, absolutePoint.Y - rootPoint.Y);

                if (ServerEntity.Cursor.Icon == null)
                {
                    if (_serverCursorImage.Source != null)
                    {
                        _serverCursorImage.Source = null;
                        ApplicationRootVisual.Children.Remove(_serverCursorImage);
                    }
                }
                else
                {
                    var bmp = new BitmapImage();
                    bmp.SetSource(new MemoryStream(ServerEntity.Cursor.Icon));
                    _serverCursorImage.Source  = bmp;
                    _serverCursorImage.Stretch = Stretch.None;
                    if (!ApplicationRootVisual.Children.Contains(_serverCursorImage))
                    {
                        ApplicationRootVisual.Children.Add(_serverCursorImage);
                    }
                }

                _serverCursorImage.UpdateLayout();
            }

            //TODO (CR May 2010): we're already removing it from the AppRootVisual, but this is used in a number of places.
            UpdateClientCursor();
        }
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            var tile    = AdaptiveTile.CreateTile();
            var binding = TileBinding.Create(TemplateType.TileWide);

            binding.Branding = Branding.None;

            var header = new Text("You have mail")
            {
                Style = TextStyle.Body
            };
            var content = new Text("Someone likes you!")
            {
                Style = TextStyle.Caption
            };
            var logo = new TileImage(ImagePlacement.Inline)
            {
                Source = "http://fc02.deviantart.net/fs71/i/2013/359/a/4/deadpool_logo_1_fill_by_mr_droy-d5q6y5u.png"
            };

            var logoSubGroup = new SubGroup {
                Width = 40
            };

            logoSubGroup.AddImage(logo);

            var subgroup = new SubGroup();

            subgroup.AddText(header);
            subgroup.AddText(content);

            binding.Add(logoSubGroup);
            binding.Add(subgroup);

            tile.Tiles.Add(binding);
            var xml = tile.GetXml();


            if (string.IsNullOrEmpty(xml))
            {
            }
        }
        private void OnMousePositionChanged(Position mousePosition)
        {
            if (ServerEntity.Cursor == null)
            {
                ServerEntity.Cursor = new AppServiceReference.Cursor();
            }

            ServerEntity.MousePosition = mousePosition;

            var theTilePoint = new Point((double)ServerEntity.MousePosition.X - ServerEntity.Cursor.HotSpot.X,
                                         (double)ServerEntity.MousePosition.Y - ServerEntity.Cursor.HotSpot.Y);
            var   absolutePoint = TileImage.GetAbsolutePosition(theTilePoint);
            Point rootPoint     = ApplicationRootVisual.GetAbsolutePosition(new Point());

            _serverCursorImage.SetValue(Canvas.LeftProperty, absolutePoint.X - rootPoint.X);
            _serverCursorImage.SetValue(Canvas.TopProperty, absolutePoint.Y - rootPoint.Y);

            _serverCursorImage.UpdateLayout();

            UpdateClientCursor();
        }
Example #21
0
 public Tile(string title, Set tileSet, TileType tileType) : base(new TileIdentifier(title, tileSet, tileType))
 {
     Image    = new TileImage(title, tileSet, tileType);
     TileSet  = tileSet;
     TileType = tileType;
 }
Example #22
0
 public TestContainer(Position position)
     : base(position, new Dimensions(21, 9), Color.Black)
 {
     image = TileImageLoader.LoadImage("testgui");
 }
Example #23
0
 void Start()
 {
     tileImageData = (TileImage)Resources.Load("TileData_" + tileDataString, typeof(TileImage));
 }
Example #24
0
 public void UpdateTile(Position position, TileImage image)
 => _board[position.Row, position.Column] = image;
Example #25
0
        /// <summary>
        /// タイル更新
        /// </summary>
        public void UpdateTile()
        {
            switch (this.anchor)
            {
            case Anchor.LeftTop:      this.root.anchoredPosition = new Vector2(0f, 0f); break;

            case Anchor.RightTop:     this.root.anchoredPosition = new Vector2(Screen.width - Define.WIDTH * tileSize, 0f); break;

            case Anchor.LeftBottom:   this.root.anchoredPosition = new Vector2(0f, -(Screen.height - Define.HEIGHT * tileSize)); break;

            case Anchor.RightBottom:  this.root.anchoredPosition = new Vector2(Screen.width - Define.WIDTH * tileSize, -(Screen.height - Define.HEIGHT * tileSize)); break;
            }

            DungeonManager.Instance.Map((x, y, tile) =>
            {
                var tileImage = tileImages[x, y];
                if (tileImage == null)
                {
                    tileImages[x, y] = new TileImage();
                    tileImage        = tileImages[x, y];
                    tileImage.Setup(this.tilePrefab, this.tileRoot, new Vector2Int(x, y), this.tileSize);
                }

                if (tile.IsPlayer)
                {
                    tileImage.ApplyStyle(PlayerTileStyle, tile.IsClear);
                }
                else if (tile.IsEnemy)
                {
                    tileImage.ApplyStyle(EnemyTileStyle, tile.IsClear);
                }
                else if (tile.IsGoal)
                {
                    tileImage.ApplyStyle(GoalTileStyle, tile.IsClear);
                }
                else if (tile.IsTrap)
                {
                    tileImage.ApplyStyle(TrapTileStyle, tile.IsClear);
                }
                else if (tile.IsTrap)
                {
                    tileImage.ApplyStyle(TrapTileStyle, tile.IsClear);
                }
                else if (tile.IsItem)
                {
                    tileImage.ApplyStyle(ItemTileStyle, tile.IsClear);
                }
                else if (tile.IsRoom)
                {
                    tileImage.ApplyStyle(RoomTileStyle, tile.IsClear);
                }
                else if (tile.IsAisle)
                {
                    tileImage.ApplyStyle(AisleTileStyle, tile.IsClear);
                }
                else if (tile.IsWall)
                {
                    tileImage.ApplyStyle(null, false);
                }
            });
        }
Example #26
0
        public static void Main()
        {
            int delayBetween = 1100;

#if ESP32   // This is an example mapping, work them out for your needs!
            int backLightPin = 32;
            int chipSelect   = 14;
            int dataCommand  = 27;
            int reset        = 33;
            // Add the nanoFramework.Hardware.Esp32 to the solution
            Configuration.SetPinFunction(19, DeviceFunction.SPI1_MISO);
            Configuration.SetPinFunction(23, DeviceFunction.SPI1_MOSI);
            Configuration.SetPinFunction(18, DeviceFunction.SPI1_CLOCK);
            // Adjust as well the size of your screen and the position of the screen on the driver
            DisplayControl.Initialize(new SpiConfiguration(1, chipSelect, dataCommand, reset, backLightPin), new ScreenConfiguration(0, 0, 320, 240));
            // Depending on you ESP32, you may also have to use either PWM either GPIO to set the backlight pin mode on
            // GpioController.OpenPin(backLightPin, PinMode.Output);
            // GpioController.Write(backLightPin, PinValue.High);
#elif STM32F769I_DISCO // This is an example (working) button map, work the actual pins out for your need!
            //WARNING: Invalid pin mappings will never be returned, and may need you to reflash the device!
            DisplayControl.Initialize(new SpiConfiguration(), new ScreenConfiguration());
#else
            throw new System.Exception("Unknown display mapping!");
#endif

            // Get full screen bitmap from displayControl to draw on.
            Bitmap fullScreenBitmap = DisplayControl.FullScreen;

            fullScreenBitmap.Clear();

            Font DisplayFont = Resource.GetFont(Resource.FontResources.SegoeUIRegular12);

            while (true)
            {
                RandomDrawLine rdlt = new RandomDrawLine(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                RotateImage ri = new RotateImage(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                ColourGradient colourGradient = new ColourGradient(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                Colours ColourExample = new Colours(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                PagedText pt = new PagedText(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                BouncingBalls bb = new BouncingBalls(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                TileImage ti = new TileImage(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                StretchImage si = new StretchImage(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                SetPixels sp = new SetPixels(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                FontExamples fe = new FontExamples(fullScreenBitmap);
                Thread.Sleep(delayBetween);

                RandomRectangles rr = new RandomRectangles(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                SliceScaling9 ss = new SliceScaling9(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                RandomClipping rc = new RandomClipping(fullScreenBitmap, DisplayFont);
                Thread.Sleep(delayBetween);

                MatrixRain mr = new MatrixRain(fullScreenBitmap);
                Thread.Sleep(Timeout.Infinite);
            }
        }
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            var tile = AdaptiveTile.CreateTile();

            #region for wide tile with background

            var wideBinding = TileBinding.Create(TemplateType.TileWide);
            wideBinding.Branding = Branding.NameAndLogo;
            var wideLogo = new TileImage(ImagePlacement.Background)
            {
                Source = "http://fc02.deviantart.net/fs71/i/2013/359/a/4/deadpool_logo_1_fill_by_mr_droy-d5q6y5u.png"
            };
            //background/peek images need to be at the root of the binding;
            wideBinding.BackgroundImage = wideLogo;

            var wideHeader = new Text("You have mail")
            {
                Style = TextStyle.Body
            };
            var wideContent = new Text("Someone likes you!")
            {
                Style = TextStyle.Caption
            };

            var wideSubgroup = new SubGroup();
            wideSubgroup.AddText(wideHeader);
            wideSubgroup.AddText(wideContent);

            wideBinding.AddSubgroup(wideSubgroup, true);

            #endregion

            #region square tile

            var binding = TileBinding.Create(TemplateType.TileMedium);
            binding.Branding = Branding.None;

            var header = new Text("You have mail")
            {
                Style = TextStyle.Body, WrapText = true
            };
            var content = new Text("Someone likes you!")
            {
                Style = TextStyle.Caption, IsSubtleStyle = true, WrapText = true, Alignment = Alignment.Center
            };
            var logo = new TileImage(ImagePlacement.Inline)
            {
                Source = "http://fc02.deviantart.net/fs71/i/2013/359/a/4/deadpool_logo_1_fill_by_mr_droy-d5q6y5u.png"
            };

            var imageSubgroup = new SubGroup()
            {
                Width = 20
            };
            imageSubgroup.AddImage(logo);


            var subgroup = new SubGroup();
            subgroup.AddText(header);
            subgroup.AddText(content);

            binding.AddSubgroup(imageSubgroup);
            binding.AddSubgroup(subgroup);

            #endregion

            // Add the types of tile bindings to the tile.
            tile.Tiles.Add(wideBinding);
            tile.Tiles.Add(binding);

            var notification = tile.GetNotification();

            TileUpdateManager.CreateTileUpdaterForApplication().Update(notification);
        }
Example #28
0
        internal async Task <bool> PinAsync(DetailPageViewModel detailPageViewModel)
        {
            // prepare content

            var header = new Text("Template 10")
            {
                Style = TextStyle.Subtitle
            };

            var content = new Text(detailPageViewModel.Value)
            {
                Style    = TextStyle.Caption,
                WrapText = true
            };

            var logo = new TileImage(ImagePlacement.Inline)
            {
                Source = "https://raw.githubusercontent.com/Windows-XAML/Template10/master/Assets/Template10.png"
            };

            // build tile

            var tile    = AdaptiveTile.CreateTile(string.Empty);
            var binding = TileBinding.Create(TemplateType.TileWide);

            binding.Branding = Branding.Name;

            var sub1 = new SubGroup {
                Width = 33
            };

            binding.Add(sub1);
            sub1.AddImage(logo);

            var sub2 = new SubGroup();

            binding.Add(sub2);
            sub2.AddText(header);
            sub2.AddText(content);

            tile.Tiles.Add(binding);

            // show tile

            var tileId = detailPageViewModel.ToString();

            if (!await IsPinned(detailPageViewModel))
            {
                // initial pin
                var secondaryTile = new SecondaryTile(tileId)
                {
                    Arguments      = detailPageViewModel.Value,
                    DisplayName    = "Detail page",
                    VisualElements =
                    {
                        Square44x44Logo             = new Uri("ms-appx:///Assets/Logo.png"),
                        Square150x150Logo           = new Uri("ms-appx:///Assets/Logo.png"),
                        Wide310x150Logo             = new Uri("ms-appx:///Assets/Logo.png"),
                        Square310x310Logo           = new Uri("ms-appx:///Assets/Logo.png"),
                        ShowNameOnSquare150x150Logo = true,
                    },
                };
                if (!await secondaryTile.RequestCreateAsync())
                {
                    System.Diagnostics.Debugger.Break();
                    return(false);
                }
            }

            // update pin
            var xml = tile.GetNotification().Content;

            xml.DocumentElement.RemoveAttribute("version");
            var value            = xml.GetXml();
            var tileUpdater      = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId);
            var tileNotification = new TileNotification(xml);

            tileUpdater.Update(tileNotification);

            return(true);
        }
Example #29
0
 private void ClearItem_Click(object sender, EventArgs e)
 {
     _tile.Obstructions.Clear();
     TileImage.Refresh();
 }
Example #30
0
 private void TileImage_MouseUp(object sender, MouseEventArgs e)
 {
     _paint = false;
     if (_tool == 0)
     {
         _tile.Obstructions.Add(new Line(_start_loc, _end_loc));
     }
     else if (_tool == 1)
     {
         Rectangle rect = Line.ToRectangle(new Line(_start_loc, _end_loc));
         short     x1 = (short)rect.X, y1 = (short)rect.Y;
         short     x2 = (short)(rect.X + rect.Width);
         short     y2 = (short)(rect.Y + rect.Height);
         if (rect.Width == 0)
         {
             _tile.Obstructions.Add(new Line(x1, y1, x1, y2)); // horizontal
         }
         else if (rect.Height == 0)
         {
             _tile.Obstructions.Add(new Line(x1, y1, x2, y1)); // vertical
         }
         else
         {
             _tile.Obstructions.Add(new Line(x1, y1, x1, y2)); // top
             _tile.Obstructions.Add(new Line(x1, y1, x2, y1)); // left
             _tile.Obstructions.Add(new Line(x1, y2, x2, y2)); // bottom
             _tile.Obstructions.Add(new Line(x2, y1, x2, y2)); // right
         }
     }
     else if (_tool == 2)
     {
         if (_tile.Obstructions.Count == 0)
         {
             return;
         }
         int index = 0;
         int cur   = 0;
         int dist  = _tile.Width;
         int c_x   = e.X / _zoom;
         int c_y   = e.Y / _zoom;
         foreach (Line l in _tile.Obstructions)
         {
             int m_x    = l.X1 + (l.X2 - l.X1) / 2;
             int m_y    = l.Y1 + (l.Y2 - l.Y1) / 2;
             int d_x    = m_x - c_x;
             int d_y    = m_y - c_y;
             int l_dist = (int)Math.Sqrt(d_x * d_x + d_y * d_y);
             if (l_dist < dist)
             {
                 dist = l_dist;
                 cur  = index;
             }
             index++;
         }
         _tile.Obstructions.RemoveAt(cur);
     }
     if (Modified != null)
     {
         Modified(this, new EventArgs());
     }
     TileImage.Refresh();
 }
Example #31
0
        private static TileBinding CreateLargeMusicTileBinding()
        {
            var bindingContent = new TileBindingContentAdaptive()
            {
                Children =
                {
                    new TileGroup()
                    {
                        Children =
                        {
                            new TileSubgroup()
                            {
                                Weight = 1
                            },
                            new TileSubgroup()
                            {
                                Weight = 2,
                            },
                            new TileSubgroup()
                            {
                                Weight = 1
                            }
                        }
                    },
                    new TileText()
                    {
                        Text  = Strings.NowPlaying,
                        Style = TileTextStyle.Title,
                        Align = TileTextAlign.Center
                    },
                    new TileText()
                    {
                        Text  = Locator.MusicPlayerVM.CurrentTrack.Name + " - " + Locator.MusicPlayerVM.CurrentTrack.ArtistName,
                        Wrap  = true,
                        Style = TileTextStyle.SubtitleSubtle,
                        Align = TileTextAlign.Center
                    }
                }
            };

            if (!string.IsNullOrEmpty(Locator.MusicPlayerVM.CurrentAlbum?.AlbumCoverFullUri))
            {
                bindingContent.PeekImage = new TilePeekImage()
                {
                    Source = Locator.MusicPlayerVM.CurrentAlbum.AlbumCoverFullUri
                };
            }

            if (!string.IsNullOrEmpty(Locator.MusicPlayerVM.CurrentArtist?.Picture))
            {
                var artistPic = new TileImage()
                {
                    Crop   = TileImageCrop.Circle,
                    Source = new TileImageSource(Locator.MusicPlayerVM.CurrentArtist.Picture)
                };
                (bindingContent.Children[0] as TileGroup).Children[1].Children.Add(artistPic);
            }
            return(new TileBinding()
            {
                Branding = TileBranding.NameAndLogo,
                Content = bindingContent
            });
        }