Beispiel #1
0
        public int loadDemoData(GraphicsDevice device, NvgContext vg)
        {
            int i;

            if (vg == null)
            {
                return(-1);
            }

            for (i = 0; i < 12; i++)
            {
                var path = "Assets/images/image" + (i + 1).ToString() + ".jpg";

                int    width, height;
                byte[] data;
                using (var stream = File.OpenRead(path))
                {
                    var texture = Texture2D.FromStream(device, stream);

                    width  = texture.Width;
                    height = texture.Height;
                    data   = new byte[texture.Width * texture.Height * 4];
                    texture.GetData(data);
                }

                images[i] = vg.CreateImageRGBA(width, height, 0, data);
            }

            fontIcons  = LoadFont(vg, "icons", "Assets/entypo.ttf");
            fontNormal = LoadFont(vg, "sans", "Assets/Roboto-Regular.ttf");
            fontBold   = LoadFont(vg, "sans-bold", "Assets/Roboto-Bold.ttf");

            return(0);
        }