home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / VPR_DATA / DOGA / SOURCES / POLYEDIT.LZH / READER / TEST.CPP < prev    next >
C/C++ Source or Header  |  1996-01-05  |  2KB  |  98 lines

  1.  
  2. #include <owl\owlpch.h>
  3. #include <owl\applicat.h>
  4. #include <owl\framewin.h>
  5. #include <owl\dc.h>
  6. #include <stdio.h>
  7. #include <dos.h>
  8.  
  9. extern "C" {
  10.     #include "lib.h"
  11.     #include "matrix.h"
  12.     #include "reader.h"
  13. };
  14.  
  15. #include "message.h"
  16.  
  17. static    TMessageWindow    *MessageOut ;
  18.  
  19. class TMyApp : public TApplication {
  20.   public:
  21.     TMyApp() : TApplication() {}
  22.  
  23.   protected:
  24.       BOOL    isidle ;
  25.     void    InitMainWindow();
  26.     BOOL    IdleAction( long );
  27. };
  28.  
  29. void TMyApp::InitMainWindow()
  30. {
  31.     isidle = TRUE ;
  32.     MessageOut = new TMessageWindow( "message window", 100 );
  33.     SetMainWindow( MessageOut->GetWindowPtr() );
  34. }
  35.  
  36. void    test();
  37.  
  38. BOOL    TMyApp::IdleAction( long /* idleCount */ )
  39. {
  40. #if    1
  41.     if ( isidle )
  42.     {
  43.         test();
  44.         isidle = FALSE ;
  45.     }
  46. #endif
  47.     return FALSE ;
  48. }
  49.  
  50.  
  51. int OwlMain(int /*argc*/, char* /*argv*/ [])
  52. {
  53.     if ( LibraryInit() < 0 )
  54.         return -1 ;
  55.     MatrixInit();
  56.     ReaderInit();
  57.  
  58.     return TMyApp().Run();
  59. }
  60.  
  61. void    test()
  62. {
  63.     int        type ;
  64.     char    name[64] ;
  65.     Color    col, amb, dif, spc, size ;
  66.     int        h ;
  67.     float    x, y, z, vx, vy, vz, u, v ;
  68.  
  69.     wprintf( "start\n" );
  70.  
  71.     if ( AtrReadOpen( "dman.atr" ) == FALSE )
  72.         exit( 1 );
  73.  
  74.     while( AtrReadNext() )
  75.     {
  76.         AtrReadName( name );
  77.         wprintf( "atrname : %s\n", name );
  78.         type = AtrReadColor( &col, &amb, &dif, &spc, &size, &h );
  79.     }
  80.     AtrReadClose();
  81.  
  82.     if ( ObjReadOpen( "dman.suf" ) == FALSE )
  83.         exit( 1 );
  84.  
  85.     ObjReadName( name );
  86.     while( ObjReadPoly( name, &type ) )
  87.     {
  88.         wprintf( "ReadPoly\n" );
  89.         while( ObjReadVertex( &x, &y, &z, &vx, &vy, &vz, &u, &v ) )
  90.         {
  91.             wprintf( "( %g, %g, %g )\n", x, y, z );
  92.         }
  93.         wprintf( "\n" );
  94.     }
  95.     ObjReadClose();
  96. }
  97.  
  98.