Multiple graphics windows
BlitzMax Forums/BlitzMax Programming/Multiple graphics windows
| ||
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? |
| ||
Only by using event based programming. In this case you could use EventSource() (or currentevent.source |
| ||
Thanks for your answer, bud sadly enough, it doesn't work out.. I removed the EnablePulledInput and the 'print mousex()' stuff and added the following: As it turns out, the events show up nicely but the events don't have a source. This is also why the 'EnablePolledInput(a)' doesn't work, see in polledinput.bmx: InputSource is set to 'source' object in the EnablePolledInput(source:Object) function, so in my example it'd be 'a:TGraphics', but since the EventSource is empty, the function quits. I'm sorry if I'm not clear enough, I find these things hard to explain in Human. |
| ||
Some other funny thing: if you close one window, the graphics meant for the closed window will be drawn on the remaining window. I guessed this is because the TGraphics object would be destroyed as the window closes and that setGraphics won't switch to a non-existing TGraphics object. This, however, is not true - the object still exists (even if both windows are closed). |
| ||
Does anyone have a clue? |