public void SetCenter(AGT_SpriteId id, float x, float y, float z) { if (_sprites != null) { _sprites.SetCenter(id, x, y, 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_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); } }
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 static AGT_SpriteManager Load(string library_path, 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++) { string[] texture_name = names[i].Split(':'); if (dialog is AGT_SplashDialog) { ((AGT_SplashDialog)dialog).UpdateStatusBar(string.Format("Loading {0} ...", texture_name[0]), i + 1, names.Count); } if (dialog is AGT_SceneLoadDialog) { ((AGT_SceneLoadDialog)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; }