Class names need to start with a Capital letter and be followed by letters a-z or A-Z ( underscore can also be used ).
You define your main class when you call haxe command from the terminal followed by parameter pairs such as the name of the main class, -main Main
https://haxe.org/manual/compiler-usage.html
You can put your class in a folder and add 'package folderName;' on the top line above your class and then you can call it with haxe.
haxe -main folderName.Main ...add other compiler property pairs.
So 'Game' is a valid name. One important detail is that Haxe program requires a starting static function this is always named 'main', this can be used to create the class.
class Game {
static function main(){ new Game(); } // need a main static function.
public function new(){
// actual game class starts.
trace( 'game started');
}
}
Normally rather than write all the compiler parameters on the command line we put them it a file with a .hxml extension ie: compile.hxml
https://haxe.org/manual/compiler-usage-hxml.html
Some cross platform toolkits use json or xml definitions instead and sometimes tools to create these rather than run haxe compiler directly, this is because they do extra things like place all your assets in the output folder for you, and handles aspects like general settings for targetting c++ or js without having to have different hxml files.
For instance a popular cross platform graphics library for browser, desktop and mobile is openfl it describes it's build tools here:
https://lime.software/docs/command-line-tools/create-new-project/
Unfortunately all the cross target games toolkits use different build process but other haxe users are always happy to explain.
A good place to talk to Haxe users is on the haxe discord server, I think this link probably should work:
https://discord.gg/Agt3sJA
The main cross target - graphics rich ( suited to games ) toolkits for Haxe:
For doing traditional web development you can target js directly, but also Haxe provides some frameworks such as:
And obviously you can use Electron ( or Krom see Kha ) for nodejs apps.
- https://github.com/tong/hxelectron
I am not really sure what specific PHP, Java, C#, Lua, Python libraries to mention, but general Haxe ones that seem to be popular and very useful for all targets:
Not everything, but a taster of useful links that come to mind.
For general tutorials on Haxe there are many places, but perhaps a good place to start is to work through the cookbook.