diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0abb5bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*/.vscode/ \ No newline at end of file diff --git a/README.md b/README.md index 0f7065a..54a21f6 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,12 @@ This is a haxelib for modifying the main window in HaxeFlixel! I am gonna be working to add popups and whatnot, but for now you have the basics! ## Credits: -* [DuskieWhy] (https://twitter.com/DuskieWhy) -* [TaeYai] (https://twitter.com/TaeYai) -* [BreezyMelee] (https://twitter.com/BreezyMelee) -* [YoshiCrafter] (https://twitter.com/YoshiCrafter29) - Additional help -* [KadeDev] (https://twitter.com/kade0912) - Transparent window .hx file code +* [DuskieWhy](https://twitter.com/DuskieWhy) +* [TaeYai](https://twitter.com/TaeYai) +* [BreezyMelee](https://twitter.com/BreezyMelee) +* [YoshiCrafter29](https://twitter.com/YoshiCrafter29) - Additional help +* [KadeDev](https://twitter.com/kade0912) - Transparent window .hx file code +* [sayofthelor](https://twitter.com/sayofthelor) - Additional code cleanup # Set-up First, git the haxelib by pasting this command into the cmd or powershell. diff --git a/haxelib.json b/haxelib.json index 1713e85..d66e91e 100644 --- a/haxelib.json +++ b/haxelib.json @@ -2,8 +2,13 @@ "name": "window_mod_flx", "url": "https://github.com/DuskieWhy/window_mod_flx", "license": "MIT", - "version": "0.0.0", - "description": "Modifiers for windows in HaxeFlixel!", - "releasenote": "", - "contributors": ["DuskieWhy", "TaeYai", "BreezyMelee", "KadeDev", "YoshiCrafter"] -} \ No newline at end of file + "version": "1.0.0", + "description": "Modifiers for windows in HaxeFlixel", + "releasenote": "Initial release", + "dependencies": { + "flixel":"", + "openfl":"", + "lime":"" + }, + "contributors": ["DuskieWhy", "TaeYai", "BreezyMelee", "KadeDev", "YoshiCrafter29", "sayofthelor"] +} diff --git a/shut up vs code.hxml b/shut up vs code.hxml new file mode 100644 index 0000000..0095a10 --- /dev/null +++ b/shut up vs code.hxml @@ -0,0 +1,3 @@ +-lib openfl +-lib flixel +-lib lime \ No newline at end of file diff --git a/transparencyTest/.gitignore b/transparencyTest/.gitignore new file mode 100644 index 0000000..1fe2d30 --- /dev/null +++ b/transparencyTest/.gitignore @@ -0,0 +1 @@ +export/ \ No newline at end of file diff --git a/transparencyTest/Project.xml b/transparencyTest/Project.xml new file mode 100644 index 0000000..f60baf7 --- /dev/null +++ b/transparencyTest/Project.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/transparencyTest/hxformat.json b/transparencyTest/hxformat.json new file mode 100644 index 0000000..66cb386 --- /dev/null +++ b/transparencyTest/hxformat.json @@ -0,0 +1,15 @@ +{ + "lineEnds": { + "leftCurly": "both", + "rightCurly": "both", + "objectLiteralCurly": { + "leftCurly": "after" + } + }, + "sameLine": { + "ifElse": "next", + "doWhile": "next", + "tryBody": "next", + "tryCatch": "next" + } +} diff --git a/transparencyTest/source/Main.hx b/transparencyTest/source/Main.hx new file mode 100644 index 0000000..efa0e2d --- /dev/null +++ b/transparencyTest/source/Main.hx @@ -0,0 +1,13 @@ +package; + +import flixel.FlxGame; +import openfl.display.Sprite; + +class Main extends Sprite +{ + public function new() + { + super(); + addChild(new FlxGame(0, 0, PlayState)); + } +} diff --git a/transparencyTest/source/PlayState.hx b/transparencyTest/source/PlayState.hx new file mode 100644 index 0000000..7e59dd4 --- /dev/null +++ b/transparencyTest/source/PlayState.hx @@ -0,0 +1,26 @@ +package; + +import flixel.FlxState; +import flixel.FlxSprite; +import window.windowMod.FlxWindowModifier; +import flixel.FlxG; +import flixel.text.FlxText; + +class PlayState extends FlxState +{ + override public function create() + { + FlxG.mouse.visible = false; + add(new FlxSprite().makeGraphic(FlxG.width, FlxG.height, 0xff010101)); + var t = new FlxText(100, 100, 0, "Transparency!"); + add(t); + t.setFormat(null, 24, 0xffffffff, "left"); + FlxWindowModifier.getWinTrans(); + super.create(); + } + + override public function update(elapsed:Float) + { + super.update(elapsed); + } +} diff --git a/window/windowMod/FlxWindowModifier.hx b/window/windowMod/FlxWindowModifier.hx index 4793ab0..6d7ad6e 100644 --- a/window/windowMod/FlxWindowModifier.hx +++ b/window/windowMod/FlxWindowModifier.hx @@ -6,24 +6,10 @@ import flixel.FlxSprite; import flixel.util.FlxColor; import lime.ui.WindowAttributes; import lime.app.Application; -import lime.graphics.RenderContext; -import lime.ui.MouseButton; -import lime.ui.KeyCode; -import lime.ui.KeyModifier; import lime.ui.Window; import openfl.geom.Matrix; -import openfl.geom.Rectangle; import openfl.display.Sprite; -import openfl.display.BitmapData; -import openfl.utils.Assets; -import flixel.FlxG; -import openfl.system.System; -import flixel.graphics.FlxGraphic; -import openfl.utils.AssetType; -import openfl.utils.Assets as OpenFlAssets; -import lime.utils.Assets; -import sys.io.File; -import sys.FileSystem; + import window.windowMod.WindowPaths; class FlxWindowModifier @@ -32,7 +18,7 @@ class FlxWindowModifier public static var popupwindow:Window; public static var windowSprite:Sprite; - public static function changeWinPos(X:Int, Y:Int, type:String) + public static function changeWinPos(X:Int, Y:Int, type:String):Void { //basically, run this function of changeWinPos() with the desired change in X and Y to the main window switch(type){ @@ -45,21 +31,21 @@ class FlxWindowModifier } } - public static function setWinPos(X:Int, Y:Int) + public static function setWinPos(X:Int, Y:Int):Void { //Run this function of setWinPos() to SET the window position, not add to it Application.current.window.x = X; Application.current.window.y = Y; } - public static function changeWinDimension(Width:Int, Height:Int) + public static function changeWinDimension(Width:Int, Height:Int):Void { //Run the function of changeWinDimension() to set the width and height of the window! Application.current.window.width = Width; Application.current.window.height = Height; } - public static function popUpWindow(attributes:WindowAttributes, color:FlxColor, X:Int, Y:Int, spritePath:String) + public static function popUpWindow(attributes:WindowAttributes, color:FlxColor, X:Int, Y:Int, spritePath:String):Void { popupwindow = Lib.application.createWindow(attributes); popupwindow.stage.color = color; @@ -76,7 +62,7 @@ class FlxWindowModifier popupwindow.stage.addChild(spr); } - public static function getWinTrans() + public static function getWinTrans():Void { /** * The function is defined in the `TransparencyFunc` class below @@ -103,10 +89,7 @@ class TransparencyFunc SetLayeredWindowAttributes(hWnd, RGB(1, 1, 1), 0, LWA_COLORKEY); } ') - public static function getWindowsTransparent(res:Int = 0) - { - return res; - } + public static function getWindowsTransparent(res:Int = 0):Void {} @:functionCode(' HWND hWnd = GetActiveWindow(); @@ -116,8 +99,9 @@ class TransparencyFunc SetLayeredWindowAttributes(hWnd, RGB(1, 1, 1), 1, LWA_COLORKEY); } ') - public static function getWindowsbackward(res:Int = 0) - { - return res; - } + public static function getWindowsBackward(res:Int = 0):Void {} + + @:deprecated("getWindowsbackward is deprecated. Use getWindowsBackward instead.") + public static function getWindowsbackward(res:Int = 0):Void {getWindowsBackward(res);} + } \ No newline at end of file