Skip to content

Commit

Permalink
options screen dark mode update
Browse files Browse the repository at this point in the history
Sorry, can't wait for the flixel 5 update, I need a build now
  • Loading branch information
Sonamaker1 committed Dec 14, 2023
1 parent bc1cfc7 commit 2e5d3a6
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 10 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/removed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This is a basic workflow to help you get started with Actions

name: RemovedInstructions

# 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 ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# 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"
buildWindows:
runs-on: windows-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]

- 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 git hxcpp https://github.com/Sonamaker1/hxcpp --always > nul
haxelib --always set lime 8.0.2 > nul
haxelib --never install flixel 4.11.0 > nul
haxelib run lime setup flixel > nul
haxelib run lime setup > nul
haxelib --always set openfl 9.2.1 > nul
haxelib --always set flixel-tools 1.5.1 > nul
haxelib --always set flixel-ui 2.4.0 > nul
haxelib --always set flixel-addons 2.11.0 > nul
haxelib --always set hxCodec 2.5.1 > nul
haxelib git linc_luajit https://github.com/superpowers04/linc_luajit > nul
haxelib git hscript https://github.com/HaxeFoundation/hscript > nul
haxelib git hscript-ex https://github.com/ianharrigan/hscript-ex > nul
haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc > nul
haxelib --always set lime 8.0.2 > nul
haxelib git hxcpp https://github.com/Sonamaker1/hxcpp --always > nul
haxelib libpath hxcpp
haxelib install format > nul
haxelib install hxp > nul
haxelib list
haxelib run lime rebuild hxcpp
shell: cmd
- name: Create Version Tag
run: echo "${{github.run_id}}" > VERSION
- name: Compile
run: |
haxelib run lime rebuild windows
haxelib run lime rebuild tools
haxelib run lime build windows --app-version="4.0.0-${{ github.run_id}}"
- name: Publish Artifact
uses: actions/[email protected]
with:
name: windowsBuild
path: export/release/windows/bin

2 changes: 1 addition & 1 deletion example_menus/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"DiscordClient": [["clientID", "863222024192262205"]],
"MainMenuState": [["psychEngineVersion", "0.6.3"]]
"MainMenuState": [["psychEngineVersion", "0.6.3+"]]
}
8 changes: 4 additions & 4 deletions source/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ class FunkinLua {
Lua_helper.add_callback(lua, "getPropertyFromClass", function(classVarInput:String, variable:String) {
@:privateAccess
var classVar = classVarInput;
trace("Is clientprefs? " + (classVar.indexOf("backend.ClientPrefs")>=0));
//trace("Is clientprefs? " + (classVar.indexOf("backend.ClientPrefs")>=0));

//Is this a 0.7 thing?
var isZeroPointSeven = classVar.indexOf("backend.")>=0 ||
Expand All @@ -1072,7 +1072,7 @@ class FunkinLua {
var splitIt=classVar.split('.');
classVar = classVar.split('.').slice(1,splitIt.length).join("");
}

trace("Asked for "+classVarInput +", so returned "+ classVarInput);
var killMe:Array<String> = variable.split('.');
if(killMe.length > 1) {
var coverMeInPiss:Dynamic = getVarInArray(Type.resolveClass(classVar), killMe[0]);
Expand All @@ -1086,7 +1086,7 @@ class FunkinLua {
Lua_helper.add_callback(lua, "setPropertyFromClass", function(classVarInput:String, variable:String, value:Dynamic) {
@:privateAccess
var classVar = classVarInput;
trace("Is clientprefs? " + (classVar.indexOf("backend.ClientPrefs")>=0));
//trace("Is clientprefs? " + (classVar.indexOf("backend.ClientPrefs")>=0));

//Is this a 0.7 thing?
var isZeroPointSeven = classVar.indexOf("backend.")>=0 ||
Expand All @@ -1102,7 +1102,7 @@ class FunkinLua {
var splitIt=classVar.split('.');
classVar = classVar.split('.').slice(1,splitIt.length).join("");
}

trace("Asked for "+classVarInput +", so returned "+ classVarInput);
var killMe:Array<String> = variable.split('.');
if(killMe.length > 1) {
var coverMeInPiss:Dynamic = getVarInArray(Type.resolveClass(classVar), killMe[0]);
Expand Down
25 changes: 24 additions & 1 deletion source/options/BaseOptionsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ class BaseOptionsMenu extends MusicBeatSubstate
optionText.yMult = 90;*/
optionText.targetY = i;
grpOptions.add(optionText);

if(OptionsState.darkModeEnabled){
@:privateAccess
for (sprite in optionText._sprites)
{
OptionsState.transformColor(sprite,255,255,255);
}
}

if(optionsArray[i].type == 'bool') {
var checkbox:CheckboxThingie = new CheckboxThingie(optionText.x - 105, optionText.y, optionsArray[i].getValue() == true);
Expand All @@ -111,6 +119,14 @@ class BaseOptionsMenu extends MusicBeatSubstate
valueText.ID = i;
grpTexts.add(valueText);
optionsArray[i].setChild(valueText);

if(OptionsState.darkModeEnabled){
@:privateAccess
for (sprite in valueText._sprites)
{
OptionsState.transformColor(sprite,255,255,255);
}
}
}
//optionText.snapToPosition(); //Don't ignore me when i ask for not making a fucking pull request to uncomment this line ok

Expand All @@ -128,6 +144,13 @@ class BaseOptionsMenu extends MusicBeatSubstate
public function addOption(option:Option) {
if(optionsArray == null || optionsArray.length < 1) optionsArray = [];
optionsArray.push(option);
@:privateAccess
if(option.child!=null && OptionsState.darkModeEnabled){
for (sprite in option.child._sprites)
{
OptionsState.transformColor(sprite,255,255,255);
}
}
}

var nextAccept:Int = 5;
Expand Down Expand Up @@ -350,4 +373,4 @@ class BaseOptionsMenu extends MusicBeatSubstate
checkbox.daValue = (optionsArray[checkbox.ID].getValue() == true);
}
}
}
}
24 changes: 23 additions & 1 deletion source/options/ControlsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ class ControlsSubState extends MusicBeatSubstate {
optionText.screenCenter(X);
optionText.y -= 55;
optionText.startPosition.y -= 55;
if(!isDefaultKey && OptionsState.darkModeEnabled){
@:privateAccess
for (sprite in optionText._sprites)
{
OptionsState.transformColor(sprite,255,255,255);
}
}
}
optionText.changeX = false;
optionText.distancePerItem.y = 60;
Expand Down Expand Up @@ -279,12 +286,27 @@ class ControlsSubState extends MusicBeatSubstate {
text1.sprTracker = optionText;
grpInputs.push(text1);
add(text1);
if(OptionsState.darkModeEnabled){
@:privateAccess
for (sprite in text1._sprites)
{
OptionsState.transformColor(sprite,255,255,255);
}
}

var text2 = new AttachedText(InputFormatter.getKeyName(keys[1]), 650, -55);
text2.setPosition(optionText.x + 650, optionText.y - 55);
text2.sprTracker = optionText;
grpInputsAlt.push(text2);
add(text2);

if(OptionsState.darkModeEnabled){
@:privateAccess
for (sprite in text2._sprites)
{
OptionsState.transformColor(sprite,255,255,255);
}
}
}

function reloadKeys() {
Expand Down Expand Up @@ -343,4 +365,4 @@ class ControlsSubState extends MusicBeatSubstate {
}
}
}
}
}
10 changes: 9 additions & 1 deletion source/options/NotesSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ class NotesSubState extends MusicBeatSubstate
hsbText = new Alphabet(posX + 560, 0, "Hue Saturation Brightness", false);
hsbText.scaleX = 0.6;
hsbText.scaleY = 0.6;

if(OptionsState.darkModeEnabled){
@:privateAccess
for (sprite in hsbText._sprites)
{
OptionsState.transformColor(sprite,255,255,255);
}
}
add(hsbText);

changeSelection();
Expand Down Expand Up @@ -287,4 +295,4 @@ class NotesSubState extends MusicBeatSubstate
if(roundedValue < 0) letter.offset.x += 10;
}
}
}
}
9 changes: 8 additions & 1 deletion source/options/Option.hx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ class Option
{
if(child != null) {
child.text = newValue;
if(OptionsState.darkModeEnabled){
@:privateAccess
for (sprite in child._sprites)
{
OptionsState.transformColor(sprite,255,255,255);
}
}
}
return null;
}
Expand All @@ -149,4 +156,4 @@ class Option
type = newValue;
return type;
}
}
}
11 changes: 10 additions & 1 deletion source/options/OptionsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ class OptionsState extends MusicBeatState
private var grpOptions:FlxTypedGroup<Alphabet>;
private static var curSelected:Int = 0;
public static var menuBG:FlxSprite;
public static var darkModeEnabled = false;
public static function transformColor(spr:FlxSprite, r:Int, g:Int, b:Int){
if ((spr != null) && spr.exists)
{
spr.colorTransform.redOffset = r;
spr.colorTransform.blueOffset = g;
spr.colorTransform.greenOffset = b;
}
}

function openSelectedSubstate(label:String) {
switch(label) {
Expand Down Expand Up @@ -138,4 +147,4 @@ class OptionsState extends MusicBeatState
}
FlxG.sound.play(Paths.sound('scrollMenu'));
}
}
}

0 comments on commit 2e5d3a6

Please sign in to comment.