Hello all,
At first, I'm sorry if a similar topic already showed up, but I didn't find any so I hereby give it a try.
I've been hacking around a bit to create more than one graphics window. I do not use (or own, for that matter) the GUI-module.
This is my code:
As you can see, it is possible to render graphics to more than one window, altough it crashes when using more than one DirectX-window (it should be possible even to use different drivers for each window, as SetGraphics would change the driver accordingly, but I haven't tried that).
However, it doesn't seem possible to differentiate the input generated by each window. MouseX() and MouseY() just depend on over which window the mouse is.
I tried looking up EnablePolledInput:
It says it requires an object, yet the 'Graphics' function doesn't pass an object - in contrary to what the comment here says. I tried to 'EnablePolledInput(a)', hoping that it then only would return input from 'window a', but that doesn't work.
Does any of you have a clue how I can differentiate the input from the two windows?
At first, I'm sorry if a similar topic already showed up, but I didn't find any so I hereby give it a try.
I've been hacking around a bit to create more than one graphics window. I do not use (or own, for that matter) the GUI-module.
This is my code:
SuperStrict SetGraphicsDriver GLMax2DDriver() 'this doesn't work with DirectX-drivers AppTitle = "window a" Local a:TGraphics = CreateGraphics (320,240,0,0,GRAPHICS_BACKBUFFER) AppTitle = "window b" Local b:TGraphics = CreateGraphics (240,320,0,0,GRAPHICS_BACKBUFFER) EnablePolledInput() 'Manually enable polled input While Not AppTerminate() Or Not Confirm( "Terminate?" ) SetGraphics(a) SetColor (Rand(0,255),Rand(0,255),Rand(0,255)) Plot (Rand(0,319),Rand(0,239)) Flip Print "a - x: " + MouseX() + ", y: " + MouseY() SetGraphics(b) SetColor (Rand(0,255),Rand(0,255),Rand(0,255)) DrawLine (Rand(0,239),Rand(0,319),Rand(0,239),Rand(0,319)) Flip Print "b - x: " + MouseX() + ", y: " + MouseY() Wend
As you can see, it is possible to render graphics to more than one window, altough it crashes when using more than one DirectX-window (it should be possible even to use different drivers for each window, as SetGraphics would change the driver accordingly, but I haven't tried that).
However, it doesn't seem possible to differentiate the input generated by each window. MouseX() and MouseY() just depend on over which window the mouse is.
I tried looking up EnablePolledInput:
Rem Currently only called by Graphics/bglCreateContext. Private for now, as it really needs a source:object parameter. End Rem Function EnablePolledInput( source:Object=Null ) If enabled Return inputSource=source FlushKeys FlushMouse AddHook EmitEventHook,Hook,Null,0 enabled=True End Function
It says it requires an object, yet the 'Graphics' function doesn't pass an object - in contrary to what the comment here says. I tried to 'EnablePolledInput(a)', hoping that it then only would return input from 'window a', but that doesn't work.
Does any of you have a clue how I can differentiate the input from the two windows?