Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshtynjala/openfl-custom-app-main-sample
A sample OpenFL project that customizes the haxe/ApplicationMain.hx template file
https://github.com/joshtynjala/openfl-custom-app-main-sample
haxe openfl openfl-samples
Last synced: about 1 month ago
JSON representation
A sample OpenFL project that customizes the haxe/ApplicationMain.hx template file
- Host: GitHub
- URL: https://github.com/joshtynjala/openfl-custom-app-main-sample
- Owner: joshtynjala
- Created: 2023-03-09T23:44:02.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-16T22:19:06.000Z (about 1 year ago)
- Last Synced: 2024-10-30T08:26:05.009Z (3 months ago)
- Topics: haxe, openfl, openfl-samples
- Language: Haxe
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# OpenFL custom _ApplicationMain.hx_ template
The [OpenFL](https://openfl.org) library for Haxe contains a number of template files that are used when building a project. You can find them in the [_assets/templates_](https://github.com/openfl/openfl/tree/develop/assets/templates) directory. Using the `` element in _project.xml_, it's possible to replace one or more of these template files with custom versions, on a per-project basis, and without forking OpenFL.
This sample project contains a directory named [_custom-templates_](https://github.com/joshtynjala/openfl-custom-app-main-sample/tree/main/custom-templates). It is configured in [_project.xml_](https://github.com/joshtynjala/openfl-custom-app-main-sample/tree/main/project.xml) like this:
```xml
```
Inside [_custom-templates_](https://github.com/joshtynjala/openfl-custom-app-main-sample/tree/main/custom-templates), there's a file at [_haxe/ApplicationMain.hx_](https://github.com/joshtynjala/openfl-custom-app-main-sample/tree/main/custom-templates/haxe/ApplicationMain.hx). The relative path to this file matches the file named [_haxe/ApplicationMain.hx_](https://github.com/openfl/openfl/tree/develop/assets/templates/haxe/ApplicationMain.hx) inside OpenFL's [_assets/templates_](https://github.com/openfl/openfl/tree/develop/assets/templates) directory.
The custom [_haxe/ApplicationMain.hx_](https://github.com/joshtynjala/openfl-custom-app-main-sample/tree/main/custom-templates/haxe/ApplicationMain.hx) template file contains several `trace()` calls during the OpenFL initialization process. To confirm that the custom [_haxe/ApplicationMain.hx_](https://github.com/joshtynjala/openfl-custom-app-main-sample/tree/main/custom-templates/haxe/ApplicationMain.hx) is being used by the project, compile and run, and check the debug console for output.
```sh
openfl test html5
```This custom [_haxe/ApplicationMain.hx_](https://github.com/joshtynjala/openfl-custom-app-main-sample/tree/main/custom-templates/haxe/ApplicationMain.hx) is a simplified version of the default one used by OpenFL. It doesn't create a preloader or load any assets, and it removes the macros that enable some more advanced features that most projects don't need.
Sample created by [Josh Tynjala](https://github.com/sponsors/joshtynjala), the author of [Feathers UI](https://feathersui.com/) and core contributor to [OpenFL](https://openfl.org/).