Page 1 of 1

overlay tool

Posted: Thu Feb 05, 2009 8:15 pm
by wEEp
Hello Guys,

I want to make a little overlay tool. That means that i can draw images and the images are ALWAYS in the front. That means when i start the internet explorer , then the image is still in the front that you can see it. When i start a game then i still see the image infront of the game

Thanks for yur help.

Cheers

Posted: Thu Feb 05, 2009 9:18 pm
by hybrid
That's basically just a window creation parameter. But I don't know which one :wink: Just search for the overlay modes of your favourite windowing subsystem.

Posted: Thu Feb 05, 2009 9:31 pm
by wEEp
hybrid wrote:That's basically just a window creation parameter. But I don't know which one :wink: Just search for the overlay modes of your favourite windowing subsystem.
Yes, but i want to make such a tool with the irrlicht engine.

Posted: Thu Feb 05, 2009 9:38 pm
by hybrid
Yes, but you need to set up the overlay window manually, and then pass the window handle to createParams or beginScene. When you know how to create such a window, you can tell us and we'll try to incorporate into Irrlicht :)

Posted: Fri Feb 06, 2009 6:06 am
by wEEp
hybrid wrote:Yes, but you need to set up the overlay window manually, and then pass the window handle to createParams or beginScene. When you know how to create such a window, you can tell us and we'll try to incorporate into Irrlicht :)
Can u help me a bit with that? *NICE EYES*:D

Posted: Fri Feb 06, 2009 8:24 am
by hybrid
hybrid wrote:But I don't know which one
I really don't know how to do this. If you ask for the window passing, just get the Hwnd or WindowID from that window and put it into SIrrCreationParameters.WindowID (when creating the device with createDeviceEx) or you pass that pointer in the beginScene call (there's also a windowid parameter). In both cases, the manually created window will be used for rendering.

Posted: Fri Feb 06, 2009 8:33 am
by wEEp
Yes, but the image should be on the desktop and when u start a programm it still should be in the front . hmhmhmhmh. Im go now to play around with it ;)

Posted: Fri Feb 06, 2009 8:37 am
by hybrid
There's no way to render without some kind of window. Whether it's visible at all, or infront all the time, with borders or without, is all defined upon window creation. You seem to want a window without borders which is always on top of everything else (and with some kind of alpha channel...). If you manage to create such a window, the described techniques should enable Irrlicht to render into this window.

Posted: Fri Feb 06, 2009 8:53 am
by wEEp
I thought that i make something like this

Code: Select all

#include <windows.h> 
#include <irrlicht.h> 
using namespace irr; 
using namespace core; 
using namespace scene; 
using namespace video; 
using namespace io; 
using namespace gui; 

int main(){ 
  HWND wnd = 0; 
  while(!wnd){ 
    wnd = FindWindow("Notepad", NULL); 
    if(wnd) wnd = GetWindow(wnd, GW_CHILD); 
    Sleep(10); 
  } 
  SIrrlichtCreationParameters ppp; 
  ppp.AntiAlias = false; 
  ppp.Bits = 16; 
  ppp.DriverType = EDT_DIRECT3D9; 
  ppp.EventReceiver = 0; 
  ppp.Fullscreen = false; 
  ppp.HighPrecisionFPU = false; 
  ppp.Stencilbuffer = false; 
  ppp.Vsync = false; 
  ppp.WindowSize = dimension2d<s32>(800, 600); 
  ppp.WindowId = (s32)wnd; 

  IrrlichtDevice *device = createDeviceEx(ppp); 
  IVideoDriver* driver = device->getVideoDriver(); 
  ISceneManager* smgr = device->getSceneManager(); 
  IGUIEnvironment* guienv = device->getGUIEnvironment(); 

  ISceneNode* node = smgr->addCubeSceneNode(10); 
  node->setPosition(vector3df(0, -50, 50)); 
  ICameraSceneNode* cam = smgr->addCameraSceneNode(); 
  cam->setTarget(vector3df(0, -50, 50)); 

  while(device->run()){ 
    driver->beginScene(true, true, SColor(255,100,101,140)); 
    smgr->drawAll(); 
    guienv->drawAll(); 
    driver->endScene(); 
  } 
  device->drop(); 
  return 0; 
}
And i will draw a clean window withouth any bars and then i will print the image in this mfc window.

What do u think about this idea?

Posted: Fri Feb 06, 2009 8:57 am
by JP
that appears to just get the window of notepad.exe and render in that... notepad won't stay on the top of everything else so probably not much use...

Posted: Fri Feb 06, 2009 8:59 am
by wEEp
wEEp wrote: And i will draw a clean window withouth any bars (in MFC) and then i will print the image in this mfc window.

Posted: Fri Feb 06, 2009 3:19 pm
by Acki
to get a window always stay on top you'll need this function:
SetWindowPos(...)

if you want a window without borders you'll need to create one on your own...
for this look at tutorial 14 (Win32Window) there is a value that holds all style datas for the window:

Code: Select all

	DWORD style = WS_SYSMENU | WS_BORDER | WS_CAPTION |
		WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SIZEBOX;
there you can specify how the window should look like when creating the window... ;)

Posted: Sat Feb 07, 2009 12:57 pm
by luigi
learn win32 or os api than it will be apparent to you. In a game there isn't a need for creating an extra window when you can manage it your self

Posted: Mon Feb 09, 2009 12:07 pm
by bitplane
Like Acki said, SetWindowPos with topmost flag will make a window always on top. To make parts of it transparent you use SetWindowRgn or layered windows