Skip to content

Commit

Permalink
fix icons when not 150x150 or a multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
Vortex2Oblivion committed Dec 10, 2024
1 parent 3b7908c commit a38575b
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 77 deletions.
19 changes: 9 additions & 10 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import flixel.FlxGame;
import flixel.FlxState;
import flixel.system.debug.log.LogStyle;
import haxe.CallStack;
import haxe.EntryPoint;
import haxe.Log;
import haxe.io.Path;
import openfl.Lib;
Expand All @@ -16,7 +17,6 @@ import openfl.text.TextFormat;
import states.TitleState;
import ui.SimpleInfoDisplay;
import ui.logs.Logs;
import ui.logs.LogFrontEnd;
import sys.FileSystem;
import sys.io.File;
import sys.io.Process;
Expand Down Expand Up @@ -59,10 +59,9 @@ class Main extends Sprite {
logsOverlay.visible = false;
addChild(logsOverlay);

/*untyped FlxG.log = new LogFrontEnd();
LogStyle.WARNING.callback = (data) -> trace(data, WARNING);
LogStyle.ERROR.callback = (data) -> trace(data, ERROR);
LogStyle.NOTICE.callback = (data) -> trace(data, LOG); */
LogStyle.WARNING.onLog.add(data -> trace(data, WARNING));
LogStyle.ERROR.onLog.add(data -> trace(data, ERROR));
LogStyle.NOTICE.onLog.add(data -> trace(data));

display = new SimpleInfoDisplay(8, 3, 0xFFFFFF, "_sans");
addChild(display);
Expand Down Expand Up @@ -207,11 +206,11 @@ class Main extends Sprite {
:~~!!!!!!!!7777777777777?????J???J???????????????????J?????????????????????JJJ??JJJJJ?????JJ??J???JJJJJJ?JJJJ!
.^!~77?777!77777777777????????JJJJJJJJJ?J????????????????JJJJ????????????JJJJJJJJ?JJJJJJJJJ?JJJ?JJJ?JJJJJ?JYJJJ?.
.~~!???????????????J????JJ??JJJJJJYJJJJJJJJJ?JJJJ??J??JJ?JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ??J?JJJJJJJYYJJJJ7
.~~7YYYJJJ?J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5YJY55YY5YJJJ???????JJJJJJ7^. :7Y55YYJJJ.
.!?J5PPPP55555P555555555555555555YYYYYY5B#GG#PYJJYYYJJJJYJYYJY5YJ55555YJJJJ??????7~^^^^: .^?YYYY7.
.^7?YY5PP555PPP5555555555555555555YYYY5GBGGPYYYYYYYYJJYYY5YJ5YY5555YYJJJJJJJJJJ??!~: .::
.:~7?JY55YYYYYYYYYYYYY5YJJJJJJJJ???777777!!!!!!!!!!~~!!!!!!!~!55YYYJYYJJJJJJJJJ??7!:
Expand Down
2 changes: 1 addition & 1 deletion source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,7 @@ class PlayState extends MusicBeatState {
for (susNote in 0...Math.floor(swagNote.sustainLength / Std.int(Conductor.stepCrochet))) {
oldNote = unspawnNotes[unspawnNotes.length - 1];

var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + (Conductor.stepCrochet / (Options.getData("downscroll") ? 1 : FlxMath.roundDecimal(speed,
var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + (Conductor.stepCrochet / ((Options.getData("downscroll") || SONG.modchartingTools) ? 1 : FlxMath.roundDecimal(speed,
2))), noteData, oldNote, true,
char, songNotes[4], null, chars, gottaHitNote);
sustainNote.scrollFactor.set();
Expand Down
19 changes: 15 additions & 4 deletions source/ui/HealthIcon.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ui;

import flixel.FlxSprite;
import haxe.Json;
import lime.utils.Assets;

Expand Down Expand Up @@ -34,7 +35,7 @@ class HealthIcon extends TrackerSprite {
fps: 24,
antialiasing: true
};
for (path in ['$char-icons', 'icon-$char', char]) {
for (path in [char, '$char-icons', 'icon-$char']) {
if (Assets.exists(Paths.image('icons/$path'))) {
iconPath = path;
break;
Expand All @@ -56,10 +57,20 @@ class HealthIcon extends TrackerSprite {
animation.addByPrefix('lose', '${char}-lose0', iconConfig.fps, true, isPlayer);
animation.addByPrefix('win', '${char}-win0', iconConfig.fps, true, isPlayer);
} else {
loadGraphic(Paths.gpuBitmap('icons/$iconPath'), true, 150, 150);
var dummy:FlxSprite = new FlxSprite().loadGraphic(Paths.gpuBitmap('icons/$iconPath'));

if (dummy.height != 150) // damn psych engine edge cases >:(
loadGraphic(Paths.gpuBitmap('icons/$iconPath'), true, Std.int(dummy.width / 2), Std.int(dummy.height));
else
loadGraphic(Paths.gpuBitmap('icons/$iconPath'), true, 150, 150);
dummy.destroy();
dummy = null;
var winFrame:Int = (width >= 450 ? 2 : 0);
var loseFrame:Int = (width >= 300 ? 1 : 0);

animation.add('win', [winFrame], 0, false, isPlayer);
animation.add('lose', [loseFrame], 0, false, isPlayer);
animation.add('neutral', [0], 0, false, isPlayer);
animation.add('lose', [1], 0, false, isPlayer);
animation.add('win', [2], 0, false, isPlayer);
}
animation.play('neutral');

Expand Down
48 changes: 0 additions & 48 deletions source/ui/logs/LogFrontEnd.hx

This file was deleted.

32 changes: 18 additions & 14 deletions source/utilities/CoolUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import lime.app.Application;
import lime.graphics.Image;
import lime.utils.Assets;
import ui.logs.Logs;
import haxe.EntryPoint;
import haxe.Log;
import haxe.Json;
import haxe.PosInfos;


/**
* Helper class with lots of utilitiy functions.
*/
Expand Down Expand Up @@ -345,21 +347,23 @@ class CoolUtil {
**/
public static function print(message:String, ?type:PrintType = LOG, ?pos_infos:PosInfos):Void {
untyped __cpp__("std::cout << {0}", '${Log.formatOutput('${messageFromPrintType(type)} $message', pos_infos)}\n');
switch (type) {
case DEBUG:
Logs.debug(Log.formatOutput(message, pos_infos));
case WARNING:
Logs.warn(Log.formatOutput(message, pos_infos));
case ERROR:
Logs.error(Log.formatOutput(message, pos_infos));
default:
Logs.log(Log.formatOutput(message, pos_infos));
}
EntryPoint.runInMainThread(() -> {
switch (type) {
case DEBUG:
Logs.debug(Log.formatOutput(message, pos_infos));
case WARNING:
Logs.warn(Log.formatOutput(message, pos_infos));
case ERROR:
Logs.error(Log.formatOutput(message, pos_infos));
default:
Logs.log(Log.formatOutput(message, pos_infos));
}
});
}

public static function messageFromPrintType(?type:PrintType = LOG):String{
public static function messageFromPrintType(?type:PrintType = LOG):String {
var messagePrefix:String;
switch (type){
switch (type) {
case DEBUG:
messagePrefix = '${ansi_colors["green"]} DEBUG';
case WARNING:
Expand All @@ -377,7 +381,7 @@ class CoolUtil {
@author Leather128
**/
public dynamic static function haxe_trace(v:Dynamic, ?infos:Null<PosInfos>){}
public dynamic static function haxe_trace(v:Dynamic, ?infos:Null<PosInfos>) {}

public static inline function getCurrentVersion():String {
return 'v' + Application.current.meta.get('version');
Expand All @@ -391,7 +395,7 @@ class CoolUtil {
var difficultyExtension:String = difficulty == 'normal' ? '' : '-$difficulty';
var difficultyExtensionMeta:String = (difficulty == 'nightmare' || difficulty == 'erect') ? '-erect' : '';

if(mix != null && Assets.exists('$difficultyExtensionMeta-$mix')){
if (mix != null && Assets.exists('$difficultyExtensionMeta-$mix')) {
difficultyExtensionMeta += '-$mix';
}

Expand Down

0 comments on commit a38575b

Please sign in to comment.