PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

GAPI Question

I've written an app in which the main window creates a modeless property sheet, and then initialized the GAPI through the following calls:

GXOpenDisplay(hWndMain, GX_FULLSCREEN);
gxkl = GXGetDefaultKeys(GX_NORMALKEYS);
GXOpenInput();

I want to control the hardware buttons from the property pages; each property page DialogProc, as well as the main window msgproc, handles the WM_KEYDOWN message with special cases for the key values in gxkl. However, after creating the property sheet, none of the hardware button events seem to be trapped.

During my initial testing, I didn't create the property sheets, and everything appeared to work properly.

Is there something special I need to do in order to ensure that the GAPI initialization applies to the property pages?

(BTW: I'm using GAPI 1.2 downloaded from the Microsoft site.)

Thanks for any advice you might have...
Conan · 19 May 2002, 07:38 UTC — how to use GAPI
Hi Dan,
Have you looked at examples of using GAPI such as EasyCE PocketFrog & GAPIDraw (see the forums below this one).
GAPI gives access to the screen directly so you would not expect normal Windows features like dialogue boxes to be available. You are expected to write your own functions which draw to the screen

Is your intended application a game? If not then there's no reason to use GAPI as it's only doing 2 things
a) giving the whole screen to the programmer
b) allowing you to write to the screen as fast as possible

Regards
Dan, you may want to peruse the GapiTools forums and library if you're using MFC (as it sounds like you are).
I have had troubles in the past with GAPI if I didn't inialize the library first thing during the main window creation.

Dan East
Thanks for your responses.

Dan--

I've tried moving the initialization code to various spots, with the same results. Basically the sequence is that, immediately after I get the handle to the main window, I pass it to GXOpenDisplay, then call GXGetDefaultKeys and GXOpenInput. I then create the PropertySheet with each PropertyPage containing a handler for WM_KEYDOWN to field the hardware buttons. If I don't create the property sheet, the buttons are trapped (by the main messageproc); if I do create it, nothing happens.

Hosed--

Thanks, but I'm writing this in straight C++.

Conan--

Are you saying that GAPI cannot capture hardware buttons while your in a dialogbox which is the child of the main window? I'm not writing a game, but I am trying to trap the hardware keys (I don't want to use RegisterHotKey, because if another app has registered the same key, the call fails.)
Conan · 23 May 2002, 17:48 UTC — GAPI & hardware buttons
you need input from people who have been there. My code does not implement and method of getting the buttons back from GAPI but on the Overloaded forum someone was discussion the function to suspend GAPI so that other apps could get a look in.

My point was that I did not know that you could use any regular windows features such as dialogue boxes while working in a full screen application with GAPI. I know that GapiDraw offers full screen or windowed thoug currently PocketFrog does not. Might be worth you looking at the GapiDraw source.
Well, the ability to only draw certain regions of the display via GAPI and leave others to be rendered by the OS is dependant on the GAPI implementation. If GAPI exposes DRAM then you can just draw what you want wherever, and the OS can still render its area. If GAPI exposes a backbuffer, then you cannot, because every time your call GXEndDraw the entire screen is trashed. For example, with Pocket Quake the SIP can be viewed properly on iPaqs, but not an Casios, because the Casio uses a backbuffer which causes PQ to trash the SIP.

Dan East
Conan · 23 May 2002, 22:38 UTC — thanks for the GAPI info
Thanks for that Dan. Gapi seems to be less standard than I had thought.
Standard? What is that? ;)
Actually I think it should be possible to use GXSetViewport() to use the SIP with GAPI on the Casio E-125.

I just didn't have the time yet to check it out. (I simply don't need this functionnality)...

So far I can tell you that:

1) GAPI on the Casio E-125 works perfectly with a title bar.
2) GXSetViewport() works for the vertical parameters (position/height) but not for the horizontal ones (position/width). It does make sense as the E-125 uses DMA on GXEndDraw() and the screen is aligned "north".

So my guess is that everything is possible, even on the E-125 (including accessing the front buffer, it's at 0xAA200000, same format as GAPI buffer).