/[Sims3RigEditor]/trunk/gr2lib_cpp_UnitTest/gr2lib_cpp_UnitTest.cpp
ViewVC logotype

Contents of /trunk/gr2lib_cpp_UnitTest/gr2lib_cpp_UnitTest.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6 - (show annotations) (download)
Fri Jul 30 00:28:19 2010 UTC (10 years, 7 months ago) by william
File size: 2777 byte(s)
bulk commit

1 // gr2lib_cpp_UnitTest.cpp : main project file.
2
3 #include "stdafx.h"
4 #include "granny.h"
5 #include "..\gr2lib_cpp\gr2lib_core.h"
6 #include "..\gr2lib_cpp\gr2lib_core_imports.h"
7 #include <stdio.h>
8 #include <iostream>
9 #include <stdlib.h>
10 #include <assert.h>
11
12 using namespace std;
13
14
15
16 void wait()
17 {
18 cout<<"\nPress {ENTER} to continue.";
19 cin.ignore(1);
20 }
21 int main(int argc, char const* argv[])
22 {
23
24 //grannyfile* grn_file = new grannyfile("C:\\temp\\S3_motorcycleChopper.gr2");
25 grannyfile* grn_file = new grannyfile("C:\\Program Files\\Granny Viewer\\Gryphon.gr2");
26
27 if (!grn_file->GrannyAPIVersion->APIVersionsMatch())
28 {
29 printf("Warning:\n\t Loaded Granny2 DLL Version: %s\n\t Expected Version: %s",grn_file->GrannyAPIVersion->LoadedAPIVersion().c_str(),grn_file->GrannyAPIVersion->ExpectedAPIVersion().c_str());
30 return EXIT_FAILURE;
31 }
32 else
33 {
34 printf("Loaded Granny2 DLL Version: %s\n\t Expected Version: %s",grn_file->GrannyAPIVersion->LoadedAPIVersion().c_str(),grn_file->GrannyAPIVersion->ExpectedAPIVersion().c_str());
35
36 if (grn_file->_grn_file == 0)
37 {
38 printf("Error: unable to load %s as a Granny file.\n", grn_file->GrannyFilename());
39 return EXIT_FAILURE;
40 }
41 else
42 {
43 if (grn_file->GrannyFileInfo == 0)
44 {
45 printf("Could not extract a granny_file_info from the file.\n");
46 return EXIT_FAILURE;
47 }
48 else
49 {
50 if (grn_file->GrannyFileInfo->ArtToolInfo)
51 {
52 printf("\nFile created by %s (%d.%d)\n",
53 grn_file->GrannyFileInfo->ArtToolInfo->FromArtToolName,
54 grn_file->GrannyFileInfo->ArtToolInfo->ArtToolMajorRevision,
55 grn_file->GrannyFileInfo->ArtToolInfo->ArtToolMinorRevision);
56 printf(" Coordinate system\n"
57 " Units per meter: %f\n"
58 " Right Vector: (%f %f %f)\n"
59 " Up Vector: (%f %f %f)\n"
60 " Back Vector: (%f %f %f)\n\n",
61 grn_file->GrannyFileInfo->ArtToolInfo->UnitsPerMeter,
62 grn_file->GrannyFileInfo->ArtToolInfo->RightVector[0], grn_file->GrannyFileInfo->ArtToolInfo->RightVector[1], grn_file->GrannyFileInfo->ArtToolInfo->RightVector[2],
63 grn_file->GrannyFileInfo->ArtToolInfo->UpVector[0], grn_file->GrannyFileInfo->ArtToolInfo->UpVector[1], grn_file->GrannyFileInfo->ArtToolInfo->UpVector[2],
64 grn_file->GrannyFileInfo->ArtToolInfo->BackVector[0], grn_file->GrannyFileInfo->ArtToolInfo->BackVector[1], grn_file->GrannyFileInfo->ArtToolInfo->BackVector[2]);
65 }
66
67 gr2lib_rigeditor_frm^ _editor = gcnew gr2lib_rigeditor_frm(grn_file);
68 _editor->ShowDialog();
69 printf("Art Tool Name: %s", grn_file->GrannyFileInfo->ArtToolInfo->FromArtToolName);
70 }
71 }
72
73 }
74
75
76 wait();
77 return 0;
78 }
79
80

  ViewVC Help
Powered by ViewVC 1.1.22