The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Overlay app
MrOzBarry


Joined: 26 Jun 2010
Posts: 620
I believe you'll want to get the window handle and use it in SDL via https://wiki.libsdl.org/SDL_CreateWindowFrom .  From there, you might be able to create a renderer to render on top, or access the OpenGL/DX context directly and draw things on top.  I haven't actually created an overlay, so I don't know if this is the right thing to do, but you'll definitely have to go down a similar path.

On Sat, Feb 13, 2016 at 9:16 PM, NewbProgramming wrote:
Quote:
I wanted to create a game overlay.

I decided it would be best to make a window with SDL_WINDOW_OPENGL and SDL_WINDOW_BORDLESS flags when the programs detects the process of the game open.



Code:

    // Get the display's screen size.
    SDL_DisplayMode display_mode;

    SDL_GetCurrentDisplayMode(0, &display_mode);

    this->screen_width  = display_mode.w;
    this->screen_height = display_mode.h;
    // Create our window.
    this->window = SDL_CreateWindow(
        "OverlayGL",
        SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
        this->screen_width, this->screen_height,
        SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS
    );

    if(this->window == nullptr) {
        std::cout   << "[SDL]: Could not create window!"<< std::endl
                    << "[SDL]: " << SDL_GetError() << std::endl;
        return false;
    }




^ This is the code.

What happens when the main loop detects the process, it creates the window, transparent, cool, but I can't click on anything in the game.
C++ console still detects key and mouse events but the game doesn't.

Anyway to tell the SDL window to get the mouse and keyboard events but also send those events to the game window as well?


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

NewbProgramming


Joined: 13 Feb 2016
Posts: 18
I will try that, thank you Very Happy