MCPcopy Index your code
hub / github.com/phaserjs/phaser / AddEntry

Function AddEntry

src/loader/filetypes/CompressedTextureFile.js:516–596  ·  view source on GitHub ↗
(loader, key, urls, xhrSettings)

Source from the content-addressed store, hash-verified

514 var renderer = this.systems.renderer;
515
516 var AddEntry = function (loader, key, urls, xhrSettings)
517 {
518 var entry = {
519 format: null,
520 type: null,
521 textureURL: undefined,
522 atlasURL: undefined,
523 multiAtlasURL: undefined,
524 multiPath: undefined,
525 multiBaseURL: undefined
526 };
527
528 if (IsPlainObject(key))
529 {
530 var config = key;
531
532 key = GetFastValue(config, 'key');
533 urls = GetFastValue(config, 'url'),
534 xhrSettings = GetFastValue(config, 'xhrSettings');
535 }
536
537 var matched = false;
538
539 for (var textureBaseFormat in urls)
540 {
541 if (renderer.supportsCompressedTexture(textureBaseFormat))
542 {
543 var urlEntry = urls[textureBaseFormat];
544
545 if (typeof urlEntry === 'string')
546 {
547 entry.textureURL = urlEntry;
548 }
549 else
550 {
551 entry = Merge(urlEntry, entry);
552 }
553
554 entry.format = textureBaseFormat.toUpperCase();
555
556 matched = true;
557
558 break;
559 }
560 }
561
562 if (!matched)
563 {
564 console.warn('No supported compressed texture format or IMG fallback', key);
565 }
566 else if (entry.format === 'IMG')
567 {
568 var file;
569 var multifile;
570
571 if (entry.multiAtlasURL)
572 {
573 multifile = new MultiAtlasFile(loader, key, entry.multiAtlasURL, entry.multiPath, entry.multiBaseURL, xhrSettings);

Callers 1

Calls 3

IsPlainObjectFunction · 0.85
GetFastValueFunction · 0.85
MergeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…