public IResource GetSharedResource(string url, ref List <ISharableResource> checkedOutList, DeviceInterface devIf) { IResource[] dependans, dependancies; IResource rz = GetResource(url, true, ref checkedOutList, devIf, out dependans, out dependancies); if (dependans != null || dependancies != null) { throw new Exception("Shared resource generated unhandled dependancies/dependants"); } return(rz); }
public SimpleGUILayer(DeviceInterface devIf, Point position, Size dimensions) { this.devIf = devIf; device = devIf.Device; this.position = position; this.dimensions = dimensions; enabled = true; visible = true; itemsList = new List<GUILayerItem>(); itemsLayout = new QuadTree<GUILayerItem>(dimensions.Width, dimensions.Height); checkedOutResources = new List<ISharableResource>(); layoutManager = new LayoutManager(); }
public MoleculeControlLayer(DeviceInterface devIf, Point position, Size dimensions) : base(devIf, position, dimensions) { }
public IResource GetResource(string url, bool allowShare, ref List <ISharableResource> checkedOutList, DeviceInterface devIf, out IResource[] unhandledDependants, out IResource[] unhandledDependancies) { // TODO: break-up url here Uri uri = new Uri(url); if (uri.IsFile) { // look for existing ISharableResource sRz = resourceSet.Checkout(url); if (sRz != null) { if (sRz.Value is IResource) { checkedOutList.Add(sRz); unhandledDependants = null; unhandledDependancies = null; return((IResource)sRz.Value); } // throw away resourceSet.Checkin(sRz); } // load up from fresh IResource[] dependants, dependancies; string realRzId; IResource rz = cdi.ResourceLoader.LoadResource(uri, devIf, out dependants, out dependancies, out realRzId); // share if allowed if (allowShare && rz != null) { resourceSet.Checkin(rz, url, out sRz); checkedOutList.Add(sRz); // deal with dependants & dependancies if (dependants != null) { foreach (IResource item in dependants) { resourceSet.Checkin(item, item.Id, out sRz); checkedOutList.Add(sRz); } } if (dependancies != null) { foreach (IResource item in dependancies) { resourceSet.Checkin(item, item.Id, out sRz); checkedOutList.Add(sRz); } } unhandledDependants = null; unhandledDependancies = null; } else { unhandledDependants = dependants; unhandledDependancies = dependancies; } // double check we have right rz if (realRzId != null) { rz = (IResource)resourceSet.PeekRz(realRzId).Value; } return(rz); } unhandledDependants = null; unhandledDependancies = null; return(null); }
public override IResource LoadContent(string filePath, string rzPath, string subPath, string contentType, XmlNodeList rzNodes, out IResource[] loadedDependants, out IResource[] loadedDependancies, DeviceInterface devIf) { ILog log = devIf.CDI.GeneralLog; log.AddItem(new LogItem(string.Format("Starting loading texture rz ([{0}]{1})", contentType, rzPath), LogItem.ItemLevel.DebugInfo)); // load texture first ImageInformation imgInf = TextureLoader.ImageInformationFromFile(filePath); Texture texture = TextureLoader.FromFile(devIf.Device, filePath, imgInf.Width, imgInf.Height, 1, Usage.None, imgInf.Format, Pool.Managed, Filter.None, Filter.None, 0); log.AddItem(new LogItem(string.Format("Loaded texture rz ([{0}]{1})", contentType, rzPath), LogItem.ItemLevel.DebugInfo)); // process meta-data nodes TextureResource texRz = new TextureResource(rzPath, texture, null, imgInf.Width, imgInf.Height); TextureResource.Icon[] icons = null; foreach (XmlElement item in rzNodes) { if (item.Name == "areas") { // process sub-areas ProcessSubAreas(item, texRz, out icons, rzPath + ":areas:icon:"); } } texRz.Icons = icons; /*if (subPath != null) { loadedDependants = icons; loadedDependancies = new IResource[] { texRz }; return } else {*/ loadedDependancies = null; loadedDependants = icons; return texRz; //} }
public IResource GetResource(string url, bool allowShare, ref List<ISharableResource> checkedOutList, DeviceInterface devIf, out IResource[] unhandledDependants, out IResource[] unhandledDependancies) { // TODO: break-up url here Uri uri = new Uri(url); if (uri.IsFile) { // look for existing ISharableResource sRz = resourceSet.Checkout(url); if (sRz != null) { if (sRz.Value is IResource) { checkedOutList.Add(sRz); unhandledDependants = null; unhandledDependancies = null; return (IResource)sRz.Value; } // throw away resourceSet.Checkin(sRz); } // load up from fresh IResource[] dependants, dependancies; string realRzId; IResource rz = cdi.ResourceLoader.LoadResource(uri, devIf, out dependants, out dependancies, out realRzId); // share if allowed if (allowShare && rz != null) { resourceSet.Checkin(rz, url, out sRz); checkedOutList.Add(sRz); // deal with dependants & dependancies if (dependants != null) { foreach (IResource item in dependants) { resourceSet.Checkin(item, item.Id, out sRz); checkedOutList.Add(sRz); } } if (dependancies != null) { foreach (IResource item in dependancies) { resourceSet.Checkin(item, item.Id, out sRz); checkedOutList.Add(sRz); } } unhandledDependants = null; unhandledDependancies = null; } else { unhandledDependants = dependants; unhandledDependancies = dependancies; } // double check we have right rz if (realRzId != null) rz = (IResource)resourceSet.PeekRz(realRzId).Value; return rz; } unhandledDependants = null; unhandledDependancies = null; return null; }
public IResource GetSharedResource(string url, ref List<ISharableResource> checkedOutList, DeviceInterface devIf) { IResource[] dependans, dependancies; IResource rz = GetResource(url, true, ref checkedOutList, devIf, out dependans, out dependancies); if (dependans != null || dependancies != null) throw new Exception("Shared resource generated unhandled dependancies/dependants"); return rz; }
protected virtual void InitializeEnvironment(CommonDeviceInterface cdi) { // Get device settings if (outCaps == null) outCaps = OutputCaps.GetDefaultAdapterCaps(outReqs); outSettings = OutputSettings.CreateFromRequirements(outReqs, outCaps, outMinReqs); // Set up the presentation parameters presentParams.Windowed = outReqs.Windowed; presentParams.SwapEffect = SwapEffect.Discard; presentParams.AutoDepthStencilFormat = outSettings.DepthFormat; presentParams.EnableAutoDepthStencil = (outSettings.DepthFormat != DepthFormat.Unknown); CreateDevice(); devIf = new DeviceInterface(device, cdi); }