Skip to content

Commit

Permalink
lots of things
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Jul 25, 2024
1 parent 403726d commit 1c41ae8
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 50 deletions.
38 changes: 13 additions & 25 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,35 @@ jobs:
- uses: krdlab/setup-haxe@master
with:
haxe-version: 4.3.3

- name: Restore Cache for Haxelib
- name: Restore Cache
uses: actions/cache@main
with:
key: cache-haxelib-${{ runner.os }}-${{ hashFiles('**/*.hxml') }}
key: cache-build-windows
path: |
.haxelib/
- name: Restore Cache for Build Artifacts
uses: actions/cache@main
with:
key: cache-build-${{ runner.os }}-${{ github.sha }}
path: |
export/debug/windows/
export/debug/windows/haxe/
export/debug/windows/obj/
restore-keys: |
cache-build-windows
- name: Install Haxelib
run: |
haxe -cp ./compileData -D analyzer-optimize -D incremental -main Libraries --interp
haxe -cp ./compileData -D analyzer-optimize -main Libraries --interp
- name: Create Version Tag
run: echo "${{github.run_id}}" > VERSION

- name: Compile
run: haxelib run lime build windows -debug

- name: Publish Artifact
uses: actions/upload-artifact@main
with:
name: windowsBuild
path: export/debug/windows/bin

- name: Update Cache for Haxelib
- name: Uploading new cache
uses: actions/cache@main
with:
key: cache-haxelib-${{ runner.os }}-${{ hashFiles('**/*.hxml') }}
key: cache-build-windows
path: |
.haxelib/
- name: Update Cache for Build Artifacts
uses: actions/cache@main
with:
key: cache-build-${{ runner.os }}-${{ github.sha }}
path: |
export/debug/windows/
export/debug/windows/haxe/
export/debug/windows/obj/
restore-keys: |
cache-build-windows
Binary file added assets/images/options/checker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sounds/cancel.ogg
Binary file not shown.
Binary file added assets/sounds/scroll.ogg
Binary file not shown.
Binary file added assets/sounds/select.ogg
Binary file not shown.
24 changes: 12 additions & 12 deletions source/backend/Input.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import flixel.input.FlxInput.FlxInputState;

class Input {
public static var actionMap:Map<String, FlxKey> = [
"left" => LEFT,
"down" => DOWN,
"up" => UP,
"right" => RIGHT,
"accept" => ENTER,
"exit" => ESCAPE
"left" => SaveData.getData("keyboardBinds")[0],
"down" => SaveData.getData("keyboardBinds")[1],
"up" => SaveData.getData("keyboardBinds")[2],
"right" => SaveData.getData("keyboardBinds")[3],
"accept" => SaveData.getData("keyboardBinds")[4],
"exit" => SaveData.getData("keyboardBinds")[5]
];

public static function is(action:String, ?state:FlxInputState = JUST_PRESSED, ?exact:Bool = false):Bool {
Expand Down Expand Up @@ -47,12 +47,12 @@ class Input {
}

public static var controllerMap:Map<String, FlxGamepadInputID> = [
"gamepad_left" => DPAD_LEFT,
"gamepad_down" => DPAD_DOWN,
"gamepad_up" => DPAD_UP,
"gamepad_right" => DPAD_RIGHT,
"gamepad_accept" => A,
"gamepad_exit" => B
"gamepad_left" => SaveData.getData("gamepadBinds")[0],
"gamepad_down" => SaveData.getData("gamepadBinds")[1],
"gamepad_up" => SaveData.getData("gamepadBinds")[2],
"gamepad_right" => SaveData.getData("gamepadBinds")[3],
"gamepad_accept" => SaveData.getData("gamepadBinds")[4],
"gamepad_exit" => SaveData.getData("gamepadBinds")[5]
];

public static function gamepadIs(key:String, ?state:FlxInputState = JUST_PRESSED):Bool {
Expand Down
5 changes: 4 additions & 1 deletion source/backend/SaveData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class SaveData {
#if desktop
["fullscreen", false],
#end
["framerate", 60]
["antialiasing", true],
["framerate", 60],
["keyboardBinds", [LEFT, DOWN, UP, RIGHT, ENTER, ESCAPE]],
["gamepadBinds", [DPAD_LEFT, DPAD_DOWN, DPAD_UP, DPAD_RIGHT, A, B]]
];

static public function init() {
Expand Down
2 changes: 1 addition & 1 deletion source/game/Bar.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import openfl.geom.Point;
import openfl.geom.Rectangle;
import openfl.display.BitmapData;

class Bar extends FlxSprite
class Bar extends GameSprite
{
private var _bgBarBit:BitmapData;
private var _bgBarRect:Rectangle;
Expand Down
2 changes: 1 addition & 1 deletion source/game/Button.hx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package game;

// TO-DO: maybe add a color tween??
class Button extends FlxSprite {
class Button extends GameSprite {
public var clickCallback:Void->Void;

public function new(x:Float = 0, y:Float = 0, file:String = null, clickCallback:Void->Void) {
Expand Down
8 changes: 8 additions & 0 deletions source/game/GameSprite.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package game;

class GameSprite extends FlxSprite {
public function new(x:Float = 0, y:Float = 0) {
super(x, y);
antialiasing = SaveData.getData("antialiasing");
}
}
2 changes: 1 addition & 1 deletion source/game/Note.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package game;

class Note extends FlxSprite {
class Note extends GameSprite {
public var dir:String = ''; // note direction
public var type:String = ''; // receptor or plain note

Expand Down
2 changes: 1 addition & 1 deletion source/game/Rating.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ typedef RatingData = {
var hitWindow:Int;
}

class Rating extends FlxSprite {
class Rating extends GameSprite {
public var name:String = '';
public var score:Int = 350;
public var hitWindow:Null<Int> = 0;
Expand Down
17 changes: 10 additions & 7 deletions source/states/MenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ class MenuState extends FlxState {
add(grid);

logo = new FlxSprite(0, 0).loadGraphic(Paths.image('title/logo'));
logo.scale.set(0.25, 0.25);
logo.screenCenter(X);
logo.scale.set(0.3, 0.3);
logo.x = (FlxG.width - logo.width * logo.scale.x) / 2;
logo.y = 0;
add(logo);

grpSelection = new FlxTypedGroup<FlxSprite>();
add(grpSelection);

for (i in 0...selections.length) {
var menuItem:FlxSprite = new FlxSprite(0, i * 200).loadGraphic(Paths.image('title/' + selections[i]));
var menuItem:FlxSprite = new FlxSprite(0, i * 160).loadGraphic(Paths.image('title/' + selections[i]));
menuItem.scale.set(0.3, 0.3);
menuItem.screenCenter(X);
menuItem.ID = i;
Expand All @@ -45,10 +46,10 @@ class MenuState extends FlxState {
override function update(elapsed:Float) {
super.update(elapsed);

if (FlxG.keys.justPressed.UP || FlxG.keys.justPressed.DOWN)
changeSelection(FlxG.keys.justPressed.UP ? -1 : 1);
if (Input.is("up") || Input.is("down"))
changeSelection(Input.is("up") ? -1 : 1);

if (FlxG.keys.justPressed.ENTER) {
if (Input.is("accept")) {
switch (curSelected) {
case 0:
FlxG.switchState(PlayState.new);
Expand All @@ -63,13 +64,15 @@ class MenuState extends FlxState {
function changeSelection(change:Int = 0) {
curSelected += change;

FlxG.sound.play(Paths.sound('scroll'));

if (curSelected < 0)
curSelected = grpSelection.length - 1;
if (curSelected >= grpSelection.length)
curSelected = 0;

grpSelection.forEach((spr:FlxSprite) -> {
spr.color = (spr.ID == curSelected) ? FlxColor.LIME : FlxColor.WHITE;
spr.alpha = (spr.ID == curSelected) ? 1 : 0.6;
});
}
}
1 change: 1 addition & 0 deletions source/states/OptionsState.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package states;

class OptionState extends FlxState {
var options:Array<String> = ["FPS Counter", "Fullscreen", "Antialiasing", "Framerate", "Controls", "Language"];
override function create() {
super.create();
}
Expand Down
1 change: 0 additions & 1 deletion source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class PlayState extends FlxState {

for (i in 0...noteDirs.length) {
var note:Note = new Note(i * 200, 50, noteDirs[i], "receptor");
note.screenCenter(X);
strumline.add(note);
}
}
Expand Down

0 comments on commit 1c41ae8

Please sign in to comment.