Giter Site home page Giter Site logo

directxhook's Introduction

DirectXHook + Overlay Framework

This is a DirectX hook that works with DirectX 11 and DirectX 12. A straightforward but primitive overlay framework is included.

The readme is a little bit outdated because I restructured the code for higher stability a while back.

Overlay examples

A mod for Monster Hunter Rise, "Rise DPS Meter" found on NexusMods

-add video-

-add video-

Test triangle

-add video-

How to create an overlay

First, check the wiki page on how to quickly set up the Visual Studio solution.

When the project is built, "dxgi.dll" will be generated in the project folder. This can be copied next to a game executable which uses DirectX 11 or 12. The game will load the .dll automatically on startup and will render what you told it to.

Also note that the "hook_textures" folder containing "blank.jpg" must be present next to dxgi.dll in order for anything to render.

Create files

Create a .cpp and .h file in the Overlays folder (optionally put these inside a parent folder):

create_files

Create a class that inherits from the IRenderCallback interface and includes "OverlayFramework.h":

example_header

Define the Setup() and Render() functions in the .cpp file:

example_source

Note: Setup() is called once and Render() is called every frame. InitFramework() must be called on the very first line in Setup().

Make the hook render your stuff by adding these lines in DllMain.cpp:

dllmain

But we haven't yet defined anything to render...

Boxes

All rendering with the overlay framework is done using Boxes:

box_struct

Boxes are a simple struct with data that the framework manages.

  • pressed = if the mouse is currently being pressed on this box
  • clicked = if the mouse was previously pressed and then released on the box this frame
  • hover = if the mouse is hovering over the box

The rest are self-explanatory. Do not modify visible or z.

Create some boxes and render them:

rgb_boxes_code

Result:

rgb_boxes

Boxes can be rendered with either textures or colors:

textures_code

Note: textures should be loaded in Setup().

Result:

textures

Text can be rendered inside Boxes:

text_code

Note: a font must be set before rendering text.

Result:

text

Contributions

Feel free to create issues or contribute code to the repo.

License

Feel free to use this code for anything and however you like, but if you create something with it then it would be cool if you could show me what you made :)

directxhook's People

Contributors

techiew avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.