public void SetRotation(AGT_SpriteId id, float x, float y, float z)
 {
     if (_sprites != null)
     {
         _sprites.SetRotation(id, x, y, z);
     }
 }
 public void SetScaling(AGT_SpriteId id, float x, float y, float z)
 {
     if (_sprites != null)
     {
         _sprites.SetTextureScale(id, x, y, z);
     }
 }
 public void SetCenter(AGT_SpriteId id, float x, float y, float z)
 {
     if (_sprites != null)
     {
         _sprites.SetCenter(id, x, y, z);
     }
 }
 public AGT_SpriteResource GetTextureDefinition(AGT_SpriteId id)
 {
     if (_sprites != null)
     {
         return(_sprites.GetTextureDefinition(id));
     }
     return(null);
 }
        public void Draw(AGT_SpriteId id, float x, float y, float z, Color color)
        {
            if (_sprites != null)
            {
                _sprites.SetPosition(id, x, y, z);

                _sprites.Draw(id, color);
            }
        }
Exemple #6
0
 public void SetTextureScale(AGT_SpriteId id, float sx, float sy, float sz)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             _texture_list[id.Id].SetScale(sx, sy);
         }
     }
 }
Exemple #7
0
 public void Remove(AGT_SpriteId id)
 {
     if (IsValidId(id))
     {
         lock (this)
         {
             _texture_list.Remove(id.Id);
         }
     }
 }
Exemple #8
0
 public int GetBitmapHeight(AGT_SpriteId id)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             return(_texture_list[id.Id].BitmapHeight);
         }
         return(-1);
     }
 }
Exemple #9
0
 public AGT_SpriteResource GetTextureDefinition(AGT_SpriteId id)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             return(new AGT_SpriteResource(_texture_list[id.Id]));
         }
         return(new AGT_SpriteResource(_texture_list[_unknown_id.Id]));
     }
 }
Exemple #10
0
 public bool CanRotate(AGT_SpriteId id)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             return(_texture_list[id.Id].CanRotate);
         }
         return(false);
     }
 }
Exemple #11
0
 public void Draw(AGT_SpriteId id, Color diffuse)
 {
     if (_texture_list.ContainsKey(id.Id))
     {
         _texture_list[id.Id].DrawRelative(_sprite_resource, Scale, X, Y, 0, diffuse.ToArgb());
     }
     else
     {
         _texture_list[_unknown_id.Id].DrawRelative(_sprite_resource, Scale, X, Y, 0, diffuse.ToArgb());
     }
 }
Exemple #12
0
 public int GetTextureWidth(AGT_SpriteId id)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             return(_texture_list[id.Id].Width);
         }
         return(-1);
     }
 }
Exemple #13
0
        public void DrawSingle(AGT_SpriteId id, float x, float y, float z, Color color)
        {
            if (_sprites != null)
            {
                _sprites.SetPosition(id, x, y, z);

                _sprites.Begin(SpriteFlags.AlphaBlend);
                _sprites.Draw(id, color);
                _sprites.End();
            }
        }
Exemple #14
0
 public void SetPosition(AGT_SpriteId id, float x, float y, float z)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             _texture_list[id.Id].Position.X = x;
             _texture_list[id.Id].Position.Y = y;
             _texture_list[id.Id].Position.Z = z;
         }
     }
 }
Exemple #15
0
 public void SetRotation(AGT_SpriteId id, float rx, float ry, float rz)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             _texture_list[id.Id].Rotation.X = rx;
             _texture_list[id.Id].Rotation.Y = ry;
             _texture_list[id.Id].Rotation.Z = rz;
         }
     }
 }
Exemple #16
0
 public void SetCenter(AGT_SpriteId id, float x, float y, float z)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             _texture_list[id.Id].Center.X = x;
             _texture_list[id.Id].Center.Y = y;
             _texture_list[id.Id].Center.Z = z;
         }
     }
 }
Exemple #17
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);
            }

        }
Exemple #18
0
 public AGT_SpriteManager(Device d)
 {
     if (d == null)
     {
         throw new ArgumentNullException("Null device passed");
     }
     _device_         = d;
     _sprite_resource = new Sprite(d);
     using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("AGT.images.Unknown.png")))
     {
         _unknown_id = AddResource("AGT.images.Unknown.png", b, 0, 0, 0);
         SetCenter(_unknown_id, (float)(b.Width * .5f), (float)(b.Height * .5f), 0);
     }
 }
Exemple #19
0
        public AGT_SpriteManager(Device d)
        {
            if (d == null)
            {
                throw new ArgumentNullException("Null device passed");
            }
            _device_ = d;
            _sprite_resource = new Sprite(d);
            using (Bitmap b = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("AGT.images.Unknown.png")))
            {
                _unknown_id = AddResource("AGT.images.Unknown.png", b, 0, 0, 0);
                SetCenter(_unknown_id, (float)(b.Width * .5f), (float)(b.Height * .5f), 0);
            }

        }
Exemple #20
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);
        }
Exemple #21
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);
        }
Exemple #22
0
 public void SetRotation(AGT_SpriteId id, Vector3 rotation)
 {
     SetRotation(id, rotation.X, rotation.Y, rotation.Z);
 }
Exemple #23
0
 public void SetRotation(AGT_SpriteId id, float rx, float ry, float rz)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             _texture_list[id.Id].Rotation.X = rx;
             _texture_list[id.Id].Rotation.Y = ry;
             _texture_list[id.Id].Rotation.Z = rz;
         }
     }
 }
Exemple #24
0
 public void Draw(AGT_SpriteId id, Color diffuse)
 {
     if (_texture_list.ContainsKey(id.Id))
     {
         _texture_list[id.Id].DrawRelative(_sprite_resource, Scale, X, Y, 0, diffuse.ToArgb());
     }
     else
     {
         _texture_list[_unknown_id.Id].DrawRelative(_sprite_resource, Scale, X, Y, 0, diffuse.ToArgb());
     }
 }
Exemple #25
0
 public bool CanRotate(AGT_SpriteId id)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             return _texture_list[id.Id].CanRotate;
         }
         return false;
     }
 }
Exemple #26
0
 public void SetCenter(AGT_SpriteId id, float x, float y, float z)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             _texture_list[id.Id].Center.X = x;
             _texture_list[id.Id].Center.Y = y;
             _texture_list[id.Id].Center.Z = z;
         }
     }
 }
Exemple #27
0
 public void SetPosition(AGT_SpriteId id, float x, float y, float z)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             _texture_list[id.Id].Position.X = x;
             _texture_list[id.Id].Position.Y = y;
             _texture_list[id.Id].Position.Z = z;
         }
     }
 }
Exemple #28
0
 public void SetScaling(AGT_SpriteId id, float x, float y, float z)
 {
     if (_sprites != null)
     {
         _sprites.SetTextureScale(id, x, y, z);
     }
 }
Exemple #29
0
        public override bool Equals(object obj)
        {
            AGT_SpriteId s = (AGT_SpriteId)obj;

            return((s.Id == Id));
        }
Exemple #30
0
 public AGT_SpriteResource GetTextureDefinition(AGT_SpriteId id)
 {
     if (_sprites != null)
     {
         return _sprites.GetTextureDefinition(id);
     }
     return null;
 }
Exemple #31
0
 public void Draw(AGT_SpriteId id, float x, float y, float z)
 {
     Draw(id, x, y, z, Color.White);
 }
Exemple #32
0
        public void Draw(AGT_SpriteId id, float x, float y, float z, Color color)
        {
            if (_sprites != null)
            {
                _sprites.SetPosition(id, x, y, z);

                _sprites.Draw(id, color);
            }
        }
Exemple #33
0
        public void DrawSingle(AGT_SpriteId id, float x, float y, float z, Color color)
        {
            if (_sprites != null)
            {
                _sprites.SetPosition(id, x, y, z);

                _sprites.Begin(SpriteFlags.AlphaBlend);
                _sprites.Draw(id, color);
                _sprites.End();
            }
        }
Exemple #34
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);
            }
        }
Exemple #35
0
 public void SetTextureScale(AGT_SpriteId id, float sx, float sy, float sz)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             _texture_list[id.Id].SetScale(sx, sy);
         }
     }
 }
Exemple #36
0
 public void SetTexutureScale(AGT_SpriteId id, Vector3 scale)
 {
     SetTextureScale(id, scale.X, scale.Y, scale.Z);
 }
Exemple #37
0
 public void SetTexutureScale(AGT_SpriteId id, Vector3 scale)
 {
     SetTextureScale(id, scale.X, scale.Y, scale.Z);
 }
Exemple #38
0
 public void SetPosition(AGT_SpriteId id, Vector3 position)
 {
     SetPosition(id, position.X, position.Y, position.Z);
 }
Exemple #39
0
 public void SetRotation(AGT_SpriteId id, Vector3 rotation)
 {
     SetRotation(id, rotation.X, rotation.Y, rotation.Z);
 }
Exemple #40
0
 public void SetCenter(AGT_SpriteId id, Vector3 center)
 {
     SetCenter(id, center.X, center.Y, center.Z);
 }
Exemple #41
0
        public AGT_GameFramework(DeviceParams parameters) {

            if (parameters == DeviceParams.Empty)
            {
                throw new ArgumentException("Empty Device Parameters");
            }
            if (parameters.PresentationParameters == null)
            {
                throw new ArgumentException("Missing PresentationParameters, in DeviceParams");
            }
            if (parameters.TargetControl == null)
            {
                throw new ArgumentException("Missing TargetControl, in DeviceParams");
            }

            _AppIdleHandler = new EventHandler(this.Application_Idle);
            
            AGT_Scene.QueryPerformanceFrequency(ref _ticks_per_second);
            _DeviceParams_ = parameters;
            BindFormEvents();

            _VIDEO_DEVICE_ = new Microsoft.DirectX.Direct3D.Device(
                Microsoft.DirectX.Direct3D.Manager.Adapters.Default.Adapter,
                Microsoft.DirectX.Direct3D.DeviceType.Hardware,
                parameters.TargetControl,
                parameters.Flags,
                parameters.PresentationParameters);

            _SystemImages = new AGT_SystemImages(_VIDEO_DEVICE_);
            Cursor = _SystemImages.Cursor_Select;

            _device_lost = new EventHandler(_DEVICE__DeviceLost);
            _device_reset = new EventHandler(_DEVICE__DeviceReset);
            _device_resize = new System.ComponentModel.CancelEventHandler(_DEVICE__DeviceResizing);

            _VIDEO_DEVICE_.DeviceLost += _device_lost;
            _VIDEO_DEVICE_.DeviceReset += _device_reset;
            _VIDEO_DEVICE_.DeviceResizing += _device_resize;

        }
Exemple #42
0
 public void Remove(AGT_SpriteId id)
 {
     if (IsValidId(id))
     {
         lock (this)
         {
             _texture_list.Remove(id.Id);
         }
     }
 }
Exemple #43
0
 private bool IsValidId(AGT_SpriteId id)
 {
     return _texture_list.ContainsKey(id.Id);
 }
Exemple #44
0
 private bool IsValidId(AGT_SpriteId id)
 {
     return(_texture_list.ContainsKey(id.Id));
 }
Exemple #45
0
 public AGT_Pawn()
 {
     _sprite_id = new AGT_SpriteId();
     _pawn_id = string.Empty;
     _position = _rotation = Vector3.Empty;
     _scaling = new Vector3(1, 1, 1);
     _collision_rect = Rectangle.Empty;
 }
Exemple #46
0
 public void SetCenter(AGT_SpriteId id, float x, float y, float z)
 {
     if (_sprites != null)
     {
         _sprites.SetCenter(id, x, y, z);
     }
 }
Exemple #47
0
 public void SetCenter(AGT_SpriteId id, Vector3 center)
 {
     SetCenter(id, center.X, center.Y, center.Z);
 }
Exemple #48
0
 public void Draw(AGT_SpriteId id, float x, float y, float z)
 {
     Draw(id, x, y, z, Color.White);
 }
Exemple #49
0
 public AGT_SpriteResource GetTextureDefinition(AGT_SpriteId id)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             return new AGT_SpriteResource(_texture_list[id.Id]);
         }
         return new AGT_SpriteResource(_texture_list[_unknown_id.Id]);
     }
 }
Exemple #50
0
 public int GetTextureWidth(AGT_SpriteId id)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             return _texture_list[id.Id].Width;
         }
         return -1;
     }
 }
Exemple #51
0
 public int GetBitmapHeight(AGT_SpriteId id)
 {
     lock (this)
     {
         if (IsValidId(id))
         {
             return _texture_list[id.Id].BitmapHeight;
         }
         return -1;
     }
 }
Exemple #52
0
 public void SetRotation(AGT_SpriteId id, float x, float y, float z)
 {
     if (_sprites != null)
     {
         _sprites.SetRotation(id, x, y, z);
     }
 }
Exemple #53
0
 public void SetPosition(AGT_SpriteId id, Vector3 position)
 {
     SetPosition(id, position.X, position.Y, position.Z);
 }