MCPcopy Create free account
hub / github.com/defold/defold / LoadPrototype

Function LoadPrototype

engine/particle/src/test/test_particle.cpp:265–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265bool LoadPrototype(const char* filename, dmParticle::HPrototype* prototype)
266{
267 char path[128];
268 dmTestUtil::MakeHostPathf(path, sizeof(path), "build/src/test/%s", filename);
269
270 const uint32_t MAX_FILE_SIZE = 4 * 1024;
271 unsigned char buffer[MAX_FILE_SIZE];
272 uint32_t file_size = 0;
273
274 FILE* f = fopen(path, "rb");
275 if (f)
276 {
277 file_size = fread(buffer, 1, MAX_FILE_SIZE, f);
278 fclose(f);
279 *prototype = dmParticle::NewPrototype(buffer, file_size);
280 return *prototype != 0x0;
281 }
282 else
283 {
284 dmLogWarning("Particle FX could not be loaded: %s.", path);
285 return false;
286 }
287}
288
289bool LoadPrototypeFromDDF(const char* filename, dmParticle::HPrototype* prototype)
290{

Callers 1

TEST_FFunction · 0.85

Calls 2

MakeHostPathfFunction · 0.85
NewPrototypeFunction · 0.85

Tested by

no test coverage detected