public AtlasTexturesProcessor CreateAtlas(string configPath, string texturePath) { if (!File.Exists(configPath)) { LogError($"Plugin '{Name}': Can't find atlas json config file in '{configPath}'", 20); return(new AtlasTexturesProcessor("%AtlasNotFound%")); } if (!File.Exists(texturePath)) { LogError($"Plugin '{Name}': Can't find atlas png texture file in '{texturePath}' ", 20); return(new AtlasTexturesProcessor("%AtlasNotFound%")); } Graphics.InitImage(texturePath, false); return(new AtlasTexturesProcessor(configPath, texturePath)); }
public AtlasTexture GetAtlasTexture(string textureName) { if (_atlasTextures == null) { var atlasDirectory = Path.Combine(DirectoryFullName, "textures"); var atlasConfigNames = Directory.GetFiles(atlasDirectory, "*.json"); if (atlasConfigNames.Length == 0) { LogError($"Plugin '{Name}': Can't find atlas json config file in '{atlasDirectory}' " + "(expecting config 'from Free texture packer' program)", 20); _atlasTextures = new AtlasTexturesProcessor("%AtlasNotFound%"); return(null); } var atlasName = Path.GetFileNameWithoutExtension(atlasConfigNames[0]); if (atlasConfigNames.Length > 1) { LogError($"Plugin '{Name}': Found multiple atlas configs in folder '{atlasDirectory}', " + $"selecting the first one ''{atlasName}''", 20); } var atlasTexturePath = Path.Combine(DirectoryFullName, $"textures\\{atlasName}.png"); if (!File.Exists(atlasTexturePath)) { LogError($"Plugin '{Name}': Can't find atlas png texture file in '{atlasTexturePath}' ", 20); _atlasTextures = new AtlasTexturesProcessor(atlasName); return(null); } _atlasTextures = new AtlasTexturesProcessor(atlasConfigNames[0], atlasTexturePath); Graphics.InitImage(atlasTexturePath, false); } var texture = _atlasTextures.GetTextureByName(textureName); return(texture); }
public DebugWindow(Graphics graphics, CoreSettings coreSettings) { this._graphics = graphics; this._coreSettings = coreSettings; graphics.InitImage("menu-background.png"); }