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); } }
public void SetTextureScale(AGT_SpriteId id, float sx, float sy, float sz) { lock (this) { if (IsValidId(id)) { _texture_list[id.Id].SetScale(sx, sy); } } }
public void Remove(AGT_SpriteId id) { if (IsValidId(id)) { lock (this) { _texture_list.Remove(id.Id); } } }
public int GetBitmapHeight(AGT_SpriteId id) { lock (this) { if (IsValidId(id)) { return(_texture_list[id.Id].BitmapHeight); } return(-1); } }
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])); } }
public bool CanRotate(AGT_SpriteId id) { lock (this) { if (IsValidId(id)) { return(_texture_list[id.Id].CanRotate); } return(false); } }
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()); } }
public int GetTextureWidth(AGT_SpriteId id) { lock (this) { if (IsValidId(id)) { return(_texture_list[id.Id].Width); } return(-1); } }
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(); } }
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; } } }
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; } } }
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; } } }
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); } }
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); } }
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); }
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); }
public void SetRotation(AGT_SpriteId id, Vector3 rotation) { SetRotation(id, rotation.X, rotation.Y, rotation.Z); }
public bool CanRotate(AGT_SpriteId id) { lock (this) { if (IsValidId(id)) { return _texture_list[id.Id].CanRotate; } return false; } }
public override bool Equals(object obj) { AGT_SpriteId s = (AGT_SpriteId)obj; return((s.Id == Id)); }
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) { Draw(id, x, y, z, Color.White); }
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); } }
public void SetTexutureScale(AGT_SpriteId id, Vector3 scale) { SetTextureScale(id, scale.X, scale.Y, scale.Z); }
public void SetPosition(AGT_SpriteId id, Vector3 position) { SetPosition(id, position.X, position.Y, position.Z); }
public void SetCenter(AGT_SpriteId id, Vector3 center) { SetCenter(id, center.X, center.Y, center.Z); }
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; }
private bool IsValidId(AGT_SpriteId id) { return _texture_list.ContainsKey(id.Id); }
private bool IsValidId(AGT_SpriteId id) { return(_texture_list.ContainsKey(id.Id)); }
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; }
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]); } }
public int GetTextureWidth(AGT_SpriteId id) { lock (this) { if (IsValidId(id)) { return _texture_list[id.Id].Width; } return -1; } }
public int GetBitmapHeight(AGT_SpriteId id) { lock (this) { if (IsValidId(id)) { return _texture_list[id.Id].BitmapHeight; } return -1; } }