A few days ago I thought, “Wouldn’t it be interesting to make a program using OpenFL where I don’t have to invoke the compiler with openfl test
?”.
Since then I’ve been trying some different things, but without much success. The most promising-looking thing I’ve ended up with is:
./Source/Main.hx
package;
import lime.ui.WindowAttributes;
import openfl.display.Sprite;
class Main extends openfl.display.Sprite
{
public static function main()
{
var init = new Main();
var winAtt:WindowAttributes =
{
allowHighDPI : true,
alwaysOnTop : false,
borderless : false,
context :
{
antialiasing : 2,
background : 0xFFFFFF,
hardware = true;
}
frameRate : 60,
fullscreen : false,
height : 300,
maximized : false,
resizable : true,
title : "Window Title",
width : 400,
}
init.stage.application.createWindow(winAtt);
}
public function new()
{
super();
}
}
./build.hxml
-cp Source
-main Main
-cpp Build
-lib lime
-lib openfl
Except I only seem to get segmentation faults from it.
What I’m trying to make for is a system where I can compile with haxe build.hxml
and run with ./Build/Main
, which will create a window as if I’d made the program with OpenFL normally. I’m doing this because I want to get more flexibility with the file system around my binary, and because I’m hoping I’ll be able to apply this to making additional windows from a running project.
The main sources I’ve looked through are this and this, I’m wondering if anyone might be able to direct me to more information?
Thank you.