Keyboard/mouse problem after Create/SetGraphics()

BlitzMax Forums/BlitzMax Programming/Keyboard/mouse problem after Create/SetGraphics()

GfK(Posted 2006) [#1]
Code below should exit on ESC or LMB - neither works. Seems that nothing from PolledInput is working. Have Quickbuild off, Debug on/off makes no difference, gl/dx makes no difference, have rebuilt all mods.

I also seem to be suffering from a 50% drop in FPS since upgrading from 1.18 to 1.20 when running under DX.
gfxObject:tGraphics = CreateGraphics(800,600,0,60,GRAPHICS_BACKBUFFER)
SetGraphics gfxObject
While (Not KeyDown(KEY_ESCAPE)) And (Not MouseDown(1))
  Delay 1
Wend



TomToad(Posted 2006) [#2]
this is in the source code for EnablePolledInput()

Rem
Currently only called by Graphics/bglCreateContext.
Private for now, as it really needs a source:object parameter.
End Rem


So apparently CreateGraphics nor SetGraphics enables the Polled input.


marksibly(Posted 2006) [#3]
As TomToad mentions, CreateGraphics alone does not enable polled input.

What's wrong with just using 'Graphics'?


GfK(Posted 2006) [#4]
Well... nothing.

I came across this issue as part of my investigation into why my game's FPS has dropped from 30fps to 15fps simply by updating from 1.18 to 1.20.


Grey Alien(Posted 2006) [#5]
ha this one caught me out too a while ago.


Damien Sturdy(Posted 2006) [#6]
Why is it you chose to enable polled input in the Graphics command, Mark? :)

Just seems strange as they're pretty unrelated :)


GfK(Posted 2006) [#7]
Just as a little side-note here... is it possible to manually enable PolledInput after using CreateGraphics(), then? I can't find anything in the documentation pertaining to this.


Grey Alien(Posted 2006) [#8]
guess what ... EnablePolledInput() :-D

Although I've just got rid of PolledInput from my framework to use event-based input instead.


sswift(Posted 2006) [#9]
What Grey said. I use it to enable polled input when I'm in Windowed mode so I don't have to have two sets of input fuctions and I don't have to keep track fo the state of every key myself. The only caveat there is you need to make sure you enable the canvas each frame or else the input will go elsewhere.


GfK(Posted 2006) [#10]
guess what ... EnablePolledInput() :-D
How the hell do you find this stuff in the documentation? I still can't find that!


sswift(Posted 2006) [#11]
It's not in the docs. I found it when I was trying to debug, and clicked the source button at the top of the section with the graphics function, and looked in the graphics function to see the command there, unhighlighted.