Giter Site home page Giter Site logo

slagusev / aero-overlay Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reactiion1337/aero-overlay

0.0 1.0 0.0 128 KB

Transparent aero overlay for Windows using Direct2D + DirectWrite โšก๏ธ Support for custom rendering ๐Ÿš€

License: MIT License

C++ 100.00%

aero-overlay's Introduction

aero-overlay

A transparent window which is located above a target window to have the possibility to draw over it. My initial code can be found in 1.0 branch, development takes place in develop branch. Do not push into the master branch.

Installation

I'm using /MT in release and /MTd in debug as runtime library. So either adjust your project settings to mine or vice versa!

  • Clone the repository into your solution directory (I alway do this in contrib)
  • Right click on your solution
  • Add > Existing Project ... > and select the aero-overlay.vcxproj
  • Right click on your project in your solution
  • Add > Reference... > and select aero-overlay
  • Right click on your project in your solution > Properties
  • C/C++ > General > Additional Include Directories and add the include directory of this repository!

Usage

A basic overlay can be created using the title, process id or window handle.

#include <aero-overlay/overlay.hpp>

std::int32_t main(
    const std::int32_t argc,
    const char**       argv
)
{
    if( argc < 2 ) {
        printf( R"(usage:
    executable.exe "SuperCoolGameTitle"
)" );
        return -1;
    }

    const auto overlay = std::make_unique<aero::overlay>();
    const auto status  = overlay->attach( argv[ 1 ] );

    if( status != aero::api_status::success ) {
        printf( "[>] failed to create overlay: %d\n", status );
        return -1;
    }

    const auto surface = overlay->get_surface();
    const auto font    = surface->add_font( "test", "Verdana", 12.f );

    surface->add_callback([&surface, &font]
    {
        surface->text( 5.f, 5.f, font, 0xFFFFFFFF, "this is an example" );
    } );

    while( overlay->message_loop() ) {
        if( surface->begin_scene() ) {
            surface->end_scene();
        }

        std::this_thread::sleep_for( std::chrono::milliseconds( 2 ) );
    }
};

Callbacks are only executed if the target window is in foreground

Custom rendering support

With overlay::set_surface() you can use your own components. You only need to re-implement the classes font and surface.

This function must be called before attach()!

overlay->set_surface( std::make_share<my_surface>() );

const auto status = overlay->attach( ... );

aero-overlay's People

Contributors

reactiion1337 avatar

Watchers

James Cloos 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.