Input Problem - Doing Something Wrong?
BlitzMax Forums/BlitzMax Programming/Input Problem - Doing Something Wrong?
| ||
I can't figure out why this won't get the current state of the mouse buttons (specifically, whether they're down or not [storing them so I don't have to repeatedly call MouseDown( .. )]), as far as I can see this should be valid and work, but it's just not. All I get is an array with three zeros.Type TInfinitus Field PMouseDown[] Field CMouseDown[] .... Method Update( ) PMouseDown = CMouseDown CMouseDown = [MouseDown( 1 ), MouseDown( 2 ), MouseDown( 3 )] .... End Method End Type Is there something inherently wrong with this that I'm not seeing through my tired eyes? Thanks in advance. |
| ||
DOes this works for you?Type TInfinitus Field PMouseDown[] Field CMouseDown[] Method Update( ) PMouseDown = CMouseDown CMouseDown = [MouseDown( 1 ), MouseDown( 2 ), MouseDown( 3 )] End Method End Type Graphics 800,600,0,-1 Local Check:Tinfinitus = New TInfinitus While Not KeyHit(Key_Escape) Check.Update() DrawText Check.CMousedown[0]+" : "+Check.CMousedown[1]+" : "+Check.CMousedown[2],20,20 DrawText Check.PMousedown[0]+" : "+Check.PMousedown[1]+" : "+Check.PMousedown[2],20,40 Flip Wend Because if I remember right the Key or Mouse states doesn't work without initializing a graphicdevice. PS: The above code works for me. |
| ||
Yeah, that works, but the thing is I am initializing a graphics state before using my code, so I have no idea why it's not working with my code. As far as I can see, it should work, and that's what's bugging me. |
| ||
Maybe you could post the rest of the update Method or your main loop. With this we could see more what is wrong with your code. |
| ||
I can ensure there's no other code modifying the arrays (encapsulation is handy), so it'd all just be a bunch of stuff you'd search through without result. |
| ||
have you a mousehit somewhere? |
| ||
Nope. |