MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / createNewFile

Method createNewFile

physx/samples/samplebase/SampleInputMappingAsset.cpp:185–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185bool SampleInputMappingAsset::createNewFile(bool rewriteFile)
186{
187 if(rewriteFile)
188 {
189 if(mFile)
190 {
191 fclose(mFile);
192 mFile = NULL;
193 }
194 PxToolkit::fopen_s(&mFile,mPath , "w");
195
196 if(mFile)
197 mIsOk = true;
198 }
199
200 if(mMapping)
201 {
202 delete mMapping;
203 mMapping = NULL;
204 }
205
206 mMapping = new ODBlock();
207 mMapping->ident("InputMapping");
208 mSettingsBlock = mMapping;
209
210 ODBlock & version = *new ODBlock();
211 version.ident("Version");
212 mSettingsBlock->addStatement(version);
213
214 ODBlock & nb = *new ODBlock();
215 version.addStatement(nb);
216 char temps[64];
217 sprintf(temps,"%d",MAPPING_VERSION);
218 nb.ident(temps);
219
220 ODBlock & userInputCSB = *new ODBlock();
221 userInputCSB.ident("UserInputCS");
222 mSettingsBlock->addStatement(userInputCSB);
223
224 ODBlock &nb2 = *new ODBlock();
225 userInputCSB.addStatement(nb2);
226 sprintf(temps,"%d",mUserInputCS);
227 nb2.ident(temps);
228
229 ODBlock & inputEventCSB = *new ODBlock();
230 inputEventCSB.ident("InputEventCS");
231 mSettingsBlock->addStatement(inputEventCSB);
232
233 ODBlock &nb3 = *new ODBlock();
234 inputEventCSB.addStatement(nb3);
235 sprintf(temps,"%d",mInputEventCS);
236 nb3.ident(temps);
237
238 return true;
239}
240
241void SampleInputMappingAsset::saveMappings()
242{

Callers

nothing calls this directly

Calls 3

identMethod · 0.80
addStatementMethod · 0.80
fopen_sFunction · 0.50

Tested by

no test coverage detected