private static int FuncBody(IntPtr parLuaState) { if (!enabled) { if (Lua.ArgsCount(parLuaState) != 1 || !Lua.IsString(parLuaState, 1)) { Lua.Print("Usage is UseItem(\\\"name\\\")"); return(0); } string item = Lua.ToString(parLuaState, 1); if (!ObjectManager.EnumObjects()) { return(0); } target = ObjectManager.Target; if (target == null) { return(0); } if (ObjectManager.Player.Inventory.ItemCount(item) == 0) { return(0); } ObjectManager.Player.Inventory.UseItem(item); enabled = true; DirectX.RunInEndScene(EndScene); Wait.Remove("GrenadeTimeout"); } return(0); }
// void UnitTest() { DirectX theDirectX = new DirectX(); // 加入形狀 ShapeContainer theShapeContainer = new ShapeContainer(); theShapeContainer.AddShape(new Cube(theDirectX)); theShapeContainer.AddShape(new Cylinder(theDirectX)); theShapeContainer.AddShape(new Sphere(theDirectX)); // 繪圖 theShapeContainer.RunVisitor(new DrawVisitor()); // 頂點數 VectorCountVisitor theVectorCount = new VectorCountVisitor(); theShapeContainer.RunVisitor(theVectorCount); Debug.Log("頂點數:" + theVectorCount.Count); // 圓體積 SphereVolumeVisitor theSphereVolume = new SphereVolumeVisitor(); theShapeContainer.RunVisitor(theSphereVolume); Debug.Log("圓體積:" + theSphereVolume.Volume); }
public void Render() { DirectX.BeginScene(0.75f, 0.75f, 0.75f, 1f); foreach (RenderableGameComponent item in _renderables) { if (item.BlendingEnabled) { DirectX.EnableAlphaBlending(); } else { DirectX.DisableAlphaBlending(); } if (item.DisplayWireframe) { DirectX.EnableWireFrame(); } else { DirectX.DisableWireFrame(); } if (item.ZBufferEnabled) { DirectX.EnableZBuffer(); item.Render(DirectX.DeviceContext, Camera.ViewMatrix, DirectX.ProjectionMatrix); } else { DirectX.DisableZBuffer(); item.Render(DirectX.DeviceContext, Camera.UiMatrix, DirectX.OrthoMatrix); } } DirectX.DrawScene(); }
internal override void Run() { if (Wait.For("DRS_TarPlayer", ran.Next(4000, 8001))) { var players = ObjectManager.Players.Where(i => Calc.Distance2D(i.Position, ObjectManager.Player.Position) <= 30) .ToList(); if (players.Count == 1) { return; } var ranValue = ran.Next(0, players.Count); var randomPlayer = players[ranValue]; ObjectManager.Player.SetTarget(randomPlayer.Guid); } if (Wait.For("DRS_RandomMovement", ran.Next(8000, 16001))) { var lastFlags = _randomFlag; ObjectManager.Player.StartMovement(lastFlags); var stopThread = new Thread(() => { Thread.Sleep(ran.Next(0, 601)); DirectX.RunAndSwapbackIngame((ref int count, bool ingame) => { ObjectManager.Player.StopMovement(lastFlags); }); }); stopThread.Start(); } }
public bool Initialise(DirectX directXDevice, Dimension screenSize) { Font = new Font(); var result = Font.Initialise(directXDevice.Device, "font01.txt", "font01.bmp", 32.0f, 3); FpsString = new Text(); result &= FpsString.Initialise(directXDevice.Device, Font, screenSize, 16, "FPS: 0", new Coordinate2D <int>(10, 50), new Colour(NamedColour.Green), false, directXDevice.DeviceContext); PreviousFPS = -1; PositionStrings = new Text[6]; for (int i = 0; i < PositionStrings.Length; ++i) { PositionStrings[i] = new Text(); } result &= PositionStrings[0].Initialise(directXDevice.Device, Font, screenSize, 16, "X: 0", new Coordinate2D <int>(10, 90), new Colour(NamedColour.White), false, directXDevice.DeviceContext); result &= PositionStrings[1].Initialise(directXDevice.Device, Font, screenSize, 16, "Y: 0", new Coordinate2D <int>(10, 110), new Colour(NamedColour.White), false, directXDevice.DeviceContext); result &= PositionStrings[2].Initialise(directXDevice.Device, Font, screenSize, 16, "Z: 0", new Coordinate2D <int>(10, 130), new Colour(NamedColour.White), false, directXDevice.DeviceContext); result &= PositionStrings[3].Initialise(directXDevice.Device, Font, screenSize, 16, "rX: 0", new Coordinate2D <int>(10, 170), new Colour(NamedColour.White), false, directXDevice.DeviceContext); result &= PositionStrings[4].Initialise(directXDevice.Device, Font, screenSize, 16, "rY: 0", new Coordinate2D <int>(10, 190), new Colour(NamedColour.White), false, directXDevice.DeviceContext); result &= PositionStrings[5].Initialise(directXDevice.Device, Font, screenSize, 16, "rZ: 0", new Coordinate2D <int>(10, 210), new Colour(NamedColour.White), false, directXDevice.DeviceContext); PreviousPositions = new int[6]; VideoStrings = new Text[2]; for (int i = 0; i < VideoStrings.Length; ++i) { VideoStrings[i] = new Text(); } result &= VideoStrings[0].Initialise(directXDevice.Device, Font, screenSize, 256, directXDevice.VideoCardDescription, new Coordinate2D <int>(10, 10), new Colour(NamedColour.White), false, directXDevice.DeviceContext); result &= VideoStrings[1].Initialise(directXDevice.Device, Font, screenSize, 64, directXDevice.VideoCardMemory.ToString(), new Coordinate2D <int>(10, 30), new Colour(NamedColour.White), false, directXDevice.DeviceContext); return(result); }
private void bLogin_Click(object sender, EventArgs e) { if (Relog.LoginState == "login") { DirectX.RunAndSwapback(LoginEndScene); } }
// void UnitTest() { DirectX theDirectX = new DirectX(); // 加入形状 ShapeContainer theShapeContainer = new ShapeContainer(); theShapeContainer.AddShape(new Cube(theDirectX)); theShapeContainer.AddShape(new Cylinder(theDirectX)); theShapeContainer.AddShape(new Sphere(theDirectX)); // 绘圆 theShapeContainer.RunVisitor(new DrawVisitor()); // 顶点数 VectorCountVisitor theVectorCount = new VectorCountVisitor(); theShapeContainer.RunVisitor(theVectorCount); Debug.Log("顶点数:" + theVectorCount.Count); // 圆体积 SphereVolumeVisitor theSphereVolume = new SphereVolumeVisitor(); theShapeContainer.RunVisitor(theSphereVolume); Debug.Log("圆体积:" + theSphereVolume.Volume); }
private static int FuncBody(IntPtr parLuaState) { if (Lua.ArgsCount(parLuaState) != 0) { return(0); } if (!enabled) { Lua.Print("Starting to loot all corpses in range"); if (ObjectManager.EnumObjects()) { List <WoWUnit> mobs = ObjectManager.Mobs; lootableUnits = mobs.OfType <WoWUnit>() .Where(i => i.CanBeLooted && i.DistanceTo(ObjectManager.Player) < 4.20f) .OrderBy(i => i.DistanceTo(ObjectManager.Player)) .ToList(); lootCounter = 0; lootOpen = false; enabled = true; Wait.Remove("LootOpenBlacklist"); Wait.Remove("LootClickBlacklist"); AntiWarden.HookWardenMemScan.GetHack("LootPatch").Apply(); if (AutoLoot.enabled) { OnRightClickUnitHook.Remove(); OnRightClickObjectHook.Remove(); } DirectX.RunInEndScene(EndScene); } } return(0); }
private static int FuncBody(IntPtr parLuaState) { if (!enabled) { if (Lua.ArgsCount(parLuaState) != 1 || !Lua.IsString(parLuaState, 1)) { Lua.Print("Usage is UseSpell(\\\"name\\\")"); return(0); } string spell = Lua.ToString(parLuaState, 1); if (!ObjectManager.EnumObjects()) { return(0); } target = ObjectManager.Target; if (target == null) { return(0); } Functions.DoString("CastSpellByName('" + spell + "');"); enabled = true; DirectX.RunInEndScene(EndScene); Wait.Remove("SpellTimeout"); } return(0); }
internal ProfileCreator() { if (DirectX.RunInEndScene(CreateProfile)) { Main.MainForm.lRecording.Text = "Recording"; Main.MainForm.lRecording.Visible = true; } }
private void button1_Click_3(object sender, EventArgs e) { DirectX.RunAndSwapbackIngame((ref int framecount, bool ingame) => { var b = ObjectManager.Player.Inventory.IsMainhandEnchanted; Console.WriteLine(b); }); }
private static void EndScene(ref int parFrameCount) { if (lootableUnits.Count == lootCounter) { enabled = false; lootOpen = false; Wait.Remove("LootOpenBlacklist"); Wait.Remove("LootClickBlacklist"); DirectX.StopRunning(); Lua.Print("We are done looting"); if (AutoLoot.enabled) { OnRightClickUnitHook.Apply(); OnRightClickObjectHook.Apply(); } AntiWarden.HookWardenMemScan.GetHack("LootPatch").Remove(); } else { if (Wait.For("LootUnit", 250)) { if (!Functions.IsLooting(ObjectManager.Player.Pointer)) { if (lootOpen) { lootCounter++; if (lootableUnits.Count == lootCounter) { return; } } Wait.Remove("LootOpenBlacklist"); if (Wait.For("LootClickBlacklist", 5000)) { lootCounter++; Wait.Remove("LootClickBlacklist"); return; } Functions.OnRightClickUnit(lootableUnits[lootCounter].Pointer, 0); lootOpen = false; } else { lootOpen = true; Wait.Remove("LootClickBlacklist"); Functions.LootAll(); if (Wait.For("LootOpenBlacklist", 5000)) { lootCounter++; Wait.Remove("LootOpenBlacklist"); Functions.DoString("LootCloseButton:Click()"); return; } } } } }
internal ProfileCreator(Forms.GraphicalProfileCreationForm newProfileForm) { usedProfileForm = newProfileForm; if (DirectX.RunInEndScene(CreateProfile)) { usedProfileForm.lRecording.Text = "Recording"; usedProfileForm.Text = "Recording new Profile"; usedProfileForm.lRecording.Visible = true; } }
public Capture(DirectX.Capture.Filter videoDevice, DirectX.Capture.Filter audioDevice) { if ((videoDevice == null) && (audioDevice == null)) { throw new ArgumentException("The videoDevice and/or the audioDevice parameter must be set to a valid Filter.\n"); } this.videoDevice = videoDevice; this.audioDevice = audioDevice; this.Filename = this.getTempFilename(); this.createGraph(); }
void Start() { //Test IRenderEngine renderEngine = new DirectX(); Cube cube = new Cube(renderEngine); cube.Draw(); Sphere sphere = new Sphere(renderEngine); sphere.Draw(); }
private void button1_Click_1(object sender, EventArgs e) { DirectX.RunAndSwapbackIngame((ref int FrameCount, bool IsIngame) => { var i = ObjectManager.Target; var canLoot = ((i.CanBeLooted || (Options.SkinUnits && i.IsSkinable && (Options.NinjaSkin || i.TappedByMe)) ) && !i.IsSwimming && Calc.Distance3D(i.Position, ObjectManager.Player.Position) < 32); }); }
public BoxOverlayShader() { vertex = new DirectX.Shader(DirectX.Shader.Type.Vertex, GetVertexSource(), "BoxOverlayVertex", out var bytecode); pixel = new DirectX.Shader(DirectX.Shader.Type.Pixel, GetPixelSource(), "BoxOverlayPixel"); var dev = Device.Get(); input = new InputLayout(dev.Handle, bytecode, new InputElement[] { new InputElement("POSITION", 0, Format.R32G32_Float, 0) }); }
// Use this for initialization void Start() { IRenderEngine renderEngine = new DirectX(); Sphere sphere = new Sphere(renderEngine); sphere.Draw(); Cube cube = new Cube(renderEngine); cube.Draw(); Capsule capsule = new Capsule(renderEngine); capsule.Draw(); }
private void Start() { //IRenderEngine renderEngine = new OpenGL(); IRenderEngine renderEngine = new DirectX(); Sphere sphere = new Sphere(renderEngine); sphere.Draw(); Cube cube = new Cube(renderEngine); cube.Draw(); }
public static int Initialize(PixelShaderEffect * @this, ID2D1EffectContext *effectContext, ID2D1TransformGraph *transformGraph) { int hresult = effectContext->LoadPixelShader( shaderId: &@this->shaderId, shaderBuffer: @this->bytecode, shaderBufferCount: (uint)@this->bytecodeSize); // If E_INVALIDARG was returned, try to check whether double precision support was requested when not available. This // is only done to provide a more helpful error message to callers. If no error was returned, the behavior is the same. if (hresult == E.E_INVALIDARG) { D2D1_FEATURE_DATA_DOUBLES d2D1FeatureDataDoubles = default; // If the call failed, just do nothing and return the previous result if (!Windows.SUCCEEDED(effectContext->CheckFeatureSupport(D2D1_FEATURE.D2D1_FEATURE_DOUBLES, &d2D1FeatureDataDoubles, (uint)sizeof(D2D1_FEATURE_DATA_DOUBLES)))) { return(E.E_INVALIDARG); } // If the context does not support double precision values, check whether the shader requested them if (d2D1FeatureDataDoubles.doublePrecisionFloatShaderOps == 0) { using ComPtr <ID3D11ShaderReflection> d3D11ShaderReflection = default; // Create the reflection instance, and in case of error just return the previous error like above if (!Windows.SUCCEEDED(DirectX.D3DReflect( pSrcData: @this->bytecode, SrcDataSize: (uint)@this->bytecodeSize, pInterface: Windows.__uuidof <ID3D11ShaderReflection>(), ppReflector: d3D11ShaderReflection.GetVoidAddressOf()))) { return(E.E_INVALIDARG); } // If the shader requires double precision support, return a more descriptive error if ((d3D11ShaderReflection.Get()->GetRequiresFlags() & (D3D.D3D_SHADER_REQUIRES_DOUBLES | D3D.D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS)) != 0) { return(D2DERR.D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES); } } } if (Windows.SUCCEEDED(hresult)) { hresult = transformGraph->SetSingleTransformNode((ID2D1TransformNode *)&@this->lpVtblForID2D1DrawTransform); } return(hresult); }
private void StopGrinder(ref int FrameCounter, bool IsIngame) { Memory.GetHack("Ctm").Remove(); if (IsIngame) { // disable all current ingame movements if we are ingame ObjectManager.Player.CtmStopMovement(); } HookWardenMemScan.GetHack("Collision3").Remove(); HookWardenMemScan.GetHack("Collision").Remove(); // we arent running anymore Access = null; ErrorEnumHook.OnNewError -= ErrorEnum_OnNewError; DirectX.StopRunning(); }
private void Start() { DirectX dx = new DirectX(); Sphere s = new Sphere(dx); s.Draw(); Cube c = new Cube(dx); c.Draw(); OpenGL ogl = new OpenGL(); Cylinder cy = new Cylinder(ogl); cy.Draw(); }
/// <summary> /// Creates an <see cref="ID2D1Factory2"/> instance. /// </summary> /// <returns>A new <see cref="ID2D1Factory2"/> instance.</returns> public static unsafe ComPtr <ID2D1Factory2> CreateD2D1Factory2() { using ComPtr <ID2D1Factory2> d2D1Factory2 = default; D2D1_FACTORY_OPTIONS d2D1FactoryOptions = default; // Create a Direct2D factory DirectX.D2D1CreateFactory( factoryType: D2D1_FACTORY_TYPE.D2D1_FACTORY_TYPE_SINGLE_THREADED, riid: Windows.__uuidof <ID2D1Factory2>(), pFactoryOptions: &d2D1FactoryOptions, ppIFactory: (void **)d2D1Factory2.GetAddressOf()).Assert(); return(d2D1Factory2.Move()); }
public static void UnitTest() { DirectX theDirectX = new DirectX(); ShapeContainer theShapeContainer = new ShapeContainer(); theShapeContainer.AddShape(new Cube(theDirectX)); theShapeContainer.AddShape(new Sphere(theDirectX)); theShapeContainer.RunVisitor(new DrawVisitor()); VertexCountVisitor theVectorCount = new VertexCountVisitor(); theShapeContainer.RunVisitor(theVectorCount); System.Console.WriteLine("Vertex Count: " + theVectorCount.Count); }
private static void EndScene(ref int parFrameCount) { if (Wait.For("UseItemTimer", 100)) { if (Memory.Reader.Read <int>((IntPtr)0x00CECAC0) == 64) { Functions.HandleSpellTerrain(target.Position); enabled = false; DirectX.StopRunning(); } else if (Wait.For("GrenadeTimeout", 250)) { enabled = false; DirectX.StopRunning(); } } }
private void StopIt() { Main.MainForm.tbHotspots.Text = ""; Main.MainForm.tbVendorHotspots.Text = ""; Main.MainForm.tbGhostHotspots.Text = ""; Main.MainForm.tbFactions.Text = ""; Main.MainForm.tbRepair.Text = ""; Main.MainForm.tbVendor.Text = ""; Main.MainForm.tbRestock.Text = ""; Main.MainForm.tbRestockItems.Text = ""; Main.MainForm.cbIgnoreZ.Checked = false; Main.MainForm.lHotspotCount.Text = "Count: "; Main.MainForm.lVendorHotspotCount.Text = "Count: "; Main.MainForm.lFactionCount.Text = "Count: "; Main.MainForm.lGhostHotspotCount.Text = "Count: "; Main.MainForm.lRecording.Visible = false; DirectX.StopRunning(); }
/// <summary> /// Creates an <see cref="ID2D1Device"/> instance. /// </summary> /// <param name="d2D1Factory2">The input <see cref="ID2D1Factory2"/> instance to use to create the device.</param> /// <returns>A new <see cref="ID2D1Device"/> instance.</returns> public static unsafe ComPtr <ID2D1Device> CreateD2D1Device(ID2D1Factory2 *d2D1Factory2) { using ComPtr <ID3D11Device> d3D11Device = default; uint creationFlags = (uint)D3D11_CREATE_DEVICE_FLAG.D3D11_CREATE_DEVICE_BGRA_SUPPORT; D3D_FEATURE_LEVEL *featureLevels = stackalloc[] { D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_9_3, D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_9_2, D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_9_1 }; D3D_FEATURE_LEVEL d3DFeatureLevel; // Create the Direct3D 11 API device and context DirectX.D3D11CreateDevice( pAdapter: null, DriverType: D3D_DRIVER_TYPE.D3D_DRIVER_TYPE_HARDWARE, Software: HMODULE.NULL, Flags: creationFlags, pFeatureLevels: featureLevels, FeatureLevels: 7, SDKVersion: D3D11.D3D11_SDK_VERSION, ppDevice: d3D11Device.GetAddressOf(), pFeatureLevel: &d3DFeatureLevel, ppImmediateContext: null).Assert(); using ComPtr <IDXGIDevice3> dxgiDevice3 = default; // Get a DXGI device from the D3D11 device d3D11Device.CopyTo(dxgiDevice3.GetAddressOf()).Assert(); using ComPtr <ID2D1Device> d2D1Device = default; // Create a D2D1 device d2D1Factory2->CreateDevice( dxgiDevice: (IDXGIDevice *)dxgiDevice3.Get(), d2dDevice: d2D1Device.GetAddressOf()); return(d2D1Device.Move()); }
private void StopIt() { usedProfileForm.tbHotspots.Text = ""; usedProfileForm.tbVendorWaypoints.Text = ""; usedProfileForm.tbGhostHotspots.Text = ""; usedProfileForm.tbFactions.Text = ""; usedProfileForm.tbRepair.Text = ""; usedProfileForm.tbVendor.Text = ""; usedProfileForm.tbRestock.Text = ""; usedProfileForm.tbRestockItems.Text = ""; usedProfileForm.cbIgnoreZ.Checked = false; usedProfileForm.lHotspotCount.Text = "Count: "; usedProfileForm.lFactionCount.Text = "Count: "; usedProfileForm.lGhostHotspotCount.Text = "Count: "; usedProfileForm.lbl_VendorWaypointsCount.Text = "Count: "; usedProfileForm.lRecording.Visible = false; usedProfileForm.Text = "Recording stopped!"; DirectX.StopRunning(); }
public void Render(DirectX directXDevice, ShaderManager shaderManager, Matrix worldMatrix, Matrix viewMatrix, Matrix orthoMatrix) { directXDevice.SetZBuffer(false); directXDevice.SetAlphaBlending(true); FpsString.Render(directXDevice.DeviceContext, shaderManager, worldMatrix, viewMatrix, orthoMatrix, Font.Texture.TextureResource); foreach (var positionString in PositionStrings) { positionString.Render(directXDevice.DeviceContext, shaderManager, worldMatrix, viewMatrix, orthoMatrix, Font.Texture.TextureResource); } foreach (var videoString in VideoStrings) { videoString.Render(directXDevice.DeviceContext, shaderManager, worldMatrix, viewMatrix, orthoMatrix, Font.Texture.TextureResource); } directXDevice.SetZBuffer(true); directXDevice.SetAlphaBlending(false); }
/// <summary> /// Embeds the bytecode for an exported shader as private data into another shader bytecode. /// </summary> /// <param name="shaderBlob">The bytecode produced by <see cref="CompileD2DFullShader(ReadOnlySpan{char}, D2D1ShaderProfile)"/>.</param> /// <param name="exportBlob">The bytecode produced by <see cref="CompileD2DFunction(ReadOnlySpan{char}, D2D1ShaderProfile)"/>.</param> /// <returns>An <see cref="ID3DBlob"/> instance with the combined data of <paramref name="shaderBlob"/> and <paramref name="exportBlob"/>.</returns> private static ComPtr <ID3DBlob> EmbedD2DFunctionPrivateData(ID3DBlob *shaderBlob, ID3DBlob *exportBlob) { void *shaderPtr = shaderBlob->GetBufferPointer(); nuint shaderSize = shaderBlob->GetBufferSize(); void *exportPtr = exportBlob->GetBufferPointer(); nuint exportSize = exportBlob->GetBufferSize(); using ComPtr <ID3DBlob> resultBlob = default; DirectX.D3DSetBlobPart( pSrcData: shaderPtr, SrcDataSize: shaderSize, Part: D3D_BLOB_PART.D3D_BLOB_PRIVATE_DATA, Flags: 0, pPart: exportPtr, PartSize: exportSize, ppNewShader: resultBlob.GetAddressOf()).Assert(); return(resultBlob.Move()); }
public static int CreateComObject <IOut>( Func <IOut> callback, out IOut obj ) where IOut : class, IUnknown { try { obj = callback.Invoke(); return(0); } catch (Exception e) { #if DEBUG DirectX.PrintDebugMessage(e.Message); DirectX.PrintDebugMessage(e.StackTrace); #endif obj = null; return(e.HResult); } }