public PEWindow(string path) { InitializeComponent(); this.AddEscapeToClose(); this.SetTopMost(); _path = path; this.Text = "PE File - " + path; Program.PEWindows.Add(Id, this); this.InitializeLists(); try { _mappedImage = new MappedImage(path); this.Read(); } catch (Exception ex) { PhUtils.ShowException("Unable to load the specified file", ex); this.Close(); } }
public RadialButton(Game game, GameObject owner, CommandButton commandButton, bool isHeroButton = false) { _game = game; _owner = owner; CommandButton = commandButton; _objectDefinition = commandButton.Object?.Value ?? null; IsRecruitHeroButton = isHeroButton; _background = commandButton.ButtonImage.Value; _border = _game.GetMappedImage("RadialBorder"); _hover = _game.GetMappedImage("RadialOver"); _down = _game.GetMappedImage("RadialPush"); _width = _border.Coords.Width; _fontColor = new ColorRgbaF(0, 0, 0, 1); // _game.AssetStore.InGameUI.Current.DrawableCaptionColor.ToColorRgbaF(); -> this is white -> conflicts with the progress clock _fontSize = _game.AssetStore.InGameUI.Current.DrawableCaptionPointSize; var fontWeight = _game.AssetStore.InGameUI.Current.DrawableCaptionBold ? FontWeight.Bold : FontWeight.Normal; _font = _game.ContentManager.FontManager.GetOrCreateFont(_game.AssetStore.InGameUI.Current.DrawableCaptionFont, _fontSize, fontWeight); _alphaMask = MappedImageUtility.CreateTexture(_game.GraphicsLoadContext, _game.GetMappedImage("RadialClockOverlay1")); //_scheme = game.AssetStore.ControlBarSchemes.FindBySide(game.Scene3D.LocalPlayer.Side); }
public MappedImageView(DiagnosticViewContext context, MappedImage mappedImageAsset) : base(context) { _texture = MappedImageUtility.CreateTexture(context.Game.GraphicsLoadContext, mappedImageAsset); var textureViewDescription = new TextureViewDescription(_texture, 0, 1, 0, 1); _textureView = AddDisposable(Context.Game.GraphicsDevice.ResourceFactory.CreateTextureView(ref textureViewDescription)); }
public StretchableMappedImageSource(MappedImage left, MappedImage middle, MappedImage right, ImageTextureCache cache) : base(cache) { _left = left; _middle = middle; _right = right; NaturalSize = new Size( _left.Coords.Width + _middle.Coords.Width + _right.Coords.Width, _left.Coords.Height); CacheKey = $"Stretchable:{left.Name}:{middle.Name}:{right.Name}"; }
/// <summary> /// Creates a texture from a mapped image. /// This version does a simple copy of the original image part /// </summary> public static Texture CreateTexture( GraphicsLoadContext loadContext, MappedImage mappedImage) { var graphicsDevice = loadContext.GraphicsDevice; var src = mappedImage.Coords; var width = (uint)src.Width; var height = (uint)src.Height; var imageTexture = graphicsDevice.ResourceFactory.CreateTexture( TextureDescription.Texture2D( width, height, 1, 1, PixelFormat.R8_G8_B8_A8_UNorm, TextureUsage.Sampled)); imageTexture.Name = "WndImage"; var commandList = graphicsDevice.ResourceFactory.CreateCommandList(); commandList.Begin(); commandList.CopyTexture( mappedImage.Texture.Value, (uint)src.Left, (uint)src.Top, 0, 0, 0, // Source imageTexture, 0, 0, 0, 0, 0, width, height, 1, 1); // Destination commandList.End(); graphicsDevice.SubmitCommands(commandList); graphicsDevice.DisposeWhenIdle(commandList); graphicsDevice.WaitForIdle(); return(imageTexture); }
public MappedImageSource(MappedImage mappedImage, ImageTextureCache cache) : base(cache) { _mappedImage = mappedImage; }
public INIParser(Stream stream) : base(stream) { str = (BigStream)stream; //Console.WriteLine(str.Name); long filesize = str.Length; while (str.Position < filesize) { ParseLine(); string s = getString(); string name; switch (s) { case "#include": includeFile(getString()); break; case "#define": macros.Add(getString().ToUpper(), getStrings()); break; case "Armor": Armor ar = new Armor(); name = getString(); ParseObject(ar); INIManager.AddArmor(name, ar); break; case "AmbientStream": AmbientStream ast = new AmbientStream(); name = getString(); ParseObject(ast); INIManager.AddAmbientStream(name, ast); break; case "AudioEvent": AudioEvent e = new AudioEvent(); name = getString(); ParseObject(e); INIManager.AddAudioEvent(name, e); break; case "CommandButton": CommandButton cb = new CommandButton(); name = getString(); ParseObject(cb); INIManager.AddCommandButton(name, cb); break; case "DialogEvent": DialogEvent de = new DialogEvent(); name = getString(); ParseObject(de); INIManager.AddDialogEvent(name, de); break; case "FXList": FXList fl = new FXList(); name = getString(); ParseObject(fl); INIManager.AddFXList(name, fl); break; case "GameData": GameData data = new GameData(); ParseObject(data); INIManager.SetGameData(data); break; case "LoadSubsystem": LoadSubsystem ls = new LoadSubsystem(); name = getString(); ParseObject(ls); ls.LoadFiles(); break; case "MappedImage": MappedImage mi = new MappedImage(); name = getString(); ParseObject(mi); INIManager.AddMappedImage(name, mi); break; case "ModifierList": ModifierList ml = new ModifierList(); name = getString(); ParseObject(ml); INIManager.AddModifierList(name, ml); break; case "Multisound": Multisound ms = new Multisound(); name = getString(); ParseObject(ms); INIManager.AddMultisound(name, ms); break; case "MusicTrack": MusicTrack mt = new MusicTrack(); name = getString(); ParseObject(mt); INIManager.AddMusicTrack(name, mt); break; case "Object": INI.Object o = new INI.Object(); name = getString(); ParseObject(o); INIManager.AddObject(name, o); break; case "Science": Science sc = new Science(); name = getString(); ParseObject(sc); INIManager.AddScience(name, sc); break; case "StreamedSound": StreamedSound ss = new StreamedSound(); name = getString(); ParseObject(ss); INIManager.AddStreamedSound(name, ss); break; case "Upgrade": Upgrade u = new Upgrade(); name = getString(); ParseObject(u); INIManager.AddUpgrade(name, u); break; case "Weapon": Weapon w = new Weapon(); name = getString(); ParseObject(w); INIManager.AddWeapon(name, w); break; default: if (!objects.Contains(s)) { //PrintError("unhandled entry: " + s); objects.Add(s); } break; } } count++; }