Example #1
0
        public AGT_Heading(Microsoft.DirectX.Direct3D.Device d)
        {
            _line_points = new Vector2[2];
            _line = new Line(d);
            _sprites = new AGT_SpriteManager(d);

            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(Endpoint)))
            {
                EndpointId = _sprites.AddResource(Endpoint, b, 0, 0, 0);
                _sprites.SetCenter(EndpointId, (float)(b.Width * .5f), (float)(b.Height * .5f), 0);
            }

        }
Example #2
0
        public static AGT_SpriteManager Load(string library_path, List<string> images, System.Windows.Forms.Control dialog, Microsoft.DirectX.Direct3D.Device VideoDevice)
        {
            try
            {
                List<string> names = new List<string>();
                AGT_SpriteManager sprite_manager = new AGT_SpriteManager(VideoDevice);

                Assembly image_lib = Assembly.LoadFile(library_path);

                StreamReader s = new StreamReader(image_lib.GetManifestResourceStream("ImageLibrary.mf"));

                while (!s.EndOfStream)
                {
                    names.Add(s.ReadLine());
                }
                s.Close();

                for (int i = 0; i < names.Count; i++)
                {
                    if (images.Contains(names[i]))
                    {
                        string[] texture_name = names[i].Split(':');
                        if (dialog is AGT_SceneLoadDialog)
                        {
                            ((AGT_SceneLoadDialog)dialog).UpdateStatusBar(string.Format("Loading {0} ...", texture_name[0]), i + 1, names.Count);
                        }
                        if (dialog is AGT_SplashDialog)
                        {
                            ((AGT_SplashDialog)dialog).UpdateStatusBar(string.Format("Loading {0} ...", texture_name[0]), i + 1, names.Count);
                        }
                        using (Bitmap b = new Bitmap(image_lib.GetManifestResourceStream(texture_name[0])))
                        {
                            AGT_SpriteId id = sprite_manager.AddResource(texture_name[0], b, 0, 0, 0, bool.Parse(texture_name[1]));
                            sprite_manager.SetCenter(id, (float)(b.Width * .5f), (float)(b.Height * .5f), 0f);
                        }
                    }
                }

                return sprite_manager;

            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.StackTrace, e.Message);
            }
            return null;

        }
Example #3
0
        public static AGT_SpriteManager Load(string library_path, List <string> images, System.Windows.Forms.Control dialog, Microsoft.DirectX.Direct3D.Device VideoDevice)
        {
            try
            {
                List <string>     names          = new List <string>();
                AGT_SpriteManager sprite_manager = new AGT_SpriteManager(VideoDevice);

                Assembly image_lib = Assembly.LoadFile(library_path);

                StreamReader s = new StreamReader(image_lib.GetManifestResourceStream("ImageLibrary.mf"));

                while (!s.EndOfStream)
                {
                    names.Add(s.ReadLine());
                }
                s.Close();

                for (int i = 0; i < names.Count; i++)
                {
                    if (images.Contains(names[i]))
                    {
                        string[] texture_name = names[i].Split(':');
                        if (dialog is AGT_SceneLoadDialog)
                        {
                            ((AGT_SceneLoadDialog)dialog).UpdateStatusBar(string.Format("Loading {0} ...", texture_name[0]), i + 1, names.Count);
                        }
                        if (dialog is AGT_SplashDialog)
                        {
                            ((AGT_SplashDialog)dialog).UpdateStatusBar(string.Format("Loading {0} ...", texture_name[0]), i + 1, names.Count);
                        }
                        using (Bitmap b = new Bitmap(image_lib.GetManifestResourceStream(texture_name[0])))
                        {
                            AGT_SpriteId id = sprite_manager.AddResource(texture_name[0], b, 0, 0, 0, bool.Parse(texture_name[1]));
                            sprite_manager.SetCenter(id, (float)(b.Width * .5f), (float)(b.Height * .5f), 0f);
                        }
                    }
                }

                return(sprite_manager);
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.StackTrace, e.Message);
            }
            return(null);
        }
Example #4
0
        public AGT_SystemImages(Microsoft.DirectX.Direct3D.Device d)
        {
            _sprites = new AGT_SpriteManager(d);

            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_waypoint.Id)))
            {
                _sprites.AddResource(_waypoint.Id, b, 0, 0, 0);
                _sprites.SetCenter(_waypoint, (float)(b.Width * .5f), (float)(b.Height * .5f), 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_cursor_engage.Id)))
            {
                _sprites.AddResource(_cursor_engage.Id, b, 0, 0, 0);
                _sprites.SetCenter(_cursor_engage, 0, 0, 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_cursor_move.Id)))
            {
                _sprites.AddResource(_cursor_move.Id, b, 0, 0, 0);
                _sprites.SetCenter(_cursor_move, 0, 0, 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_cursor_undock.Id)))
            {
                _sprites.AddResource(_cursor_undock.Id, b, 0, 0, 0);
                _sprites.SetCenter(_cursor_undock, 0, 0, 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_cursor_select.Id)))
            {
                _sprites.AddResource(_cursor_select.Id, b, 0, 0, 0);
                _sprites.SetCenter(_cursor_select, 0, 0, 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_waypoint_add.Id)))
            {
                _sprites.AddResource(_waypoint_add.Id, b, 0, 0, 0);
                _sprites.SetCenter(_waypoint_add, 0, 0, 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_waypoint_move.Id)))
            {
                _sprites.AddResource(_waypoint_move.Id, b, 0, 0, 0);
                _sprites.SetCenter(_waypoint_move, 0, 0, 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_waypoint_delete.Id)))
            {
                _sprites.AddResource(_waypoint_delete.Id, b, 0, 0, 0);
                _sprites.SetCenter(_waypoint_delete, 0, 0, 0);
            }
        }
Example #5
0
        public void LoadResources(AGT_SplashDialog dialog_instance, Device device)
        {

            dialog_instance.UpdateStatusBar("Initializing Sprite Manager", 0, 3);

            sprites = new AGT_SpriteManager(device);

            dialog_instance.UpdateStatusBar("Loading Ramadi Map", 1, 3);
                sprites.AddResource("Ramadi", "Resources\\Map2.jpg", 0, 0, 0, false);

            dialog_instance.UpdateStatusBar("Loading Active Zones", 2, 3);
            using (Bitmap b = AGT_GDIBridge.CreateCircle(device, 200, new HatchBrush(HatchStyle.DashedDownwardDiagonal, Color.FromArgb(180, Color.Black), Color.FromArgb(180, Color.White))))
            {
                active_zone = sprites.AddResource("ActiveZone", b, 100, 100, 0);
            }

            dialog_instance.UpdateStatusBar("Finished", 3, 3);
        }
Example #6
0
        public AGT_SystemImages(Microsoft.DirectX.Direct3D.Device d)
        {

            _sprites = new AGT_SpriteManager(d);

            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_waypoint.Id)))
            {
                _sprites.AddResource(_waypoint.Id, b, 0, 0, 0);
                _sprites.SetCenter(_waypoint, (float)(b.Width * .5f), (float)(b.Height * .5f), 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_cursor_engage.Id)))
            {
                _sprites.AddResource(_cursor_engage.Id, b, 0, 0, 0);
                _sprites.SetCenter(_cursor_engage, 0, 0, 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_cursor_move.Id)))
            {
                _sprites.AddResource(_cursor_move.Id, b, 0, 0, 0);
                _sprites.SetCenter(_cursor_move, 0, 0, 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_cursor_undock.Id)))
            {
                _sprites.AddResource(_cursor_undock.Id, b, 0, 0, 0);
                _sprites.SetCenter(_cursor_undock, 0, 0, 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_cursor_select.Id)))
            {
                _sprites.AddResource(_cursor_select.Id, b, 0, 0, 0);
                _sprites.SetCenter(_cursor_select, 0, 0, 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_waypoint_add.Id)))
            {
                _sprites.AddResource(_waypoint_add.Id, b, 0, 0, 0);
                _sprites.SetCenter(_waypoint_add, 0, 0, 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_waypoint_move.Id)))
            {
                _sprites.AddResource(_waypoint_move.Id, b, 0, 0, 0);
                _sprites.SetCenter(_waypoint_move, 0, 0, 0);
            }
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(_waypoint_delete.Id)))
            {
                _sprites.AddResource(_waypoint_delete.Id, b, 0, 0, 0);
                _sprites.SetCenter(_waypoint_delete, 0, 0, 0);
            }

        }
Example #7
0
        public new void LoadResources(AGT_SceneLoadDialog dialog_instance, Device device)
        {
            lock (this)
            {
                dialog_instance.UpdateStatusBar("Initializing Sprite Manager", 0, 3);
                if (_active_zone_sprites != null)
                {
                    _active_zone_sprites.Dispose();
                }
                if (_waypoint_group_sprites != null)
                {
                    _waypoint_group_sprites.Dispose();
                }
                if (_map_sprites != null)
                {
                    _map_sprites.Dispose();
                }
                if (_pawn_sprites != null)
                {
                    _pawn_sprites.Dispose();
                }

                _active_zone_sprites = new AGT_SpriteManager(device);
                _waypoint_group_sprites = new AGT_SpriteManager(device);
                _map_sprites = new AGT_SpriteManager(device);
               _pawn_sprites = AGT_ImageLibrary.Load(ImageLibraryPath, dialog_instance, device);
                
                dialog_instance.UpdateStatusBar("Loading " + MapFile, 2, 3);
                _playfield_image_id = _map_sprites.AddResource(MapFile, MapFile, 0, 0, 0, false);


                UTM_Mapping.ImageHeight = _map_sprites.GetBitmapHeight(_playfield_image_id);
                UTM_Mapping.ImageWidth = _map_sprites.GetBitmapWidth(_playfield_image_id);


                dialog_instance.UpdateStatusBar("Finished", 3, 3);
            }
        }