-
Notifications
You must be signed in to change notification settings - Fork 341
/
Config.hx
102 lines (88 loc) · 2.26 KB
/
Config.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package hxd.res;
enum Platform {
HL;
JS;
Unknown;
}
/**
Resources configuration file.
Should be modified with --macro to be sure it's correctly setup before any code is compiled.
**/
class Config {
/**
Maps the extension to a given resource class. Example ["wav,mp3,ogg" => "hxd.res.Sound"]
**/
public static var extensions = [
"jpg,png,jpeg,gif,tga,dds,hdr" => "hxd.res.Image",
"fbx,hmd" => "hxd.res.Model",
"ttf" => "hxd.res.Font",
"fnt" => "hxd.res.BitmapFont",
"bdf" => "hxd.res.BDFFont",
"wav,mp3,ogg" => "hxd.res.Sound",
"tmx" => "hxd.res.TiledMap",
"atlas" => "hxd.res.Atlas",
"grd" => "hxd.res.Gradients",
#if hide
"prefab,fx,fx2d,l3d" => "hxd.res.Prefab",
"world" => "hxd.res.World"
#end
];
public static function addExtension( extension, className) {
extensions.set(extension, className);
}
/**
File extensions ignored by the resource scan
**/
public static var ignoredExtensions = [
"gal" => true, // graphics gale source
"lch" => true, // labchirp source
"fla" => true, // Adobe flash
];
/**
Directory names not explored by the resource scan
Example: `ignoredDirs = [ "backups"=>true ]`
**/
public static var ignoredDirs : Map<String,Bool> = [];
/**
Paired extensions are files that can have the same name but different extensions.
Only the "main" one will be accessible through hxd.Res.
Example : ["fbx" => "png,jpg,jpeg,gif"]
**/
public static var pairedExtensions = [
"fnt" => "png",
"fbx" => "png,jpg,jpeg,gif,tga",
"cdb" => "img",
"atlas" => "png",
"ogg" => "wav",
"mp3" => "wav",
"l3d" => "bake",
"css" => "less,css.map",
];
public static function addPairedExtension( main, shadow) {
if (pairedExtensions.exists(main))
pairedExtensions.set(main, pairedExtensions.get(main) + "," + shadow);
else
pairedExtensions.set(main, shadow);
}
static function defined( name : String ) {
return haxe.macro.Context.defined(name);
}
static function init() {
var pf =
if( defined("js") ) JS else
if( defined("hl") ) HL else
Unknown;
switch( pf ) {
case HL:
#if !heaps_enable_hl_mp3
ignoredExtensions.set("mp3", true);
#end
default:
#if !stb_ogg_sound
ignoredExtensions.set("ogg", true);
#end
}
return pf;
}
public static var platform : Platform = init();
}