1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-09-04 04:38:09 +00:00

Compare commits

...

10 commits

Author SHA1 Message Date
cyn0x8 b30c4b982b
windows dark theme + window color support 2025-07-22 20:01:37 -07:00
Lasercar c2eff142bd Bunker infiltrated 2025-07-22 14:45:47 -07:00
Eric 2784fa18c0
Merge pull request #5476 from Trofem/api-version-example-mods-for-0.7.0
[CHORE] Updates example_mods's API version up to 0.7.0
2025-07-22 12:03:19 -04:00
Eric ad07fddf89
Merge pull request #5489 from FunkinCrew/main
Update develop to latest main
2025-07-22 11:59:29 -04:00
trofim.al 4768eedd5b api version 0.7.0
Update example mod's API version so it actually loads. part 2.
2025-07-22 15:04:20 +11:00
Hyper_ f1c3e99a11 lasercar................................................................................................................................................................................................. 2025-07-22 07:56:29 +08:00
Hyper_ eefe8927c4 The most deranged line loss of all time 2025-07-21 17:43:55 -05:00
cherry 3ff4f14510 Clear key from correct map 2025-07-21 17:13:42 -05:00
Abnormal 955b0db542 THE REALLY COOL STUTTERING FIX!!!!!!!!!!!! 2025-07-21 15:06:19 -05:00
Eric d2df4f0832
Merge pull request #5440 from FunkinCrew/main
Update develop branch
2025-07-21 13:08:44 -04:00
10 changed files with 186 additions and 7 deletions

View file

@ -59,7 +59,7 @@ body:
attributes:
label: Version
description: Which version are you playing on? The game version is in the bottom left corner of the main menu.
placeholder: ex. 0.7.3
placeholder: ex. 0.7.4
validations:
required: true

View file

@ -36,7 +36,7 @@ body:
attributes:
label: Version
description: Which version are you playing on? The game version is in the bottom left corner of the main menu.
placeholder: ex. 0.7.3
placeholder: ex. 0.7.4
validations:
required: true

View file

@ -36,7 +36,7 @@ body:
attributes:
label: Version
description: Which version are you compiling? The game version is in the bottom left corner of the main menu or in the project.hxp file.
placeholder: ex. 0.7.3
placeholder: ex. 0.7.4
validations:
required: true

View file

@ -60,7 +60,7 @@ body:
attributes:
label: Version
description: Which version are you playing on? The game version is in the bottom left corner of the main menu.
placeholder: ex. 0.7.3
placeholder: ex. 0.7.4
validations:
required: true

View file

@ -60,7 +60,7 @@ This section provides guidelines to follow when [opening an issue](https://githu
## Requirements
Make sure you're playing:
- the latest version of the game (currently v0.7.3)
- the latest version of the game (currently v0.7.4)
- without any mods
- on [Newgrounds](https://www.newgrounds.com/portal/view/770371) or downloaded from [itch.io](https://ninja-muffin24.itch.io/funkin)

View file

@ -6,7 +6,7 @@
"name": "EliteMasterEric"
}
],
"api_version": "0.5.0",
"api_version": "0.7.0",
"mod_version": "1.0.0",
"license": "Apache-2.0"
}

View file

@ -6,7 +6,7 @@
"name": "EliteMasterEric"
}
],
"api_version": "0.5.0",
"api_version": "0.7.0",
"mod_version": "1.0.0",
"license": "Apache-2.0"
}

View file

@ -56,6 +56,11 @@ class Main extends Sprite
{
super();
#if (cpp && windows)
// Enable dark mode support for the title bar.
funkin.util.WindowUtil.setWindowDarkMode(true, true);
#end
// Initialize custom logging.
haxe.Log.trace = funkin.util.logging.AnsiTrace.trace;
funkin.util.logging.AnsiTrace.traceBF();

View file

@ -118,6 +118,11 @@ class FunkinPreloader extends FlxBasePreloader
public function new()
{
#if (cpp && windows)
// Enable dark mode support for the title bar.
funkin.util.WindowUtil.setWindowDarkMode(true, true);
#end
super(Constants.PRELOADER_MIN_STAGE_TIME);
// We can't even call trace() yet, until Flixel loads.

View file

@ -1,5 +1,6 @@
package funkin.util;
import flixel.util.FlxColor;
import flixel.util.FlxSignal.FlxTypedSignal;
using StringTools;
@ -8,10 +9,59 @@ using StringTools;
* Utilities for operating on the current window, such as changing the title.
*/
#if (cpp && windows)
@:buildXml('
<target id="haxe">
<lib name="dwmapi.lib" if="windows"/>
</target>
')
@:cppFileCode('
#include <iostream>
#include <windows.h>
#include <psapi.h>
#include <dwmapi.h>
#include <winuser.h>
#define attributeDarkMode 20
#define attributeDarkModeFallback 19
#define attributeBorderColor 34
#define attributeCaptionColor 35
#define attributeTextColor 36
struct HandleData {
DWORD pid = 0;
HWND handle = 0;
};
BOOL CALLBACK findByPID(HWND handle, LPARAM lParam) {
DWORD targetPID = ((HandleData*)lParam)->pid;
DWORD curPID = 0;
GetWindowThreadProcessId(handle, &curPID);
if (targetPID != curPID || GetWindow(handle, GW_OWNER) != (HWND)0 || !IsWindowVisible(handle)) {
return TRUE;
}
((HandleData*)lParam)->handle = handle;
return FALSE;
}
HWND curHandle = 0;
void getHandle() {
if (curHandle == (HWND)0) {
HandleData data;
data.pid = GetCurrentProcessId();
EnumWindows(findByPID, (LPARAM)&data);
curHandle = data.handle;
}
}
void forceRedraw() {
if (curHandle != (HWND)0) {
SetWindowPos(curHandle, HWND_TOP, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
RedrawWindow(curHandle, nullptr, nullptr, RDW_INVALIDATE | RDW_NOERASE | RDW_UPDATENOW | RDW_FRAME);
}
}
')
#end
@:nullSafety
@ -175,4 +225,123 @@ class WindowUtil
}
#end
}
/**
* Enables or disables dark mode support for the title bar.
*
* Only works on Windows 1809 and later.
*
* @param enable Whether to enable or disable dark mode support.
* @param instant Whether to skip the transition tween.
*/
public static function setWindowDarkMode(enable:Bool = true, instant:Bool = false):Void
{
#if (cpp && windows)
var success:Bool = false;
untyped __cpp__('
getHandle();
if (curHandle != (HWND)0) {
const BOOL darkMode = enable ? TRUE : FALSE;
success = (S_OK == DwmSetWindowAttribute(curHandle, attributeDarkMode, (LPCVOID)&darkMode, (DWORD)sizeof(darkMode)));
if (!success) {
// Pre-20H1
success = (S_OK == DwmSetWindowAttribute(curHandle, attributeDarkModeFallback, (LPCVOID)&darkMode, (DWORD)sizeof(darkMode)));
}
if (success && !instant) {
forceRedraw();
}
}
');
if (success && instant)
{
final curBarColor:Null<FlxColor> = windowBarColor;
windowBarColor = 0x00000000;
windowBarColor = curBarColor;
}
#else
// Do nothing.
#end
}
/**
* The color of the window title bar. If `null`, the system default is used (`0xffffffff`).
*
* Only works on Windows 21H2 and later.
*/
public static var windowBarColor(default, set):Null<FlxColor> = null;
public static function set_windowBarColor(value:Null<FlxColor>):Null<FlxColor>
{
#if (cpp && windows)
final intColor:Int = value != null && Std.isOfType(value, Int) ? cast FlxColor.fromRGB(value.blue, value.green, value.red, value.alpha) : 0xffffffff;
untyped __cpp__('
getHandle();
if (curHandle != (HWND)0) {
const COLORREF targetColor = (COLORREF)intColor;
if (S_OK == DwmSetWindowAttribute(curHandle, attributeCaptionColor, (LPCVOID)&targetColor, (DWORD)sizeof(targetColor))) {
forceRedraw();
}
}
');
#else
// Do nothing.
#end
return windowBarColor = value;
}
/**
* The color of the window title bar text. If `null`, the system default is used (`0xffffffff`).
*
* Only works on Windows 21H2 and later.
*/
public static var windowTextColor(default, set):Null<FlxColor> = null;
public static function set_windowTextColor(value:Null<FlxColor>):Null<FlxColor>
{
#if (cpp && windows)
final intColor:Int = value != null && Std.isOfType(value, Int) ? cast FlxColor.fromRGB(value.blue, value.green, value.red, value.alpha) : 0xffffffff;
untyped __cpp__('
getHandle();
if (curHandle != (HWND)0) {
const COLORREF targetColor = (COLORREF)intColor;
if (S_OK == DwmSetWindowAttribute(curHandle, attributeTextColor, (LPCVOID)&targetColor, (DWORD)sizeof(targetColor))) {
forceRedraw();
}
}
');
#else
// Do nothing.
#end
return windowTextColor = value;
}
/**
* The color of the window border. If `null`, the system default is used (`0xffffffff`).
* Setting to `0xfffeffff` will disable the border entirely (use a color with alpha 0 to re-enable it).
*
* Only works on Windows 21H2 and later.
*/
public static var windowBorderColor(default, set):Null<FlxColor> = null;
public static function set_windowBorderColor(value:Null<FlxColor>):Null<FlxColor>
{
#if (cpp && windows)
final intColor:Int = value != null && Std.isOfType(value, Int) ? cast FlxColor.fromRGB(value.blue, value.green, value.red, value.alpha) : 0xffffffff;
untyped __cpp__('
getHandle();
if (curHandle != (HWND)0) {
const COLORREF targetColor = (COLORREF)intColor;
if (S_OK == DwmSetWindowAttribute(curHandle, attributeBorderColor, (LPCVOID)&targetColor, (DWORD)sizeof(targetColor))) {
forceRedraw();
}
}
');
#else
// Do nothing.
#end
return windowBorderColor = value;
}
}