|
| 1 | +package; |
| 2 | + |
| 3 | +import hxp.*; |
| 4 | +import lime.tools.*; |
| 5 | + |
| 6 | +using StringTools; |
| 7 | + |
| 8 | +/** |
| 9 | + * This is the main project file for TechNotDrip Engine. |
| 10 | + * |
| 11 | + * This works exactly like an Project.xml but in Haxe Syntax. |
| 12 | + */ |
| 13 | +class Project extends HXProject |
| 14 | +{ |
| 15 | + public function new() |
| 16 | + { |
| 17 | + super(); |
| 18 | + |
| 19 | + setupApplicationSettings(); |
| 20 | + setupWindowSettings(); |
| 21 | + setupPathSettings(); |
| 22 | + setupHaxelibs(); |
| 23 | + setupHaxeDefines(); |
| 24 | + setupHaxeFlags(); |
| 25 | + } |
| 26 | + |
| 27 | + public function setupApplicationSettings():Void |
| 28 | + { |
| 29 | + meta.title = 'Friday Night Funkin\': TechNotDrip Engine'; |
| 30 | + app.file = 'TechNotDrip'; |
| 31 | + app.main = 'Main'; |
| 32 | + meta.version = '0.1.0'; |
| 33 | + meta.company = 'TilNotDrip'; |
| 34 | + app.preloader = 'flixel.system.FlxPreloader'; |
| 35 | + app.swfVersion = 11.8; |
| 36 | + } |
| 37 | + |
| 38 | + public function setupWindowSettings():Void |
| 39 | + { |
| 40 | + window.width = 1280; |
| 41 | + window.height = 720; |
| 42 | + window.background = 0; |
| 43 | + window.hardware = true; |
| 44 | + window.vsync = false; |
| 45 | + |
| 46 | + if (platformType == WEB) |
| 47 | + { |
| 48 | + window.resizable = true; |
| 49 | + } |
| 50 | + |
| 51 | + if (platformType == DESKTOP) |
| 52 | + { |
| 53 | + window.orientation = LANDSCAPE; |
| 54 | + window.fullscreen = false; |
| 55 | + window.resizable = true; |
| 56 | + } |
| 57 | + |
| 58 | + if (platformType == MOBILE) |
| 59 | + { |
| 60 | + window.orientation = LANDSCAPE; |
| 61 | + window.fullscreen = false; |
| 62 | + window.width = 0; |
| 63 | + window.height = 0; |
| 64 | + } |
| 65 | + } |
| 66 | + |
| 67 | + public function setupPathSettings():Void |
| 68 | + { |
| 69 | + app.path = getBuildDirectory(); |
| 70 | + |
| 71 | + var excludeList:Array<String> = []; |
| 72 | + excludeList.push((platformType == WEB) ? 'ogg' : 'mp3'); |
| 73 | + |
| 74 | + // TODO: Maybe scan the entire assets folder instead like base fnf. |
| 75 | + includeAssets("assets", "assets", ['*'], excludeList); |
| 76 | + |
| 77 | + icons.push(new Icon('extras/appicons/icon16.png', 16)); |
| 78 | + icons.push(new Icon('extras/appicons/icon32.png', 32)); |
| 79 | + icons.push(new Icon('extras/appicons/icon64.png', 64)); |
| 80 | + icons.push(new Icon('extras/appicons/icon.png')); |
| 81 | + |
| 82 | + sources.push('src'); |
| 83 | + } |
| 84 | + |
| 85 | + public function setupHaxelibs():Void |
| 86 | + { |
| 87 | + haxelibs.push(new Haxelib('lime', '8.2.1')); |
| 88 | + haxelibs.push(new Haxelib('openfl', '9.4.0')); |
| 89 | + haxelibs.push(new Haxelib('flixel', '5.8.0')); |
| 90 | + haxelibs.push(new Haxelib('flixel-addons', '3.2.3')); |
| 91 | + |
| 92 | + if (debug) |
| 93 | + haxelibs.push(new Haxelib('hxcpp-debug-server', '1.2.4')); |
| 94 | + } |
| 95 | + |
| 96 | + public function setupHaxeDefines():Void |
| 97 | + { |
| 98 | + if (!debug) |
| 99 | + haxedefs.set('FLX_NO_DEBUG', ''); |
| 100 | + |
| 101 | + haxedefs.set('FLX_NO_HEALTH', ''); |
| 102 | + |
| 103 | + if (platformType == MOBILE) |
| 104 | + { |
| 105 | + haxedefs.set('FLX_NO_KEYBOARD', ''); |
| 106 | + haxedefs.set('FLX_NO_MOUSE', ''); |
| 107 | + } |
| 108 | + |
| 109 | + if (platformType == DESKTOP) |
| 110 | + { |
| 111 | + haxedefs.set('FLX_NO_TOUCH', ''); |
| 112 | + } |
| 113 | + |
| 114 | + haxedefs.set('message.reporting', 'pretty'); |
| 115 | + |
| 116 | + if (!debug) |
| 117 | + haxedefs.set('NAPE_RELEASE_BUILD', ''); |
| 118 | + } |
| 119 | + |
| 120 | + public function setupHaxeFlags():Void |
| 121 | + { |
| 122 | + haxeflags.push('-dce no'); |
| 123 | + haxeflags.push("--macro include('funkin')"); |
| 124 | + haxeflags.push("--macro addMetadata('@:build(funkin.macros.ZProperty.build())', 'flixel.FlxBasic')"); |
| 125 | + } |
| 126 | + |
| 127 | + function getBuildDirectory():String |
| 128 | + { |
| 129 | + var buildDir:String = 'export/' + ((debug) ? 'debug' : 'release'); |
| 130 | + return buildDir; |
| 131 | + } |
| 132 | +} |
0 commit comments