Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Jul 24, 2024
0 parents commit d6ab029
Show file tree
Hide file tree
Showing 14 changed files with 345 additions and 0 deletions.
115 changes: 115 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# This is a basic workflow to help you get started with Actions

name: Build

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ main ]
pull_request:
branches: [ main ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
buildLinux:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- uses: krdlab/setup-haxe@master
with:
haxe-version: 4.2.5
# Runs a set of commands using the runners shell
- name: Install Haxelib
run: |
haxelib setup ~/haxelib
haxelib install lime
haxelib install openfl
haxelib install flixel
haxelib run lime setup flixel
haxelib run lime setup
haxelib install flixel-ui
haxelib install flixel-addons
haxelib install flixel-tools
haxelib list
- name: Create Version Tag
run: echo "${{github.run_id}}" > VERSION
- name: Compile Linux
run: haxelib run lime build Project.xml linux --app-version="4.0.0-${{ github.run_id}}"
- name: Publish Linux Artifact
uses: actions/upload-artifact@v2.2.4
with:
name: linuxBuild
path: 'export/release/linux/bin'
buildWindows:
runs-on: windows-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2.3.0

- uses: krdlab/setup-haxe@master
with:
haxe-version: 4.2.5
# Runs a set of commands using the runners shell
- name: Install Haxelib
run: |
haxelib setup C:/haxelib
haxelib install lime
haxelib install openfl
haxelib install flixel
haxelib run lime setup flixel
haxelib run lime setup
haxelib install flixel-ui
haxelib install flixel-addons
haxelib install flixel-tools
haxelib list
shell: cmd
- name: Create Version Tag
run: echo "${{github.run_id}}" > VERSION
- name: Compile
run: haxelib run lime build windows --app-version="4.0.0-${{ github.run_id}}"
- name: Publish Artifact
uses: actions/upload-artifact@v2.2.4
with:
name: windowsBuild
path: export/release/windows/bin
buildMac:
runs-on: macos-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- uses: krdlab/setup-haxe@master
with:
haxe-version: 4.2.5
# Runs a set of commands using the runners shell
- name: Install Haxelib
run: |
haxelib setup ~/haxelib
haxelib install hxcpp
haxelib install lime
haxelib install openfl
haxelib install flixel
haxelib run lime setup flixel
haxelib run lime setup
haxelib install flixel-ui
haxelib install flixel-addons
haxelib install flixel-tools
haxelib list
- name: Create Version Tag
run: echo "${{github.run_id}}" > VERSION
- name: Compile
run: haxelib run lime build mac --app-version="4.0.0-${{ github.run_id}}"
- name: Publish Artifact
uses: actions/upload-artifact@v2.2.4
with:
name: macBuild
path: export/release/macos/bin
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export/
.vscode/*
67 changes: 67 additions & 0 deletions Project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<project>

<!-- _________________________ Application Settings _________________________ -->

<app title="HaxeFlixel Template" file="Template" main="Main" version="1.0.0" company="Joalor64GH" />
<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="1280" height="720" fps="60" background="#000000" hardware="true" vsync="false" />

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

<!--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/debug" if="debug" />
<set name="BUILD_DIR" value="export/release" unless="debug" />

<source path="source" />

<assets path="assets/fonts" embed='true'/>
<assets path="assets/" rename="assets" exclude="*.mp3"/>

<!-- _______________________________ 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" />
<haxelib name="flixel-tools" />

<!-- ______________________________ Haxedefines _____________________________ -->

<!--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" />

<!--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" />

<!-- fix for macros -->
<haxeflag name="--macro" value="allowPackage('flash')" />
<haxeflag name="--macro" value="include('my.pack')" />

<!-- _________________________________ Custom _______________________________ -->

<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
</project>
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# HaxeFlixel Template

Just a simple template for making games with Flixel.
Empty file added assets/data/data-goes-here.txt
Empty file.
Empty file added assets/fonts/fonts-go-here.txt
Empty file.
Empty file.
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions 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"
}
}
26 changes: 26 additions & 0 deletions source/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package;

import flixel.FlxGame;
import openfl.display.Sprite;

class Main extends Sprite
{
var config = {
width: 1280, // Width of the game in pixels (might be less / more in actual pixels depending on your zoom).
height: 720, // Height of the game in pixels (might be less / more in actual pixels depending on your zoom).
zoom: -1.0, // If -1, zoom is automatically calculated to fit the window dimensions. (Removed from Flixel 5.0.0)
framerate: 60, // How many frames per second the game should run at.
initialState: PlayState, // is the state in which the game will start.
skipSplash: false, // Whether to skip the flixel splash screen that appears in release mode.
startFullscreen: false // Whether to start the game in fullscreen on desktop targets'
};

// You can pretty much ignore everything from here on - your code should go in your states.

public function new()
{
super();
addChild(new FlxGame(config.width, config.height, config.initialState, #if (flixel < "5.0.0") config.zoom, #end config.framerate, config.framerate,
config.skipSplash, config.startFullscreen));
}
}
93 changes: 93 additions & 0 deletions source/Paths.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package;

#if sys
import sys.FileSystem;
import sys.io.File;
#end
import flixel.FlxG;
import flixel.graphics.frames.FlxAtlasFrames;

class Paths
{
inline public static final SOUND_EXT = #if !html5 "ogg" #else "mp3" #end;
inline public static final VIDEO_EXT = "mp4";
inline public static final DEFAULT_FOLDER:String = 'assets';

static public function getPath(folder:Null<String>, file:String)
{
if (folder == null)
folder = DEFAULT_FOLDER;
return folder + '/' + file;
}

static public function file(file:String, folder:String = DEFAULT_FOLDER)
{
if (#if sys FileSystem.exists(folder) && #end (folder != null && folder != DEFAULT_FOLDER))
{
return getPath(folder, file);
}
return getPath(null, file);
}

inline static public function txt(key:String)
{
return file('data/$key.txt');
}

inline static public function xml(key:String)
{
return file('data/$key.xml');
}

inline static public function json(key:String)
{
return file('data/$key.json');
}

#if yaml
inline static public function yaml(key:String)
{
return file('data/$key.yaml');
}
#end

inline static public function video(key:String)
{
return file('videos/$key.$VIDEO_EXT');
}

inline static public function sound(key:String)
{
return file('sounds/$key.$SOUND_EXT');
}

inline static public function soundRandom(key:String, min:Int, max:Int)
{
return file('sounds/$key${FlxG.random.int(min, max)}.$SOUND_EXT');
}

inline static public function music(key:String)
{
return file('music/$key.$SOUND_EXT');
}

inline static public function image(key:String)
{
return file('images/$key.png');
}

inline static public function font(key:String)
{
return file('fonts/$key');
}

inline static public function getSparrowAtlas(key:String)
{
return FlxAtlasFrames.fromSparrow(image(key), file('images/$key.xml'));
}

inline static public function getPackerAtlas(key:String)
{
return FlxAtlasFrames.fromSpriteSheetPacker(image(key), file('images/$key.txt'));
}
}
21 changes: 21 additions & 0 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package;

import flixel.text.FlxText;
import flixel.FlxState;

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

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

override public function update(elapsed:Float)
{
super.update(elapsed);
}
}
3 changes: 3 additions & 0 deletions source/import.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#if !macro
import Paths;
#end

0 comments on commit d6ab029

Please sign in to comment.