Hi!
I have got a problem: The game I wrote runs in a good speed. But the reaction of the buttons is very slow. Is there a way to start the input request manualy?
The Second Problem: When I am playing my game, sometimes there is a message from my today button.
But i have not pressed it! I recognised this bug in some other GapiDraw Applications.
I have got a Pocket Loox. So this might be the problem?
Sorry for my bad english.
Greez J@Master.
I'm having the same as your first problem, but for the second problem, I got around it with this code:
- Code:
HRESULT CMyApp::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_KILLFOCUS:
m_display.SuspendDisplay();
m_input.CloseInput();
break;
case WM_ACTIVATE:
if(wParam != WA_INACTIVE)
{
m_input.OpenInput();
m_display.ResumeDisplay();
}
break;
}
return CGapiApplication::WindowProc(hWnd,msg,wParam,lParam);
}
It should be placed in you Main App Class.
One question: Do you do some time-consuming stuff in OnButtonDown etc? Basically all you should do in all events (button/stylus) is:
(1) store the button state or stylus coordinate
or
(2) add the event to a list and process that list in the next processnextframe. if you choose this option you have to use critical sections when adding/removing from this list.
Basically it's the same stuff as if you used DirectInput.
/Johan
That's essentially what I was doing. I simplified it a little. OK, here's the deal: On the PC, it appears fine. According to other people, it runs fine on their Pocket PC. On my Pocket PC, sometimes the buttons don't appear to register.
Well, don't worry about it, because I think it's just my code. I'll try the "add event to a list" method and see if that fixes it.
Nevermind, I think it is working fine.
@iceboxman thanks, i will try this.
But my first problem is not solved...
I don't think, that an eventlist will help me. Because every input evert is slow.
When I press a button in my game a boolean is set to true. If I release the button this boolean is set to false. The same routine is used for the stylus. I have PenX ,PenY and PenPressed. But somtimes, no, not sometimes... mostly my buttons were not registered. (It is much slower when I have many graphics on my screen)
@iceboxman (2) try the game Bounza! On my loox it is not playable. But on other devices it works fine. (The stick you control is very slow. It realy stumbels like a game with 0.5 fps. But the Ball is very fast)
Is the input requested by Windows? If this is true, could I make a direkt request for the input?
I think i solved my problem now.
I put a simple piece of code in the ProcessNextFrame function:
- Code:
MSG msg;
while (PeekMessage( &msg;, 0, 0, 0, PM_NOREMOVE ) == TRUE)
{
GetMessage( &msg;, 0, 0, 0 );
TranslateMessage( &msg; );
DispatchMessage( &msg; );
}
Thanks for helping me.
What is sounds like, is that in your ProcessNextFrame, it looks at the variables set by pressing the buttons. So if Up is pressed, you have a variable like bUpButtonPressed set to TRUE and FALSE when released. Then inside ProcessNextFrame, it checks to see if bUpButtonPressed is TRUE or FALSE. If it is TRUE, it responds to the button. However, if you were to press and release the button quickly, it would change to FALSE before the next iteration of ProcessNextFrame occurred and the button wouldn't be registered as pressed.
How I got around it is:
When a button is pressed, it is recorded as being struck (Pressed and released in the same iteration).
Whenever ProcessNextFrame is run, it gets the value and resets the button to not pressed.
If the button is held down, it is recorded as being in the down position. If that is the case, the state of the button is not reset.
What is looks like your solution does, is check the actual state of the button at the time the code is determining what to do.
Anyway, your welcome for the help. I have run into many problems making my games and pondered about the cause of the problem and how to circumvent the problem.