private void TrySetupSteps(DriverType driverType, SeleniteTest test, IWebDriver webDriver) { if (test.TestCollection.SetupSteps.IsNullOrNotAny()) return; var fileName = String.IsNullOrWhiteSpace(test.TestCollection.SetupStepsFile) ? test.TestCollection.ResolvedFile : test.TestCollection.SetupStepsFile; foreach (var pair in _setupStepsMap) { if (pair.Key.Target != webDriver) continue; if (pair.Value.Any(f => String.Equals(f, fileName, StringComparison.InvariantCultureIgnoreCase))) return; } foreach (var setupStep in test.TestCollection.SetupSteps) _testService.ExecuteTest(webDriver, driverType, setupStep, true); var weakReference = new WeakReference(webDriver); var testFiles = new List<string> { fileName }; _setupStepsMap.Add(weakReference, testFiles); }
public DriverData(string driverUid, string name, byte driverCode, DriverType driverType) { Name = name; DriverUid = driverUid; DriverCode = driverCode; DriverType = driverType; }
public static ISplintDriver CreateDriver(DriverType driverType) { ISplintDriver driver; switch (driverType) { case DriverType.Chrome: driver = new ChromeSplintDriver() { Name = "Chrome", Type = driverType, }; break; case DriverType.Firefox: driver = new FirefoxSplintDriver() { Name = "Firefox", Type = driverType, }; break; case DriverType.InternetExplorer: driver = new InternetExplorerSplintDriver() { Name = "Internet Explorer", Type = driverType, }; break; default: throw new NotImplementedException(string.Format("Driver type not implemented:{0}", driverType)); } return driver; }
public static Driver GetDriver(DriverType driverType) { var driver = Drivers.FirstOrDefault(x => x.DriverType == driverType); if (driver == null) throw new NullReferenceException(); return driver; }
public string GetDriverPath(DriverType driverType) { string driverPath; switch (driverType) { case DriverType.InternetExplorer: driverPath = GetAppSetting("IEDriverPath"); break; case DriverType.Chrome: driverPath = GetAppSetting("ChromeDriverPath"); break; case DriverType.PhantomJs: driverPath = GetAppSetting("PhantomJsPath"); break; default: driverPath = null; break; } if (string.IsNullOrWhiteSpace(driverPath)) { return Directory.GetCurrentDirectory(); } if (!Path.IsPathRooted(driverPath)) { driverPath = Path.Combine(Directory.GetCurrentDirectory(), driverPath); } return Directory.Exists(driverPath) ? driverPath : Directory.GetCurrentDirectory(); }
private IWebDriver CreateDriver(DriverType browser) { switch (browser) { case DriverType.Firefox: return new FirefoxDriver(); case DriverType.InternetExplorer: return new InternetExplorerDriver(_configurationService.GetDriverPath(browser)); case DriverType.Chrome: return new ChromeDriver(_configurationService.GetDriverPath(browser)); case DriverType.PhantomJs: var service = PhantomJSDriverService.CreateDefaultService(_configurationService.GetDriverPath(browser)); service.CookiesFile = "cookies.txt"; return new PhantomJSDriver(service, new PhantomJSOptions()); case DriverType.WebClient: return new WebClientDriver(); default: throw new InvalidOperationException("Unkown Driver Type: " + browser); } }
public DirectionDeviceSelectorViewModel(Direction direction, DriverType driverType) { Title = "Выбор устройства"; var devices = new HashSet<Device>(); foreach (var device in FiresecManager.Devices) { if (device.Driver.DriverType == driverType) { if (device.Parent.Children.Any(x => x.Driver.IsZoneDevice && x.ZoneUID != Guid.Empty && direction.ZoneUIDs.Contains(x.ZoneUID))) { device.AllParents.ForEach(x => { devices.Add(x); }); devices.Add(device); } } } Devices = new ObservableCollection<DeviceViewModel>(); foreach (var device in devices) { var deviceViewModel = new DeviceViewModel(device); deviceViewModel.IsExpanded = true; Devices.Add(deviceViewModel); } foreach (var device in Devices.Where(x => x.Device.Parent != null)) { var parent = Devices.FirstOrDefault(x => x.Device.UID == device.Device.Parent.UID); parent.AddChild(device); } SelectedDevice = Devices.FirstOrDefault(x => x.HasChildren == false); }
public static IWebDriver GetDriver(DriverType typeOfDriver) { IWebDriver browser; switch (typeOfDriver) { // NOTE REMOTE DRIVER IS NOT SUPPORTED case DriverType.Chrome: ChromeOptions co = new ChromeOptions(); browser = new ChromeDriver(); break; case DriverType.IE: InternetExplorerOptions ieo = new InternetExplorerOptions(); browser = new InternetExplorerDriver(); break; case DriverType.Firefox: default: FirefoxProfile ffp = new FirefoxProfile(); ffp.AcceptUntrustedCertificates = true; ffp.Port = 8181; browser = new FirefoxDriver(ffp); break; } return browser; }
protected D3DApp(IntPtr hInstance) { AppInst = hInstance; MainWindowCaption = "D3D11 Application"; DriverType = DriverType.Hardware; ClientWidth = 800; ClientHeight = 600; Enable4XMsaa = false; Window = null; AppPaused = false; Minimized = false; Maximized = false; Resizing = false; Msaa4XQuality = 0; Device = null; ImmediateContext = null; SwapChain = null; DepthStencilBuffer = null; RenderTargetView = null; DepthStencilView = null; Viewport = new Viewport(); Timer = new GameTimer(); GD3DApp = this; }
static bool AskUserForDriver(out DriverType driverType) { driverType = DriverType.Null; Console.Write("Please select the driver you want for this example:\n" + " (a) OpenGL\n (b) Direct3D 9.0c\n (c) Direct3D 8.1\n" + " (d) Burning's Software Renderer\n (e) Software Renderer\n" + " (f) NullDevice\n (otherKey) exit\n\n"); ConsoleKeyInfo i = Console.ReadKey(); switch (i.Key) { case ConsoleKey.A: driverType = DriverType.OpenGL; break; case ConsoleKey.B: driverType = DriverType.Direct3D9; break; case ConsoleKey.C: driverType = DriverType.Direct3D8; break; case ConsoleKey.D: driverType = DriverType.BurningsVideo; break; case ConsoleKey.E: driverType = DriverType.Software; break; case ConsoleKey.F: driverType = DriverType.Null; break; default: return false; } return true; }
public static List<DeviceCustomFunction> GetDeviceCustomFunctionList(DriverType driverType) { switch (driverType) { case DriverType.IndicationBlock: case DriverType.PDU: case DriverType.PDU_PT: return new List<DeviceCustomFunction>() { new DeviceCustomFunction() { No = 0, Code = "Touch_SetMaster", Name = "Записать мастер-ключ", Description = "Записать мастер-ключ TouchMemory", }, new DeviceCustomFunction() { No = 1, Code = "Touch_ClearMaster", Name = "Стереть пользовательские ключи", Description = "Стереть пользовательские ключи TouchMemory", }, new DeviceCustomFunction() { No = 2, Code = "Touch_ClearAll", Name = "Стереть все ключи", Description = "Стереть все ключи TouchMemory", } }; } return new List<DeviceCustomFunction>(); }
public Direct3D11Base(Form form, SwapChainDescription swapDesc, Adapter adapter = null, DriverType type = DriverType.Hardware, DeviceCreationFlags flags = DeviceCreationFlags.None, FeatureLevel[] levels = null) { IsDisposed = false; try { _isInitializing = true; _form = form; _isComposited = DwmApi.IsCompositionEnabled; if (_isComposited) { DwmApi.EnableMMCSS(true); DwmPresentParameters present = new DwmPresentParameters() { IsQueued = true, BufferCount = 2, RefreshesPerFrame = 1, }; DwmApi.SetPresentParameters(form.Handle, ref present); } if (swapDesc.OutputHandle != IntPtr.Zero) { throw new ArgumentException("Output handle must not be set."); } if (swapDesc.Usage != Usage.RenderTargetOutput) { throw new ArgumentException("Usage must be RenderTargetOutput."); } swapDesc.OutputHandle = _form.Handle; bool setFullscreen = !swapDesc.IsWindowed; swapDesc.IsWindowed = true; Device.CreateWithSwapChain(adapter, type, DeviceCreationFlags.None, levels, swapDesc, out _device, out _swapChain); _swapChain.ResizeTarget(swapDesc.ModeDescription); _factory = _swapChain.GetParent<Factory>(); _factory.SetWindowAssociation(_form.Handle, WindowAssociationFlags.IgnoreAll); _form.SizeChanged += SizeChanged_Handler; _form.ResizeBegin += ResizeBegin_Handler; _form.Resize += Resize_Handler; _form.ResizeEnd += ResizeEnd_Handler; _form.KeyDown += KeyDown_Handler; if (setFullscreen) { ChangeMode(true); } _isInitializing = false; } catch { Dispose(); throw; } }
public void ExecuteTest(DriverType driverType, SeleniteTest test) { var webDriver = _driverFactory.GetBrowser(driverType); TrySetupSteps(driverType, test, webDriver); _testService.ExecuteTest(webDriver, driverType, test); }
public DriverData(string DriverId, int IgnoreLevel, string Name, DriverType DriverType, int Code = 0) { this.Name = Name; this.DriverId = DriverId; this.IgnoreLevel = IgnoreLevel; this.DriverType = DriverType; this.Code = Code; }
public Color BackColor; // "null" for skybox public DeviceSettings(IntPtr hh, DriverType dt, byte aa, Color bc, bool vs) { WindowID = hh; DriverType = dt; AntiAliasing = aa; BackColor = bc; VSync = vs; }
public IrrlichtDevice(DriverType type, Dimension2D dim, int bits, bool fullscreen, bool stencil, bool vsync, bool antialias, IntPtr windowHandle) { Console.WriteLine("Irrlicht.NET CP v" + CPVersion + " running"); Initialize(CreateDeviceA(type, dim.ToUnmanaged(), bits, fullscreen, stencil, vsync, antialias, windowHandle)); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); MainNativeEvent = OnNativeEvent; Device_SetCallback(_raw, MainNativeEvent); }
public DeviceDetailsViewModel(DriverType driverType, Device parent) : this() { _parent = parent; Address = parent.Children.Count + 1; var device = new Device(driverType); Title = "Создание устройства " + device.Name; Initialize(device); }
public void ChangeDriver(DeviceViewModel deviceViewModel, DriverType newDriverType) { int maxAdress = (int)GetMaxAddress(); if (maxAdress - deviceViewModel.Device.Driver.Mult + Processor.DriversHelper.GetDriver(newDriverType).Mult > 255) { MessageBoxService.ShowWarning("Количество устройств на шлейфе не должно превышать 255"); return; } deviceViewModel.Device.DriverType = newDriverType; UpdateAddresses(Devices.IndexOf(deviceViewModel)); Calculate(); }
public DriverTypesViewModel(DriverType parentDriverType) { Title = "Выбор типа устройства"; DriverTypes = new ObservableCollection<DriverType>(); var driver = DriversConfiguration.Drivers.FirstOrDefault(x => x.DriverType == parentDriverType); foreach(var childDriver in driver.Children) { DriverTypes.Add(childDriver); } SelectedDriverType = DriverTypes.FirstOrDefault(); }
public static void Click(this IWebDriver driver, IWebElement element, DriverType driverType) { // HACK: Force Focus, to help prevent a problem with clicking in IE if (driverType == DriverType.InternetExplorer) driver.SwitchTo().Window(driver.CurrentWindowHandle); // HACK: There is an issue where mouse over events occure on Click that cover the buttons and cause a miss click. if (driverType == DriverType.Firefox && "input".Equals(element.TagName, StringComparison.InvariantCultureIgnoreCase)) element.SendKeys(Keys.Space); else element.Click(); }
public static IWebDriver GetDriver(DriverType type) { switch(type) { case DriverType.Firefox: return getFirefoxDriver(); case DriverType.Chrome: return getChromeDriver(); case DriverType.IE: return getIEDriver(); } return null; }
static DriverType DriverTypeToUSBDriverType(DriverType driverType) { switch (driverType) { case DriverType.Rubezh_2AM: return DriverType.USB_Rubezh_2AM; case DriverType.Rubezh_2OP: return DriverType.USB_Rubezh_2OP; case DriverType.Rubezh_4A: return DriverType.USB_Rubezh_4A; case DriverType.BUNS: return DriverType.USB_BUNS; case DriverType.Rubezh_P: return DriverType.USB_Rubezh_P; } return DriverType.Computer; }
public IWebDriver GetBrowser(DriverType browser) { if (_driver != null) { if (_type == browser) return _driver; DisposeDriver(); } _driver = CreateDriver(browser); _type = browser; var window = _driver.Manage().Window; window.Size = new System.Drawing.Size(1024, 800); window.Position = new System.Drawing.Point(0, 0); _driver.Url = Constants.AboutBlank; return _driver; }
public static async Task<IWebDriver> GetDriverAsync(DriverType typeOfDriver) { IWebDriver browserDriver; switch (typeOfDriver) { case DriverType.Chrome: ChromeOptions co = new ChromeOptions(); browserDriver = await Task.Run(() => new ChromeDriver()); break; case DriverType.IE: InternetExplorerOptions io = new InternetExplorerOptions(); browserDriver = await Task.Run(() => new InternetExplorerDriver()); break; case DriverType.Firefox: default: FirefoxProfile ffp = new FirefoxProfile(); ffp.AcceptUntrustedCertificates = true; FirefoxBinary ffb = new FirefoxBinary(Defaults.FIREFOX_BINARY_PATH); browserDriver = await Task.Run(() => new FirefoxDriver(ffb, ffp)); break; } return browserDriver; }
public PasteAsViewModel(DriverType parentDriverType) { Title = "Выберите устройство"; Drivers = new List<Driver>(); var driverTypes = new List<DriverType>(); switch (parentDriverType) { case DriverType.Computer: driverTypes = DriversHelper.UsbPanelDrivers; break; case DriverType.USB_Channel_1: case DriverType.USB_Channel_2: driverTypes = DriversHelper.PanelDrivers; break; } foreach (var driver in FiresecManager.Drivers) { if (driverTypes.Contains(driver.DriverType)) Drivers.Add(driver); } }
/// <summary> /// /// </summary> private EffectsManager() { #if DX11 var adapter = GetBestAdapter(); if (adapter != null) { if (adapter.Description.VendorId == 0x1414 && adapter.Description.DeviceId == 0x8c) { this.driverType = DriverType.Warp; this.device = new global::SharpDX.Direct3D11.Device(adapter, DeviceCreationFlags.BgraSupport, FeatureLevel.Level_10_0); } else { this.driverType = DriverType.Hardware; this.device = new global::SharpDX.Direct3D11.Device(adapter, DeviceCreationFlags.BgraSupport); } } #else this.device = new Direct3D11.Device(Direct3D.DriverType.Hardware, DeviceCreationFlags.BgraSupport, Direct3D.FeatureLevel.Level_10_1); #endif this.InitEffects(); }
public PET(CyPhyGUIs.IInterpreterMainParameters parameters, CyPhyGUIs.GMELogger logger) { this.Logger = logger; this.pet = CyPhyClasses.ParametricExploration.Cast(parameters.CurrentFCO); this.outputDirectory = parameters.OutputDirectory; this.testBench = pet.Children.TestBenchRefCollection.FirstOrDefault().Referred.TestBenchType; this.PCCPropertyInputDistributions = new Dictionary<string, string>(); // Determine type of driver of the Parametric Exploration if (this.pet.Children.PCCDriverCollection.Count() == 1) { this.theDriver = DriverType.PCC; this.driverName = "PCCDriver"; } else if (this.pet.Children.OptimizerCollection.Count() == 1) { this.theDriver = DriverType.Optimizer; this.driverName = "Optimizer"; } else if (this.pet.Children.ParameterStudyCollection.Count() == 1) { this.theDriver = DriverType.ParameterStudy; this.driverName = "ParameterStudy"; } }
public void GivenIHaveStartedTheBrowserUsingTheDriver(BrowserType browserType, DriverType driverType) { var sweetPotatoSettings = new CustomSweetPotatoSettings(browserType, driverType); var automationBrowserFactory = new AutomationBrowserFactory(); var automationBrowser = automationBrowserFactory.CreateBrowser(sweetPotatoSettings); ScenarioContext.Current.Set(automationBrowser, Constants.AutomationBrowserKey); }
static public bool InstallDriver(ref string errorMsg, DriverType driverType) { Dictionary <string, string> srcDriverPathDict = new Dictionary <string, string>(); string dstDriverPath = Environment.ExpandEnvironmentVariables("%windir%\\system32\\drivers"); srcDriverPathDict.Add("driverDir", Path.Combine( Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName), "drivers")); string srcDriverPath = string.Empty; if (driverType == DriverType.WFP) { srcDriverPathDict.Add("driverVersion", "wfp"); string osVersion = OsProxy.GetOsVersion(); if (osVersion == string.Empty) { errorMsg = "Couldn't get OS version"; return(false); } srcDriverPathDict.Add("osVersion", osVersion); } else { srcDriverPathDict.Add("driverVersion", "tdi"); } srcDriverPathDict.Add("bitCapasity", (!Environment.Is64BitOperatingSystem) ? "i386" : "amd64"); srcDriverPathDict.Add("driverName", driverName); string[] srcDriverPathArr = new string[srcDriverPathDict.Count]; srcDriverPathDict.Values.CopyTo(srcDriverPathArr, 0); srcDriverPath = Path.Combine(srcDriverPathArr); dstDriverPath = Path.Combine(dstDriverPath, srcDriverPathDict["driverName"]); try { IntPtr oldValue = IntPtr.Zero; if (Wow64DisableWow64FsRedirection(ref oldValue)) { File.Copy(srcDriverPath, dstDriverPath, true); if (Wow64RevertWow64FsRedirection(oldValue) == false) { errorMsg = "Couldn't revert Wow64 redirection"; return(false); } } else { errorMsg = "Couldn't disable Wow64 redirection"; return(false); } } catch (FileNotFoundException) { errorMsg = "driver not found"; return(false); } catch (IOException) { errorMsg = "driver already exists"; return(false); } catch (Exception e) { errorMsg = string.Format("exception {0} {1}", e.GetType(), e.Message); return(false); } //Register driver here.. RunRegUtil(RegAction.Register); SetInstalledKey(); return(true); }
private static Device CreateDeviceWithSwapChain(DriverType driverType, FeatureLevel level, SwapChainDescription swapChainDescription, out SwapChain swapChain, out CommandQueue queue) { #if DEBUG // Enable the D3D12 debug layer. // DebugInterface.Get().EnableDebugLayer(); #endif using (var factory = new Factory4()) { var adapter = driverType == DriverType.Hardware ? null : factory.GetWarpAdapter(); var device = new Device(adapter, level); queue = device.CreateCommandQueue(new CommandQueueDescription(CommandListType.Direct)); swapChain = new SwapChain(factory, queue, swapChainDescription); return device; } }
static extern IntPtr CreateDeviceA(DriverType type, int[] dim, int bits, bool full, bool stencil, bool vsync, bool antialias, IntPtr handle);
private void InizializeAndGoToStepOne(DriverType type) { Init(type); homePageServices.GetHomePageModel().StartButton.ClickIfElementIsClickable(Manager.Driver); }
public static D3D11MetaResource CreateForCoreWindowTarget(DriverType type = DriverType.Hardware, DeviceCreationFlags creationFlags = 0, SwapChainDescription1?description = null, FeatureLevel[] levels = null) { return(CreateCore(null, type, creationFlags, description, levels, false, SwapChainTarget.CoreWindow)); }
/// <summary> /// 初始化 /// </summary> /// <param name="connectinString"></param> public void Initialize(string connectinString, DriverType driverType) { dbClient.Initialize(connectinString, driverType); }
public override void InitDevice() { Width = 100; Height = 100; DriverType[] driverTypes = new DriverType[] { DriverType.Hardware, DriverType.Warp, DriverType.Reference, }; DeviceCreationFlags deviceCreationFlags = DeviceCreationFlags.BgraSupport; if (IsDebugMode) { deviceCreationFlags |= DeviceCreationFlags.Debug; } FeatureLevel[] levels = new FeatureLevel[] { FeatureLevel.Level_11_0, FeatureLevel.Level_10_1, FeatureLevel.Level_10_0, }; foreach (var driverType in driverTypes) { DeviceRef = new Device(driverType, deviceCreationFlags, levels); if (DeviceRef != null) { CurrentDriverType = driverType; break; } } DeviceRef.DebugName = "Interop Device"; DeviceRef.ImmediateContext.DebugName = "Interop Context"; CheckFeatures(); ZBufferTextureDescription = new Texture2DDescription { Format = Format.R32_Typeless, ArraySize = 1, MipLevels = 1, Width = Width, Height = Height, SampleDescription = new SampleDescription(MSamplesCount, 0), Usage = ResourceUsage.Default, BindFlags = BindFlags.DepthStencil | BindFlags.ShaderResource, CpuAccessFlags = CpuAccessFlags.None, OptionFlags = ResourceOptionFlags.None, }; Factory2D = new Factory(FactoryType.SingleThreaded, DebugLevel.Information); FactoryDWrite = new SharpDX.DirectWrite.Factory(); RenderTarget2DProperites = new RenderTargetProperties() { MinLevel = SharpDX.Direct2D1.FeatureLevel.Level_DEFAULT, //PixelFormat = new PixelFormat(Format.R8G8B8A8_UNorm, AlphaMode.Premultiplied), PixelFormat = new PixelFormat(Format.Unknown, AlphaMode.Premultiplied), Type = RenderTargetType.Default, Usage = RenderTargetUsage.None, }; }
/// <summary> /// This overload has been deprecated. Use one of the alternatives that does not take both an adapter and a driver type. /// </summary> internal static void CreateWithSwapChain(Adapter adapter, DriverType driverType, DeviceCreationFlags flags, SwapChainDescription swapChainDescription, out Device device, out SwapChain swapChain) { D3D10.CreateDeviceAndSwapChain(adapter, driverType, IntPtr.Zero, flags, D3D10.SdkVersion, ref swapChainDescription, out swapChain, out device); }
public void CreateDevice(DriverType driverType, Dimension2Di windowSize) { device = IrrlichtDevice.CreateDevice(driverType, windowSize); }
public DefaultAppConfigSettings(BrowserType browserTypeEnum, DriverType driverTypeEnum) { _browserTypeEnum = browserTypeEnum; _driverTypeEnum = driverTypeEnum; }
/// <summary> /// The validate. /// </summary> /// <returns> /// The <see cref="List" />. /// </returns> public List <Validation> Validate() { ValidationResult = DriverType.Validate(); return(ValidationResult); }
public void StartDriver() { WorkSpace.Instance.Telemetry.Add("startagent", new { AgentType = AgentType.ToString(), DriverType = DriverType.ToString() }); if (AgentType == eAgentType.Service) { StartPluginService(); GingerNodeProxy.StartDriver(); OnPropertyChanged(Fields.Status); } else { RepositoryItemHelper.RepositoryItemFactory.StartAgentDriver(this); } }
/// <summary> /// Downloads specified driver version /// </summary> /// <param name="type">Driver Type</param> /// <param name="version">Version Number</param> /// <returns>Path of driver location</returns> public static string GetSpecifiedVersion(DriverType type, string version = "") { return(GetDriverVersion(type, version)); }
/// <summary> /// Létrehoz egy sizex*sizey méretű ablakot, windowCaption címmel és deviceType renderelési eszközzel. /// </summary> /// <param name="windowCaption">Ablak címe</param> /// <param name="sizex">Ablak szélessége</param> /// <param name="sizey">Ablak magassága</param> /// <param name="deviceType">A render eszköz típusa ("DriverType.OpenGL;" (OpenGL) vagy "DriverType.Direct3D8;"/"DriverType.Direct3D9;" (DirectX))</param> /// <param name="mapName">Betöltendő pálya neve a kiterjesztés nélkül (pl. "devmap")</param> /// <param name="pak0">A pak0 fájl neve (pl. "pak0" vagy "pack1")</param> /// <param name="pak1">A pak1 fájl neve (pl. "pak1" vagy "pack4")</param> /// <param name="pak2">A pak2 fájl neve (pl. "pak2" vagy "pack2")</param> public static void createScreen(string windowCaption, int sizex, int sizey, DriverType deviceType, string mapName, string pak0, string pak1, string pak2, bool isFullScreen) { //Ablakot megjeleníteni if (isFullScreen == true) { device = IrrlichtDevice.CreateDevice(deviceType, new Dimension2Di(sizex, sizey), 32, true, false, true); } else { device = IrrlichtDevice.CreateDevice(deviceType, new Dimension2Di(sizex, sizey), 32, false, false, true); } if (device == null) return; AnimatedMesh q3levelmesh = null; device.OnEvent += new IrrlichtDevice.EventHandler(device_OnEvent); device.SetWindowCaption(Property.modName + " Build " + Property.modVersion); driver = device.VideoDriver; smgr = device.SceneManager; GUIEnvironment gui = device.GUIEnvironment; //fadein GUIInOutFader fader = device.GUIEnvironment.AddInOutFader(); fader.SetColor(new Color(0, 0, 0, 255)); fader.FadeIn(2000); //hurtOverlay = device.GUIEnvironment.AddImage(driver.GetTexture("./Content/2D/Overlays/hurt.png"), new Vector2Di(0, 0)); //hurtOverlay.Visible = false; GUIImage copyrightScreen = device.GUIEnvironment.AddImage(driver.GetTexture("./Content/2D/exit.tga"), new Vector2Di(0, 0)); float guiScalex = sizex / 800; float guiScaley = sizey / 600; copyrightScreen.Visible = false; copyrightScreen.ScaleImage = true; copyrightScreen.SetMaxSize(new Dimension2Di(sizex, sizey)); copyrightScreen.SetMinSize(new Dimension2Di(sizex, sizey)); //Betölteni a mapot try { device.FileSystem.AddFileArchive("./Content/PK3/" + pak0 + ".edsf"); } catch (Exception ex) { Logger.Log("pak0 fajl betoltese sikertelen vagy nem talalhato, a jatek nem tud betoltodni"); string error = ex.ToString(); Logger.Log(error); Environment.Exit(0); } try { device.FileSystem.AddFileArchive("./Content/PK3/" + pak1 + ".edsf"); } catch (Exception ex) { Logger.Log("pak1 fajl betoltese sikertelen vagy nem talalhato, ignoralva"); string error = ex.ToString(); Logger.Log(error); } try { device.FileSystem.AddFileArchive("./Content/PK3/" + pak2 + ".edsf"); } catch (Exception ex) { Logger.Log("pak2 fajl betoltese sikertelen vagy nem talalhato, ignoralva"); string error = ex.ToString(); Logger.Log(error); } try { q3levelmesh = smgr.GetMesh(mapName + ".bsp"); } catch (Exception ex) { Logger.Log("Palya betoltese sikertelen vagy nem talalhato, a jatek nem tud betoltodni"); string error = ex.ToString(); Logger.Log(error); Environment.Exit(0); } MeshSceneNode q3node = null; q3node = smgr.AddOctreeSceneNode(q3levelmesh.GetMesh(0), null, IDFlag_IsPickable); q3node.Position = new Vector3Df(-1350, -130, -1400); SceneNode node = null; if (mapName == "rpg") { IsRPG = true; } //LightSceneNode light = smgr.AddLightSceneNode(q3node, new Vector3Df(-1319, -118, -1410), new Color(255, 255, 255), 600.0, 10); //Half-Life Headcrab AnimatedMeshSceneNode anode3 = smgr.AddAnimatedMeshSceneNode(smgr.GetMesh("./Content/3D/headcrab.mdl")); if (IsRPG) { anode3.Position = new Vector3Df(-1212, -180, -1346); Audio.playWave("./Content/Music/rpg.mp3"); } else { anode3.Position = new Vector3Df(-1372.951f, -145.9882f, -1319.71f); } anode3.Rotation = new Vector3Df(0, 0, 0); anode3.AnimationSpeed = 1; Scenes.changeAnimation(anode3, 1, 31); anode3.SetMaterialFlag(MaterialFlag.Lighting, true); anode3.GetMaterial(0).NormalizeNormals = true; anode3.GetMaterial(0).Lighting = false; //Yodan anode2 = smgr.AddAnimatedMeshSceneNode(smgr.GetMesh("./Content/3D/yodan.mdl")); anode2.Position = new Vector3Df(-1355, -200, -1410); anode2.AnimationSpeed = 15; anode2.SetMaterialFlag(MaterialFlag.Lighting, true); anode2.GetMaterial(0).NormalizeNormals = true; anode2.GetMaterial(0).Lighting = false; anode2.SetTransitionTime(3); Scenes.changeYodanAnimation(anode2, "idle"); //SkyBox SceneNode skybox = smgr.AddSkyBoxSceneNode("./Contents/2D/Skybox/mountains_up.jpg", "./Contents/2D/Skybox/mountains_dn.jpg", "./Contents/2D/Skybox/mountains_lf.jpg", "./Contents/2D/Skybox/mountains_rt.jpg", "./Contents/2D/Skybox/mountains_ft.jpg", "./Contents/2D/Skybox/mountains_bk.jpg"); skybox.Visible = true; //FPS kamera hozzáadása camera = smgr.AddCameraSceneNodeFPS(); camera.Position = new Vector3Df(-1625.723f, -145.9937f, -1532.087f); camera.Target = new Vector3Df(-1491.555f, -1434.106f, -1368.737f); //fegyver AnimatedMesh weaponmesh = smgr.GetMesh("./Content/3D/blades.mdl"); AnimatedMeshSceneNode weapon = smgr.AddAnimatedMeshSceneNode(weaponmesh, camera, 30); weapon.Scale = new Vector3Df(0.5f, 0.5f, 0.5f); weapon.Position = new Vector3Df(0, 0, 15); weapon.Rotation = new Vector3Df(0, -90, 0); Scenes.changeAnimation(weapon, 1, 1); weapon.Visible = true; //fizika TriangleSelector selector; selector = smgr.CreateOctreeTriangleSelector(q3levelmesh.GetMesh(0), q3node, 128); q3node.TriangleSelector = selector; anim = smgr.CreateCollisionResponseAnimator(selector, camera, new Vector3Df(30, 50, 30), new Vector3Df(0, -10, 0), new Vector3Df(0, 30, 0)); //Overlay GUIImage overlay = device.GUIEnvironment.AddImage(driver.GetTexture("./Content/2D/Overlays/vignette.png"), new Vector2Di(0, 0)); overlay.ScaleImage = true; overlay.SetMaxSize(new Dimension2Di(sizex, sizey)); overlay.SetMinSize(new Dimension2Di(sizex, sizey)); selector.Drop(); camera.AddAnimator(anim); anim.Drop(); // fény lightMovementHelperNode = smgr.AddEmptySceneNode(); q3node = smgr.AddSphereSceneNode(2, 6, lightMovementHelperNode, -1, new Vector3Df(15, -10, 15)); q3node.SetMaterialFlag(MaterialFlag.Lighting, false); lightNode = q3node; //A Portré anode = smgr.AddAnimatedMeshSceneNode(smgr.GetMesh("./Content/3D/portrait.mdl")); anode.Position = new Vector3Df(-1177.601f, -137.975f, -1238.015f); anode.Rotation = new Vector3Df(0,0,0); anode.Scale = new Vector3Df(3); anode.AnimationSpeed = 1500; anode.SetMaterialFlag(MaterialFlag.Lighting, true); anode.GetMaterial(0).NormalizeNormals = true; anode.GetMaterial(0).Lighting = false; AnimatedMeshSceneNode anode4 = smgr.AddAnimatedMeshSceneNode(smgr.GetMesh("./Content/3D/waiter.mdl")); anode4.Position = new Vector3Df(-1130, -375, -1724); anode4.Rotation = new Vector3Df(0, -90, 0); anode4.Scale = new Vector3Df(2, 2, 2); anode4.SetMaterialFlag(MaterialFlag.Lighting, false); Scenes.changeAnimation(anode4, 0, 1); //Egér elrejtése device.CursorControl.Visible = false; GUIFont font = device.GUIEnvironment.BuiltInFont; SceneCollisionManager collMan = smgr.SceneCollisionManager; TextSceneNode headcrabName = smgr.AddTextSceneNode(font, "Yodan Lebegö Headcrab-je <Level 10>", new Color(255, 255, 0), null, anode3.Position + new Vector3Df(0, 25, 0), 0); TextSceneNode waiterName = smgr.AddTextSceneNode(font, "John <Level 15>", new Color(0, 255, 0), null, anode4.Position + new Vector3Df(0, 125, 0), 0); uint then = device.Timer.Time; float MOVEMENT_SPEED = 100.0f; //Energiagömb /*AnimatedMeshSceneNode anode5 = smgr.AddAnimatedMeshSceneNode(smgr.GetMesh("./Content/3D/core.mdl")); anode5.Position = new Vector3Df(-1355, 0, -1410); Scenes.changeAnimation(anode5, 0, 90); anode5.Scale = new Vector3Df(2.0f); Line3Df coreray = new Line3Df(-1355, 0, -1410, -1355, -500, -1410); driver.SetMaterial(anode5.GetMaterial(1)); driver.SetTransform(TransformationState.World, Matrix.Identity); driver.Draw3DLine(coreray, new Color(255,0,0));*/ GUIImage bartenderForm = device.GUIEnvironment.AddImage(driver.GetTexture("./Content/2D/bartender.png"), new Vector2Di(10, 10)); bartenderForm.ScaleImage = true; bartenderForm.Visible = false; bartenderForm.SetMinSize(new Dimension2Di(sizex - 10, sizey - 10)); bartenderForm.SetMaxSize(new Dimension2Di(sizex - 10, sizey - 10)); bool BartenderFormIsOpen = false; GUIImage ActionBar = device.GUIEnvironment.AddImage(driver.GetTexture("./Content/2D/Hud/Actionbar.tga"), new Vector2Di(0, 600 - 128)); //330, 110 790, 120 Recti expbarrect = new Recti(); ExperienceBar expbar = new ExperienceBar(gui, expbarrect,0, ActionBar); expbar.SetProgress(0); expbar.SetColors(new Color(255, 255, 0), new Color(255, 255, 255)); expbar.AddBorder(5, new Color(0, 0, 0)); expbar.SetMinSize(new Dimension2Di(128, 64)); expbar.SetMaxSize(new Dimension2Di(128, 64)); //Mi minek a része q3node.AddChild(anode); q3node.AddChild(anode2); q3node.AddChild(anode3); q3node.AddChild(anode4); TextSceneNode yodanName = smgr.AddTextSceneNode(font, "Yodan a Bérgyilkos <Level 90>", new Color(255, 0, 0), null, anode2.Position + new Vector3Df(0, 50, 0), 0); while (device.Run()) { driver.BeginScene(true, true, new Color(135, 206, 235)); smgr.DrawAll(); gui.DrawAll(); string printDate = dateTime.ToShortTimeString(); uint now = device.Timer.Time; float frameDeltaTime = (float)(now - then) / 1000.0f; then = now; Vector3Df nodePosition = camera.Position; if (font != null) { /*font.Draw("Build " + Property.modVersion, 5, 5, new Color(0, 0, 255)); font.Draw("pos= " + camera.Position, 5, 578 - 16, new Color(0, 0, 255)); font.Draw("tar= " + camera.Target, 5, 594 - 16, new Color(0, 0, 255));*/ font.Draw(Player.Experience(), new Vector2Di(505, 582), new Color(0,0,0)); } if (camera.Position.Z >= 10000) { font.Draw("Kiestél a Világból!", new Vector2Di(400, 300), new Color (0, 0, 0)); camera.Position = anode.Position; } if (Quest1Done) { yodanName.SetTextColor(new Color(255, 255, 0)); } if (IsKeyDown(KeyCode.Space)) { nodePosition.Y += MOVEMENT_SPEED * frameDeltaTime; } else if (IsKeyDown(KeyCode.LControl)) { nodePosition.Y -= MOVEMENT_SPEED * frameDeltaTime; } if (IsKeyDown(KeyCode.LShift)) { MOVEMENT_SPEED = 200.0f; } else { MOVEMENT_SPEED = 100.0f; } if (IsKeyDown(KeyCode.Esc)) { copyrightScreen.Visible = true; } if (IsKeyDown(KeyCode.KeyM)) { //Yodan.Run(new Vector3Df(-1642, -172, -1421), new Vector3Df(-1053, -167, -1416)); } if (IsKeyDown(KeyCode.KeyB)) { // Yodan.Wave(); Scripting.RunScript(Scripting.LoadScript()); } if (IsKeyDown(KeyCode.KeyV)) { //Yodan.Speak("./Content/Sound/vo/yodan/yo_20ft.mp3"); } else if (IsKeyDown(KeyCode.KeyN)) { //Yodan.Stand(); } else if (IsKeyDown(KeyCode.KeyC)) { //Yodan.WaveAndGreet(); } //Actionbar START //Auto-Attack if (IsKeyDown(KeyCode.Key1)) { if (!AutoAttack) { Delay(100); AutoAttack = true; if (currentWeapon == 1) { Scenes.changeAnimation(weapon, 11 + 24 + 25, 11 + 24 + 25 + 31 + 30); } else if (currentWeapon == 2) { Scenes.changeAnimation(weapon, 91 + 31 + 81 + 31, 91 + 31 + 81 + 31+90); } } else if (AutoAttack) { Delay(100); AutoAttack = false; if (currentWeapon == 1) { Scenes.changeAnimation(weapon, 1, 1); } else if (currentWeapon == 2) { Scenes.changeAnimation(weapon, 1, 90); } } } //Blades if (IsKeyDown(KeyCode.Key2)) { AnimatedMesh bladesmesh = smgr.GetMesh("./Content/3D/blades.mdl"); weapon.Mesh = bladesmesh; weapon.Scale = new Vector3Df(0.5f, 0.5f, 0.5f); weapon.Position = new Vector3Df(0, 0, 15); weapon.Rotation = new Vector3Df(0, -90, 0); Scenes.changeAnimation(weapon, 1, 1); currentWeapon = 1; } //Crossbow if (IsKeyDown(KeyCode.Key3)) { AnimatedMesh crossbowmesh = smgr.GetMesh("./Content/3D/crossbow.mdl"); weapon.Mesh = crossbowmesh; Scenes.changeAnimation(weapon, 1, 90); weapon.Scale = new Vector3Df(3.0f, 3.0f, 3.0f); currentWeapon = 2; } if (IsKeyDown(KeyCode.Key4)) { if (IsEtlapPickedUp) { bartenderForm.Visible = true; BartenderFormIsOpen = true; Audio.playWave("./Content/sound/paper_pickup.mp3"); } } //Actionbar END //elteszi/előveszi a fegyvert if(IsKeyDown(KeyCode.Tab)) { if(weaponHolster) { weapon.Visible = false; Audio.playWave("./Content/sound/weapon.mp3"); weaponHolster = false; } else { weapon.Visible = true; Audio.playWave("./Content/sound/weapon.mp3"); weaponHolster = true; } } if (IsKeyDown(KeyCode.MouseLButton)) { AutoAttack = true; if (currentWeapon == 1) { Scenes.changeAnimation(weapon, 11 + 24 + 25, 11 + 24 + 25 + 31 + 30); } else if (currentWeapon == 2) { Scenes.changeAnimation(weapon, 91 + 31 + 81 + 31, 91 + 31 + 81 + 31 + 90); } } else if (!IsKeyDown(KeyCode.MouseLButton)) { AutoAttack = false; if (currentWeapon == 1) { Scenes.changeAnimation(weapon, 1, 1); } else if (currentWeapon == 2) { Scenes.changeAnimation(weapon, 1, 90); } } if (IsKeyDown(KeyCode.KeyX)) { Texture yodanMissing = driver.GetTexture("./Content/2D/yodanmissing.tga"); Dimension2Di yodanMisSiz = yodanMissing.Size; yodanMisSiz = anode.GetMaterial(0).GetTexture(0).Size; anode.SetMaterialTexture(0, yodanMissing); } if (IsKeyDown(KeyCode.KeyE)) { //Bartender Johh On-Use Vector3Df camtarget = camera.Target; if (!BartenderFormIsOpen) { if (new Vector3Df(727, 221, -986) <= camtarget) { if (new Vector3Df(763, 276, -2329) >= camtarget) { if (camtarget > new Vector3Df(184, -1843, -1255)) { if (camtarget > new Vector3Df(138, -1837, -2318)) { bartenderForm.Visible = true; BartenderFormIsOpen = true; if (!IsEtlapPickedUp) { ActionBar.Image = driver.GetTexture("./Content/2D/Hud/Actionbar_etlap.tga"); Audio.playWave("./Content/sound/vo/waiter_john/teatime.mp3"); } IsEtlapPickedUp = true; Audio.playWave("./Content/sound/paper_pickup.mp3"); } } } } } else if (BartenderFormIsOpen) { bartenderForm.Visible = false; BartenderFormIsOpen = false; Audio.playWave("./Content/sound/paper_pickup.mp3"); } } if (IsKeyDown(KeyCode.KeyK)) { //Yodan.GoGhost(); } if (IsKeyDown(KeyCode.KeyJ)) { //Yodan.GoNormal(); } if (IsKeyDown(KeyCode.KeyL)) { } if (IsKeyDown(KeyCode.F7)) { Delay(500); takeScreenshot(device); } if (IsKeyDown(KeyCode.F9)) { Delay(500); string campos = camera.Position.ToString(); Logger.Log("position:" + campos); string camtar = camera.Target.ToString(); Logger.Log("target: " + camtar); } if (IsKeyDown(KeyCode.LShift)) { if (IsKeyDown(KeyCode.KeyY)) { Environment.Exit(0); } else if (IsKeyDown(KeyCode.KeyN)) { copyrightScreen.Visible = false; } } camera.Position = nodePosition; driver.EndScene(); } device.Drop(); }
public DriverManager(DriverType type) { Type = type; Driver = GetDriver(type); }
/// <summary> /// Constructor for a D3D10.1 Device. See <see cref = "SharpDX.Direct3D10.D3D10.CreateDevice1" /> for more information. /// </summary> /// <param name = "driverType"></param> /// <param name = "flags"></param> /// <param name="featureLevel"></param> public Device1(DriverType driverType, DeviceCreationFlags flags, FeatureLevel featureLevel) : base(IntPtr.Zero) { CreateDevice(null, driverType, flags, featureLevel); }
/// <summary> /// Constructor for a D3D11 Device. See <see cref = "SharpDX.Direct3D11.D3D11.CreateDevice" /> for more information. /// </summary> /// <param name = "driverType"></param> /// <param name = "flags"></param> /// <param name = "featureLevels"></param> /// <msdn-id>ff476082</msdn-id> /// <unmanaged>HRESULT D3D11CreateDevice([In, Optional] IDXGIAdapter* pAdapter,[In] D3D_DRIVER_TYPE DriverType,[In] HINSTANCE Software,[In] D3D11_CREATE_DEVICE_FLAG Flags,[In, Buffer, Optional] const D3D_FEATURE_LEVEL* pFeatureLevels,[In] unsigned int FeatureLevels,[In] unsigned int SDKVersion,[Out, Fast] ID3D11Device** ppDevice,[Out, Optional] D3D_FEATURE_LEVEL* pFeatureLevel,[Out, Optional] ID3D11DeviceContext** ppImmediateContext)</unmanaged> /// <unmanaged-short>D3D11CreateDevice</unmanaged-short> public Device(DriverType driverType, DeviceCreationFlags flags, params FeatureLevel[] featureLevels) { CreateDevice(null, driverType, flags, featureLevels); }
public void CheckingTheClassChangeForTheElementAfterChangingTheDimensionsOnTheDependentWall([Values] DriverType type) { InizializeAndGoToStepOne(type); ShapesRoomWCModel shapes = shapeServices.GetShapes(); shapes.ClickShapeById("27"); DimensionsWCModel roomDimension = dimensionServices.GetDimensions(); roomDimension.GetFieldByDescription("A").PlusSign.ClickIfElementIsClickable(Manager.Driver); Assert.IsTrue(roomDimension.GetFieldByDescription("C").Input.GetAttribute("class").Equals("wallSizeInput changed")); }
/// <summary> /// Downloads latest driver version /// </summary> /// <param name="type">Driver type</param> /// <returns>Path of driver location</returns> public static string GetLatestVersion(DriverType type) { return(GetDriverVersion(type)); }
public static unsafe extern bool SetupDiBuildDriverInfoList( SafeDeviceInfoSetHandle deviceInfoSet, [Friendly(FriendlyFlags.In | FriendlyFlags.Optional)] SP_DEVINFO_DATA *deviceInfoData, DriverType driverType);
public static unsafe extern bool SetupDiEnumDriverInfo( SafeDeviceInfoSetHandle deviceInfoSet, [Friendly(FriendlyFlags.In | FriendlyFlags.Optional)] SP_DEVINFO_DATA *deviceInfoData, DriverType driverType, uint memberIndex, [Friendly(FriendlyFlags.Bidirectional)] SP_DRVINFO_DATA *driverInfoData);
public TestCases(DriverType driverType) : base(driverType) { }
private void CreateDevice(Adapter adapter, DriverType driverType, DeviceCreationFlags flags, FeatureLevel featureLevel) { D3D10.CreateDevice1(adapter, driverType, IntPtr.Zero, flags, featureLevel, D3D10.SdkVersion1, this); }
/// <summary> /// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D11.Device" /> class along with a new <see cref = "T:SharpDX.DXGI.SwapChain" /> used for rendering. /// </summary> /// <param name = "driverType">The type of device to create.</param> /// <param name = "flags">A list of runtime layers to enable.</param> /// <param name = "swapChainDescription">Details used to create the swap chain.</param> /// <param name = "device">When the method completes, contains the created device instance.</param> /// <param name = "swapChain">When the method completes, contains the created swap chain instance.</param> /// <returns>A <see cref = "T:SharpDX.Result" /> object describing the result of the operation.</returns> public static void CreateWithSwapChain(DriverType driverType, DeviceCreationFlags flags, SwapChainDescription swapChainDescription, out Device device, out SwapChain swapChain) { CreateWithSwapChain(null, driverType, flags, null, swapChainDescription, out device, out swapChain); }
/// <summary> /// Constructor for a D3D10.1 Device. See <see cref = "SharpDX.Direct3D10.D3D10.CreateDevice1" /> for more information. /// </summary> /// <param name = "driverType"></param> /// <param name = "flags"></param> public Device1(DriverType driverType, DeviceCreationFlags flags) : this(driverType, flags, FeatureLevel.Level_10_1) { }
/// <summary> /// Initializes a new instance of the <see cref="Device"/> class. /// </summary> /// <param name="driverType"> /// Type of the driver. /// </param> /// <msdn-id>ff476082</msdn-id> /// <unmanaged>HRESULT D3D11CreateDevice([In, Optional] IDXGIAdapter* pAdapter,[In] D3D_DRIVER_TYPE DriverType,[In] HINSTANCE Software,[In] D3D11_CREATE_DEVICE_FLAG Flags,[In, Buffer, Optional] const D3D_FEATURE_LEVEL* pFeatureLevels,[In] unsigned int FeatureLevels,[In] unsigned int SDKVersion,[Out, Fast] ID3D11Device** ppDevice,[Out, Optional] D3D_FEATURE_LEVEL* pFeatureLevel,[Out, Optional] ID3D11DeviceContext** ppImmediateContext)</unmanaged> /// <unmanaged-short>D3D11CreateDevice</unmanaged-short> public Device(DriverType driverType) : this(driverType, DeviceCreationFlags.None) { }
/// <summary> /// Initializes a new instance of the <see cref = "T:SharpDX.Direct3D10.Device1" /> class along with a new <see cref = "T:SharpDX.DXGI.SwapChain" /> used for rendering. /// </summary> /// <param name = "driverType">The type of device to create.</param> /// <param name = "flags">A list of runtime layers to enable.</param> /// <param name = "swapChainDescription">Details used to create the swap chain.</param> /// <param name = "device">When the method completes, contains the created device instance.</param> /// <param name = "swapChain">When the method completes, contains the created swap chain instance.</param> /// <returns>A <see cref = "T:SharpDX.Result" /> object describing the result of the operation.</returns> public static void CreateWithSwapChain(DriverType driverType, DeviceCreationFlags flags, SwapChainDescription swapChainDescription, out Device1 device, out SwapChain swapChain) { CreateWithSwapChain(null, driverType, flags, swapChainDescription, FeatureLevel.Level_10_1, out device, out swapChain); }
/// <summary> /// Creates new instance of <see cref="DirectXRenderingBackend" /> with specified <see cref="Form" /> as render target. /// </summary> /// <param name="form"><see cref="Form" /> that serves as render target.</param> /// <param name="driverType">Type of driver to use by rendering API.</param> public DirectXRenderingBackend(Form form, DriverType driverType) { _renderer2D = new Renderer2D(form, driverType); }
/// <summary> /// Constructor for a D3D11 Device. See <see cref="SharpDX.Direct3D11.D3D11.CreateDevice"/> for more information. /// </summary> /// <param name="driverType">Type of the driver.</param> /// <param name="flags">The flags.</param> /// <msdn-id>ff476082</msdn-id> /// <unmanaged>HRESULT D3D11CreateDevice([In, Optional] IDXGIAdapter* pAdapter,[In] D3D_DRIVER_TYPE DriverType,[In] HINSTANCE Software,[In] D3D11_CREATE_DEVICE_FLAG Flags,[In, Buffer, Optional] const D3D_FEATURE_LEVEL* pFeatureLevels,[In] unsigned int FeatureLevels,[In] unsigned int SDKVersion,[Out, Fast] ID3D11Device** ppDevice,[Out, Optional] D3D_FEATURE_LEVEL* pFeatureLevel,[Out, Optional] ID3D11DeviceContext** ppImmediateContext)</unmanaged> /// <unmanaged-short>D3D11CreateDevice</unmanaged-short> public Device(DriverType driverType, DeviceCreationFlags flags) { CreateDevice(null, driverType, flags, null); }
public CustomSweetPotatoSettings(BrowserType browserType, DriverType driverType) { _browserType = browserType; _driverType = driverType; }
private void CreateDevice(Adapter adapter, DriverType driverType, DeviceCreationFlags flags) { D3D10.CreateDevice(adapter, driverType, IntPtr.Zero, flags, D3D10.SdkVersion, this); }
/// <summary> /// Initialize DirectX factories, swap chain and render targets. /// </summary> protected void InitGraphics() { var width = Size.Width; var height = Size.Height; Factory2D = new Factory(); FactoryDirectWrite = new SharpDX.DirectWrite.Factory(); var desc = new SwapChainDescription { BufferCount = 1, ModeDescription = new ModeDescription(width, height, new Rational(60, 1), Format.R8G8B8A8_UNorm), IsWindowed = true, OutputHandle = Handle, SampleDescription = new SampleDescription(1, 0), SwapEffect = SwapEffect.Discard, Usage = Usage.RenderTargetOutput | Usage.BackBuffer, }; // use software driver if RDP or VirtualMachine _driverType = MM_System_Profiling.IsTerminalOrVirtual() ? DriverType.Warp : DriverType.Hardware; bool swapChainCreated = false; while (!swapChainCreated) { try { Device.CreateWithSwapChain(_driverType, DeviceCreationFlags.BgraSupport, desc, out _device, out _swapChain); MM_System_Interfaces.LogError("Initialized DirectX Driver: {0}", _driverType); swapChainCreated = true; } catch (Exception ex) { // downgrade driver and try again using outer while loop if (_driverType == DriverType.Hardware) { _driverType = DriverType.Warp; } else if (_driverType == DriverType.Warp) { _driverType = DriverType.Software; } else { MM_System_Interfaces.LogError(ex); throw new NotSupportedException("DirectX Rendering could not be initialized using hardware of software.", ex); } } } Context = _device.ImmediateContext; // Ignore all windows events FactoryDxgi = _swapChain.GetParent <SharpDX.DXGI.Factory>(); FactoryDxgi.MakeWindowAssociation(Handle, WindowAssociationFlags.IgnoreAll); // New RenderTargetView from the backbuffer _backBuffer = Resource.FromSwapChain <Texture2D>(_swapChain, 0); RenderTargetView = new RenderTargetView(_device, _backBuffer); DxgiSurface = _backBuffer.QueryInterface <Surface>(); RenderTarget2D = new RenderTarget(Factory2D, DxgiSurface, new RenderTargetProperties(new PixelFormat(Format.Unknown, AlphaMode.Premultiplied))); RenderTarget2D.AntialiasMode = AntialiasMode; PresenterReady = true; }