convert line ends
[canaan.git] / prj / tech / libsrc / lgd3d / comshell.c
blobb32cf2e4a97bc2cc2e99fdb09ad97e615c7542b4
1 // $Header: x:/prj/tech/libsrc/lgd3d/RCS/comshell.c 1.3 1997/10/29 15:51:02 KEVIN Exp $
3 #include <appagg.h>
4 #include <appapi.h>
5 #include <dispapi.h>
6 #include <gshelapi.h>
7 #include <inpinit.h>
8 #include <kb.h>
9 #include <kbcook.h>
11 #include <d3dtest.h>
13 tResult LGAPI AppCreateObjects (int argc, const char *argv[])
15 // Parse commmandline arguments
16 GUID *ddraw_guid = d3dtestParseArgs(argc, argv);
18 // Create the application object
19 GenericApplicationCreate(argc, argv, "d3dtest", NULL);
21 // Create the display device
22 DisplayDeviceCreate2(kDispFullScreen, kDispAttempt3D|kDispAttemptFlippable);
24 if (ddraw_guid != NULL) {
25 IDisplayDevice *pDD = AppGetObj(IDisplayDevice);
26 pDD->lpVtbl->SetKind2(pDD, kDispFullScreen, kDispAttempt3D|kDispAttemptFlippable, ddraw_guid);
29 // Create the game shell
30 GameShellCreate(kGameShellDefault & ~kLockFrame);
32 // Init the input library
33 InputCreate();
35 return 0; // Success
38 tResult LGAPI AppInit ()
40 d3dtestInit();
42 return 0; // Success
45 tResult LGAPI AppExit ()
47 d3dtestExit();
49 return 0; // Success
52 #include <lgassert.h>
53 int LGAPI AppMain (int argc, const char *argv[])
55 IGameShell * pGameShell = AppGetObj (IGameShell);
57 do {
58 IGameShell_PumpEvents(pGameShell, kPumpAll);
59 } while (d3dtestLoop());
61 return 0; // Success
64 // goofy abstraction needed because input lib doesn't work under dos
65 // and getch() doesn't work under windows, unless, of course,
66 // we're a console app, but we're not.
67 bool AppGetKey(char *c)
69 ushort key;
71 if ((!kb_get_cooked(&key))||
72 (!(key&KB_FLAG_DOWN)))
73 return FALSE;
75 *c = kb2ascii(key);
76 return TRUE;