/[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 5 - (show annotations) (download)
Thu Jul 29 17:25:37 2010 UTC (9 years, 11 months ago) by william
File size: 2735 byte(s)
initial commit --

** Started implementing native unmanaged <=> managed conversion

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
26 if (!grn_file->GrannyAPIVersion->APIVersionsMatch())
27 {
28 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());
29 return EXIT_FAILURE;
30 }
31 else
32 {
33 printf("Loaded Granny2 DLL Version: %s\n\t Expected Version: %s",grn_file->GrannyAPIVersion->LoadedAPIVersion().c_str(),grn_file->GrannyAPIVersion->ExpectedAPIVersion().c_str());
34
35 if (grn_file->_grn_file == 0)
36 {
37 printf("Error: unable to load %s as a Granny file.\n", grn_file->GrannyFilename());
38 return EXIT_FAILURE;
39 }
40 else
41 {
42 if (grn_file->GrannyFileInfo == 0)
43 {
44 printf("Could not extract a granny_file_info from the file.\n");
45 return EXIT_FAILURE;
46 }
47 else
48 {
49 if (grn_file->GrannyFileInfo->ArtToolInfo)
50 {
51 printf("\nFile created by %s (%d.%d)\n",
52 grn_file->GrannyFileInfo->ArtToolInfo->FromArtToolName,
53 grn_file->GrannyFileInfo->ArtToolInfo->ArtToolMajorRevision,
54 grn_file->GrannyFileInfo->ArtToolInfo->ArtToolMinorRevision);
55 printf(" Coordinate system\n"
56 " Units per meter: %f\n"
57 " Right Vector: (%f %f %f)\n"
58 " Up Vector: (%f %f %f)\n"
59 " Back Vector: (%f %f %f)\n\n",
60 grn_file->GrannyFileInfo->ArtToolInfo->UnitsPerMeter,
61 grn_file->GrannyFileInfo->ArtToolInfo->RightVector[0], grn_file->GrannyFileInfo->ArtToolInfo->RightVector[1], grn_file->GrannyFileInfo->ArtToolInfo->RightVector[2],
62 grn_file->GrannyFileInfo->ArtToolInfo->UpVector[0], grn_file->GrannyFileInfo->ArtToolInfo->UpVector[1], grn_file->GrannyFileInfo->ArtToolInfo->UpVector[2],
63 grn_file->GrannyFileInfo->ArtToolInfo->BackVector[0], grn_file->GrannyFileInfo->ArtToolInfo->BackVector[1], grn_file->GrannyFileInfo->ArtToolInfo->BackVector[2]);
64 }
65
66 gr2lib::core::rigeditor::gr2lib_rigeditor_frm^ _editor = gcnew gr2lib::core::rigeditor::gr2lib_rigeditor_frm(grn_file);
67 _editor->ShowDialog();
68 printf("Art Tool Name: %s", grn_file->GrannyFileInfo->ArtToolInfo->FromArtToolName);
69 }
70 }
71
72 }
73
74
75 wait();
76 return 0;
77 }
78
79

  ViewVC Help
Powered by ViewVC 1.1.22