Skip to content

Commit

Permalink
Added Everything
Browse files Browse the repository at this point in the history
  • Loading branch information
TRSandwich committed Jul 17, 2024
1 parent fcac66e commit d21f702
Show file tree
Hide file tree
Showing 17 changed files with 266 additions and 0 deletions.
Binary file added HelloWorld/.DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions HelloWorld/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"openfl.lime-vscode-extension",
"redhat.vscode-xml"
]
}
21 changes: 21 additions & 0 deletions HelloWorld/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Build + Debug",
"type": "lime",
"request": "launch"
},
{
"name": "Debug",
"type": "lime",
"request": "launch",
"preLaunchTask": null
},
{
"name": "Macro",
"type": "haxe-eval",
"request": "launch"
}
]
}
14 changes: 14 additions & 0 deletions HelloWorld/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"search.exclude": {
"export/**/*.*": true
},
"[haxe]": {
"editor.formatOnSave": true,
"editor.formatOnSaveMode":"modifications",
"editor.formatOnPaste": false,
"editor.codeActionsOnSave": {
"source.sortImports": true
}
},
"haxe.enableExtendedIndentation": true
}
13 changes: 13 additions & 0 deletions HelloWorld/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "lime",
"command": "test",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
91 changes: 91 additions & 0 deletions HelloWorld/Project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://lime.openfl.org/project/1.0.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://lime.openfl.org/project/1.0.4 http://lime.openfl.org/xsd/project-1.0.4.xsd">

<!-- _________________________ Application Settings _________________________ -->

<app title="HelloWorld" file="HelloWorld" main="Main" version="0.0.1" company="HaxeFlixel" />

<!--The flixel preloader is not accurate in Chrome. You can use it regularly if you embed the swf into a html file
or you can set the actual size of your file manually at "FlxPreloaderBase-onUpdate-bytesTotal"-->
<app preloader="flixel.system.FlxPreloader" />

<!--Minimum without FLX_NO_GAMEPAD: 11.8, without FLX_NO_NATIVE_CURSOR: 11.2-->
<set name="SWF_VERSION" value="11.8" />

<!-- ____________________________ Window Settings ___________________________ -->

<!--These window settings apply to all targets-->
<window width="640" height="480" fps="60" background="#000000" hardware="true" vsync="false" />

<!--HTML5-specific-->
<window if="html5" resizable="true" />

<!--Desktop-specific-->
<window if="desktop" orientation="landscape" fullscreen="false" resizable="true" />

<!--Mobile-specific-->
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" />

<!-- _____________________________ Path Settings ____________________________ -->

<set name="BUILD_DIR" value="export" />
<source path="source" />
<assets path="assets" />

<!-- _______________________________ Libraries ______________________________ -->

<haxelib name="flixel" />

<!--In case you want to use the addons package-->
<!--<haxelib name="flixel-addons" />-->

<!--In case you want to use the ui package-->
<!--<haxelib name="flixel-ui" />-->

<!--In case you want to use nape with flixel-->
<!--<haxelib name="nape-haxe4" />-->

<!-- ______________________________ Haxedefines _____________________________ -->

<!--Remove the legacy health system-->
<haxedef name="FLX_NO_HEALTH" />

<!--Enable the Flixel core recording system-->
<!--<haxedef name="FLX_RECORD" />-->

<!--Disable the right and middle mouse buttons-->
<!--<haxedef name="FLX_NO_MOUSE_ADVANCED" />-->

<!--Disable the native cursor API on Flash-->
<!--<haxedef name="FLX_NO_NATIVE_CURSOR" />-->

<!--Optimise inputs, be careful you will get null errors if you don't use conditionals in your game-->
<haxedef name="FLX_NO_MOUSE" if="mobile" />
<haxedef name="FLX_NO_KEYBOARD" if="mobile" />
<haxedef name="FLX_NO_TOUCH" if="desktop" />
<!--<haxedef name="FLX_NO_GAMEPAD" />-->

<!--Disable the Flixel core sound tray-->
<!--<haxedef name="FLX_NO_SOUND_TRAY" />-->

<!--Disable the Flixel sound management code-->
<!--<haxedef name="FLX_NO_SOUND_SYSTEM" />-->

<!--Disable the Flixel core focus lost screen-->
<!--<haxedef name="FLX_NO_FOCUS_LOST_SCREEN" />-->

<!--Disable the Flixel core debugger. Automatically gets set whenever you compile in release mode!-->
<haxedef name="FLX_NO_DEBUG" unless="debug" />

<!--Enable this for Nape release builds for a serious peformance improvement-->
<haxedef name="NAPE_RELEASE_BUILD" unless="debug" />

<!-- Haxe 4.3.0+: Enable pretty syntax errors and stuff. -->
<!-- pretty (haxeflixel default), indent, classic (haxe compiler default) -->
<haxedef name="message.reporting" value="pretty" />

<!-- _________________________________ Custom _______________________________ -->

<!--Place custom nodes like icons here-->
</project>
Binary file added HelloWorld/assets/.DS_Store
Binary file not shown.
Empty file.
Empty file.
File renamed without changes.
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions HelloWorld/hxformat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"lineEnds": {
"leftCurly": "both",
"rightCurly": "both",
"objectLiteralCurly": {
"leftCurly": "after"
}
},
"sameLine": {
"ifElse": "next",
"doWhile": "next",
"tryBody": "next",
"tryCatch": "next"
}
}
35 changes: 35 additions & 0 deletions HelloWorld/source/AssetPaths.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package;

/**
* Helper class to access asset paths in a type-safe manner.
*
* **NOTE:** this class is created when you use [`flixel template` command](https://haxeflixel.com/documentation/hello-world/#create-a-new-haxeflixel-project).
*
* `AssetPaths`'s static fields are autogenerated by a neat [Haxe macro](http://haxe.org/manual/macro.html)
* from the contents of [Project.xml's `<assets>`](https://lime.openfl.org/docs/project-files/xml-format/#assets)
* tag, so you can easily reference them in your code. For example, rather than using the string path
* `"assets/sounds/mySound.wav"`, this class will generate `AssetPaths.mySound__wav` that you can pass into
* `FlxG.sound.play` calls.
*
* Static fields available on `AssetPaths` will change whenever you add, remove, rename or move a file.
* If you remove a file that is still referenced via `AssetPaths` you'll get a compile error,
* this could be handy compared to using string paths, which only cause a runtime error if the file is missing.
*
* ## Ignored Assets
*
* In some cases `AssetPaths` will ignore your assets. The following cases will result in a warning
* at compile:
*
* - **Invalid haxe fields**: For example, the file `assets/1.ogg` will give a warning since
* `1__ogg` is not a valid haxe field name.
*
* - **Duplicate file names**: If you have assets with the same file names, whichever file is nested
* deeper or found later will be ignored. for example if you have assets `assets/hero/walk.png` and
* `assets/enemies/ranger/walk.png`, the latter will be ignored and the compiler will show a warning.
*
* @see [FlxAssets.buildFileReferences()](https://api.haxeflixel.com/flixel/system/FlxAssets.html#buildFileReferences) is used by `AssetPaths`
* and provides you some control on how `AssetPaths`'s fields are built.
* @see [Flixel 5.0.0 Migration guide - AssetPaths has less caveats](https://github.com/HaxeFlixel/flixel/wiki/Flixel-5.0.0-Migration-guide#assetpaths-has-less-caveats-2575)
**/
@:build(flixel.system.FlxAssets.buildFileReferences("assets", true))
class AssetPaths {}
17 changes: 17 additions & 0 deletions HelloWorld/source/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package;

import haxe.display.FsPath;
import flixel.FlxGame;
import openfl.display.Sprite;
import openfl.display.FPS;

class Main extends Sprite
{
public function new()
{
super();
addChild(new FlxGame(0, 0, MenuState));

addChild(new FPS(10, 10, 0xffffff));
}
}
34 changes: 34 additions & 0 deletions HelloWorld/source/MenuState.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package;

import flixel.FlxState;
import flixel.ui.FlxButton;
import flixel.FlxG;

class MenuState extends FlxState
{
var btnPlay:FlxButton;

override public function create()
{
super.create();

if (FlxG.sound.music == null)
{
FlxG.sound.playMusic(AssetPaths.Bleeping_Demo__mp3, 1, true);
}

btnPlay = new FlxButton(0, 0, "Play", clickPlay);
btnPlay.screenCenter();
add(btnPlay);
}

function clickPlay()
{
FlxG.switchState(new PlayState());
}

override public function update(elapsed:Float)
{
super.update(elapsed);
}
}
20 changes: 20 additions & 0 deletions HelloWorld/source/PlayState.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package;

import flixel.FlxState;

class PlayState extends FlxState
{
override public function create()
{
super.create();

var text = new flixel.text.FlxText(0, 0, 0, "Hello World", 64);
text.screenCenter();
add(text);
}

override public function update(elapsed:Float)
{
super.update(elapsed);
}
}

0 comments on commit d21f702

Please sign in to comment.