public void FontProc(FontProcessor fd) { /* If you like delegate methods, you'll love this. */ foreach (Frame f in FrameList) { foreach (IDisplayListItem dl in f.DisplayList) { if (dl is ICharacterReference) { ICharacter ch = ((ICharacterReference)dl).Character; if (ch is IFontUserProcessor) { IFontUserProcessor fup = (IFontUserProcessor)ch; fup.FontUserProc(delegate(IFontUser fu) { if (fu.HasFont) { fd(fu.Font); } }); } if (ch is Timeline) { /* ISSUE 69: Is there any risk of infinite recursion here? Possible pass in a set * of visited objects, timelines and fonts. */ ((Timeline)ch).FontProc(fd); } } } } }
public static void Load(ContentManager content) { background_music = content.Load <SoundEffect>("music/background"); droplet_sound = content.Load <SoundEffect>("music/droplet"); bubble_texture = content.Load <Texture2D>("textures/bubble_small"); bubble_reflection_texture = content.Load <Texture2D>("textures/bubble_reflection_small"); title_texture = content.Load <Texture2D>("textures/title"); ray_texture = content.Load <Texture2D>("textures/bg-light-0001"); logo_texture = content.Load <Texture2D>("textures/logo"); instructions_texture = content.Load <Texture2D>("textures/instructions"); instructions_texture_region = new TextureRegion(instructions_texture, 0, 0, 813, 360); logo_texture_region = new TextureRegion(logo_texture, 0, 0, 340, 270); white_texture_region = new TextureRegion(title_texture, 17 * 16 + 8, 8, 1, 1); particle_texture_region = new TextureRegion(title_texture, 18 * 16 + 1, 1, 14, 14); bubble_reflection_texture_region = new TextureRegion(bubble_reflection_texture, 0, 0, 128, 128); bubble_texture_region = new TextureRegion(bubble_texture, 0, 0, bubble_texture.Width, bubble_texture.Height); controls_region = new TextureRegion(title_texture, 0, 96, 512, 320); hud_on = new TextureRegion(title_texture, 96, 416, 96, 96); hud_off = new TextureRegion(title_texture, 0, 416, 96, 96); arial10px_font = FontProcessor.Build(content.Load <Texture2D>("fonts/arial10px")); description_font = FontProcessor.Build(content.Load <Texture2D>("fonts/aharoni15px_bold")); option_font = FontProcessor.Build(content.Load <Texture2D>("fonts/aharoni28px_bold")); title_font = FontProcessor.Build(content.Load <Texture2D>("fonts/aharoni48px_bold")); spriterenderer_material = content.Load <Effect>("shaders/spriterenderer/default"); postprocessor_blur = content.Load <Effect>("shaders/postprocessor/dof_blur"); postprocessor_dof = content.Load <Effect>("shaders/postprocessor/dof"); postprocessor_scale = content.Load <Effect>("shaders/postprocessor/dof_scale"); postprocessor_extract = content.Load <Effect>("shaders/postprocessor/bloom_extract"); postprocessor_bloom = content.Load <Effect>("shaders/postprocessor/bloom_combine"); box_model = content.Load <Model>("models/box"); rock_model = content.Load <Model>("models/rock"); skybox_model = content.Load <Model>("models/skybox"); seaurchin_model = content.Load <Model>("models/urchin"); fish_model = content.Load <Model>("models/nemo"); octopus_model = content.Load <Model>("models/octopus"); starfish_model = content.Load <Model>("models/starfish"); name_to_object_mapping = new Dictionary <string, object>(); object_to_name_mapping = new Dictionary <object, string>(); Add("models/box", box_model); Add("models/rock", rock_model); Add("models/skybox", skybox_model); Add("models/urchin", seaurchin_model); Add("models/nemo", fish_model); Add("models/octopus", octopus_model); Add("models/starfish", starfish_model); Add("textures/bg-light-0001", ray_texture); }
public void FontProc(FontProcessor fd) { /* If you like delegate methods, you'll love this. */ foreach (Frame f in FrameList) { foreach (IDisplayListItem dl in f.DisplayList) { if (dl is ICharacterReference) { ICharacter ch = ((ICharacterReference)dl).Character; if (ch is IFontUserProcessor) { IFontUserProcessor fup = (IFontUserProcessor)ch; fup.FontUserProc(delegate(IFontUser fu) { if (fu.HasFont) { fd(fu.Font); } }); } if (ch is Timeline) { /* ISSUE 69: Is there any risk of infinite recursion here? Possible pass in a set * of visited objects, timelines and fonts. */ ((Timeline)ch).FontProc(fd); } } } } }