Non-hooked overlay drawing library - c++

I am interested in making a game trainer but I stumbled over the question of making a menu which the player can choose from. I am using C++ and my target client is windows based.
I searched around and people mostly use DirectX and hook into the game to draw (A little bit like the discord overlay) but I find it extremely difficult to use DirectX.
Here is an example I found:
I really like the way the SFML library draws but I can't seem to find any APIs which support that ease of drawing.
I once did manage to make a menu in C# by using System.Drawing to draw an external overlay which I could draw to using C#'s brush API, however I prefer to write in C++ as I feel I can do more in that language.
My question is:
Is the a way I could use something like the System.Drawing/SFML API to draw an overlay over another window in C++ (Which would be accessible in a console application)?
Is it easily portable (As a DLL or even including a header)? (Most of the solutions I have seen are not portable and/or widely supported)

Check out Qt for drawing images, text, etc.
http://doc.qt.io/qt-5/qtwidgets-painting-basicdrawing-example.html
It is widely supported, and also cross-platform
You can create a transparent window and use setWindowFlags(Qt::WindowStaysOnTopHint);

Related

What does SDL_RenderClear do?

I'm Using the SDL library in C to learn some game dev , however i'm quite confused as to what SDL_RenderClear does and when do we use it. I did check the SDL documentation about the same , however i still wasn't able to understand where exactly we would use it and what is its use.
It's like rendering background color to color you have set via another API namely SDL_SetRenderDrawColor as you already found on documentation online.
Imagine you have rendered several things on screen. To begin again, you need to clear it to start over. Underlying of SDL_RenderClear wraps specific native platform your application runs on top, it can be OpenGL, DirectX, etc. It helps in communicating with such specific function that platform provides in order for you to flexibly clear your screen without a need to know low level functions, and use SDL2 for other things else like windowing, inputs from keyboard/mouse/joysticks, sound, and even utility functions related to rendering to aid your own rendering implementation.
To add a few more, SDL2 provides minimal but optimized rendering capability. SDL_RenderClear is one of those several functions you can use in rendering category. Anyway, you can decide to go on integrating with what you prefer i.e. OpenGL, DirectX, Vulkan etc. yourself.

Creating a simple window with simple controls in c++ and OpenGL

How do i just create a window with just some controls like menus , check button , radio button , scroll bar ..just with c++ and OpenGL?
It depends.
1) You can't use any external libraries.
In this case you would need to create whole framework for creating controls, handling events, hit tests, state changes... Shortly speaking, you would need to write a GUI library like Qt or wxWidgets, but with all controls drawing implemented in OpenGL.
2) You can use 3rd party libs.
Well, simply read the spec and use them. Examples:
GiGi
GLUI
Also, you may want to read this: OpenGL Forum
However, if you don't have to use OpenGL-based solution, I would suggest you use wxWidgets. I've been using it for years. It's my favourite cross-platform GUI library with solid support, quite big community and reliable, up-to-date online/offline documentation.

Simple library to display 2D images in C++ on Linux

I would like to have a tool to debug 2D planar meshes. I would like to be able to display them and debug to be able to debug certain things.
Is there a widget (for any toolkit on Linux - QT, GTK+Cairo, ...) which would display the images, scroll them and zoom it. Is there any widget which would handle it (without need to implement zooming, scrolling etc. by hand)?
Side requirements:
Needs to work on CentOS 6
I need it for C++. Unfortunately changing the build system in my situation is harder then it sounds.
The Qt Graphics View is certainly a useful tool, it gives you scrolling, zooming, rotating easily. You probably want to learn the basics of Qt before. (and Qt is in C++).
Here's an off the wall suggestion.
This would be fairly easy to implement in a web browser. Web browser engines already have the base functionality for resizing and scrolling over images. You may need a little JavaScript to bind it together, of course.
So why not use WebKit? There are bindings for many of the leading toolkits (e.g. QWebView for Qt), so you could take your pick of which one you're most comfortable with.
Yes, it's overkill. But it's code you don't have to write, and time is money.

Curiosity: Background C++ windows. Difference between SFML/SDL type and Qt (GUI) type

I was wondering what is the difference between the windows that will render images on the screen (such as SDL, SFML or OpenGL) and the classic GUI window (with the gray background by default) where you can implement buttons like in Qt for C++ or AWT/Swing in Java?
What is going on in the background code? Are they the same type? Is there a rendering layer over the graphics window allowing to display such images?
Well first of all they are different APIs. SDL and SFML are libraries directed at making games and quite possibly other applications. OpenGL is a graphics API, it is not a full suite of libraries.
Note also that SFML pretty much uses OpenGL to render to the window. The actual window its self is created via platform specific functions. The Win32 API is used for windows and the X11 Window System is generally used on Linux.
The "classic GUI window" is pretty much the platform specific APIs. The differences in background code is really just defined by the purpose of the API. Note that in the end of the line Qt/SFML/SDL all go down to the platform specific API. OpenGL even requires you to interface with the platform specific API. SFML/SDL/QT essentially do the lower level work for you.
I hope I gave what you are looking for as this question really has a wide range of answers.

How to create custom skin like WinAmp

I guess this question has been ask before, but I have not found sufficient answer to even start poking around. Most answer refers to catching WM_PAINT method directly and do custom rendering, or use a onwer draw object. However, I did not see a centralized place that has the info. to start researching. Hence, the question.
My goal is to create a very simple GUI program with custom look into it. I prefer the way winamp does their custom look that is customizable through "skins". However, I am not interested in using some cross-platform library like GTK+, QT or wxWidget.
I have some experience in system programming, but not much for GUI. I spent most of my time developing console applications, and I just started doing some QT development. If you can point me in the right direction, I'd be very appreciated.
PS: I am interested in both windows and linux environment.
Everybody,
Sorry for the late reply. I had a chance to have a quick talk with the original developer for winamp, and this is the quick answers I have:
Using skins: Artists create skins, developer will render the skins
To the OS (Windows), winamp is just one pretty box, nothing else. There is a container windows, and that's about it
All controls (button, label, list, etc) are implemented by winamp team themselves. All messages and stuffs are passed as relative position to the container window. WinAmp and the GUI engine has to decide if a button is clicked or if the label next to it is the target, etc.
Rendering artists skins created in XML
I do not have the details on if they use any libraries to do all that, but I am suspecting they do hook a window call directly, and do custom rendering themselves.
GUI skin usually using plug-in mechanism
I guess this is exactly what you are looking for:
https://www.linux.com/learn/tutorials/428800:weekend-project-creating-qt-interfaces-with-gimp?utm_medium=twitter&utm_source=twitterfeed
I also interested in creating custom look of window and widgets.
Speaking about widgets it's not hard, just need to create subclass (if you are using C++) or some widget and implement some methods like draw, handle etc. But this solution is good only if you use some high-level library like GTK, QT, etc. If you want to implement all controls by your own, you may get any graphics library, which can create window and do any graphics inside. For example, SDL2 + Cairo. SDL2 for creating window, Cairo for vector rendering controls/widgets. Both of this libraries are for win and linux. Another option is take opengl/vulkan + some lib for rendering window. It could be SDL2, SFML, GLFW.
If you really interested how it works on low level, then search Windows API for Windows and XLib or XCB for Linux/X.Org.
Speaking about window, I still investigate it. However I have one thought: you may create an empty window and then draw whatever you want. Then you need to add handlers for resizing window on the borders. But I am not sure if it's good solution, and if it won't freezes.