1 /*---------------------------------------------------------------------------*
2   Project:  Dolphin GD demo
3   File:     gd-matrix-host.c
4 
5   Copyright 2001 Nintendo.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Log: gd-matrix-host.c,v $
14   Revision 1.2  02/20/2006 04:13:09  mitu
15   changed include path from dolphin/ to revolution/.
16 
17   Revision 1.1  02/08/2006 11:19:43  mitu
18   1st version.
19 
20 
21     2     10/09/01 11:27a Hirose
22     Moved WinMain to gd-win32-ui.c. Integrated tiny message output
23     function.
24 
25     1     9/19/01 5:49p Carl
26     Source files for GD matrix demo.
27 
28   $NoKeywords: $
29  *---------------------------------------------------------------------------*/
30 
31 #include <windows.h>
32 
33 #include <revolution/gd.h>
34 
35 #include <assert.h>
36 #include <stdarg.h>
37 #include <stdio.h>
38 #include <stdlib.h>
39 
40 /*---------------------------------------------------------------------------*
41    Defines
42  *---------------------------------------------------------------------------*/
43 
44 #define ASSERT           assert
45 #define OSRoundUp32B(x)  (((u32)(x) + 31) & ~31)
46 #define OSAlloc(x)       ((void*)OSRoundUp32B(malloc((x)+31)))
47 #define OSFree(x)        free(x)
48 
49 /*---------------------------------------------------------------------------*
50    Forward references
51  *---------------------------------------------------------------------------*/
52 void        main      ( void );
53 
54 // Externs:
55 
56 extern void CreateDLs ( void );
57 
58 extern void GDReport (char* msg, ...);
59 
60 /*---------------------------------------------------------------------------*
61    Global variables
62  *---------------------------------------------------------------------------*/
63 // Application name
64 char* AppName = "gd-matrix-host";
65 
66 // Display lists *************************************************************
67 
68 // This set of display lists will each load an indexed position matrix
69 // and an indexed normal matrix, then draw one face of the cube.
70 
71 GDLObj DrawDLOs[6];
72 
73 /*---------------------------------------------------------------------------*
74    Application main loop
75  *---------------------------------------------------------------------------*/
76 // Function WinMain() is defined in gd-win32-ui.c
main(void)77 void main ( void )
78 {
79     GDGList dlists[6]; // keeps track of all display lists
80     u32 numDLs = 6;
81     u32 i;
82 
83     CreateDLs();
84 
85     for(i=0; i < numDLs; i++)
86     {
87         dlists[i].ptr = GDGetGDLObjStart(&DrawDLOs[i]);
88         dlists[i].byteLength = GDGetGDLObjOffset(&DrawDLOs[i]);
89     }
90 
91     GDWriteDLFile("gdMatrix.gdl", numDLs, 0 /*PLs*/, dlists, NULL /*PLs*/);
92 
93 	GDReport("Created file \"gdMatrix.gdl\" successfully.");
94 }
95 
96 
97