public void SetAtlasFrame(TextureAtlas atlas, string frame) { SetTextureRegion(atlas.Texture, atlas[frame], false); }
public void LoadContentPack(string pak_name) { ResourcePak pak = ResourceLoader.LoadPak(pak_name); if (pak.TotalResourcesCount == 0) { return; } int res_name_map_idx = 0; m_pak_res_map.Add(pak_name, new string[pak.TotalResourcesCount]); if (pak.Images != null) { foreach (var image_res in pak.Images) { Texture2D texture = ResourceLoader.LoadTexture(image_res.Value); m_loaded_resources.Add(texture.Id, texture); m_pak_res_map[pak_name][res_name_map_idx++] = image_res.Key; } } if (pak.Atlases != null) { foreach (var atlas_res in pak.Atlases) { TextureAtlas atlas = ResourceLoader.LoadAtlas(atlas_res.Value); m_loaded_resources.Add(atlas.Id, atlas); m_pak_res_map[pak_name][res_name_map_idx++] = atlas_res.Key; } } if (pak.Fonts != null) { foreach (var font_res in pak.Fonts) { Font font = ResourceLoader.LoadFont(font_res.Value); m_loaded_resources.Add(font.Id, font); m_pak_res_map[pak_name][res_name_map_idx++] = font_res.Key; } } if (pak.Shaders != null) { foreach (var shader_res in pak.Shaders) { ShaderProgram shader = ResourceLoader.LoadShader(shader_res.Value); m_loaded_resources.Add(shader.Id, shader); m_pak_res_map[pak_name][res_name_map_idx++] = shader_res.Key; } } if (pak.TextFiles != null) { foreach (var txt_res in pak.TextFiles) { TextFile text_file = ResourceLoader.LoadTextFile(txt_res.Value); m_loaded_resources.Add(text_file.Id, text_file); m_pak_res_map[pak_name][res_name_map_idx++] = txt_res.Key; } } //foreach (var sfx_res in pak.Sfx) //{ // Effect effect = _loader.LoadEffect(sfx_res.Value); // _loaded_resources.Add(effect.Id, effect); //} //foreach (var song_res in pak.Songs) //{ // Song song = _loader.LoadSong(song_res.Value); // _loaded_resources.Add(song.Id, song); //} }
public Sprite(TextureAtlas atlas) : this(atlas.Texture, atlas[0]) { }