Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/.vscode/
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 10 additions & 5 deletions haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
"version": "1.0.0",
"description": "Modifiers for windows in HaxeFlixel",
"releasenote": "Initial release",
"dependencies": {
"flixel":"",
"openfl":"",
"lime":""
},
"contributors": ["DuskieWhy", "TaeYai", "BreezyMelee", "KadeDev", "YoshiCrafter29", "sayofthelor"]
}
3 changes: 3 additions & 0 deletions shut up vs code.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-lib openfl
-lib flixel
-lib lime
1 change: 1 addition & 0 deletions transparencyTest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export/
86 changes: 86 additions & 0 deletions transparencyTest/Project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://lime.software/project/1.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://lime.software/project/1.0.2 http://lime.software/xsd/project-1.0.2.xsd">

<!-- _________________________ Application Settings _________________________ -->

<app title="testProject" file="testProject" main="Main" version="0.0.1" company="HaxeFlixel" />

<!--The flixel preloader is not accurate in Chrome. You can use it regularly if you embed the swf into a html file
or you can set the actual size of your file manually at "FlxPreloaderBase-onUpdate-bytesTotal"-->
<app preloader="flixel.system.FlxPreloader" />

<!--Minimum without FLX_NO_GAMEPAD: 11.8, without FLX_NO_NATIVE_CURSOR: 11.2-->
<set name="SWF_VERSION" value="11.8" />

<!-- ____________________________ Window Settings ___________________________ -->

<!--These window settings apply to all targets-->
<window width="640" height="480" fps="60" background="#000000" hardware="true" vsync="false" />

<!--HTML5-specific-->
<window if="html5" resizable="false" />

<!--Desktop-specific-->
<window if="desktop" orientation="landscape" fullscreen="false" resizable="true" />

<!--Mobile-specific-->
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" />

<!-- _____________________________ Path Settings ____________________________ -->

<set name="BUILD_DIR" value="export" />
<source path="source" />
<assets path="assets" />

<!-- _______________________________ Libraries ______________________________ -->

<haxelib name="flixel" />

<haxelib name="window_mod_flx" />

<!--In case you want to use the addons package-->
<!--<haxelib name="flixel-addons" />-->

<!--In case you want to use the ui package-->
<!--<haxelib name="flixel-ui" />-->

<!--In case you want to use nape with flixel-->
<!--<haxelib name="nape-haxe4" />-->

<!-- ______________________________ Haxedefines _____________________________ -->

<!--Enable the Flixel core recording system-->
<!--<haxedef name="FLX_RECORD" />-->

<!--Disable the right and middle mouse buttons-->
<!--<haxedef name="FLX_NO_MOUSE_ADVANCED" />-->

<!--Disable the native cursor API on Flash-->
<!--<haxedef name="FLX_NO_NATIVE_CURSOR" />-->

<!--Optimise inputs, be careful you will get null errors if you don't use conditionals in your game-->
<haxedef name="FLX_NO_MOUSE" if="mobile" />
<haxedef name="FLX_NO_KEYBOARD" if="mobile" />
<haxedef name="FLX_NO_TOUCH" if="desktop" />
<!--<haxedef name="FLX_NO_GAMEPAD" />-->

<!--Disable the Flixel core sound tray-->
<!--<haxedef name="FLX_NO_SOUND_TRAY" />-->

<!--Disable the Flixel sound management code-->
<!--<haxedef name="FLX_NO_SOUND_SYSTEM" />-->

<!--Disable the Flixel core focus lost screen-->
<!--<haxedef name="FLX_NO_FOCUS_LOST_SCREEN" />-->

<!--Disable the Flixel core debugger. Automatically gets set whenever you compile in release mode!-->
<haxedef name="FLX_NO_DEBUG" unless="debug" />

<!--Enable this for Nape release builds for a serious peformance improvement-->
<haxedef name="NAPE_RELEASE_BUILD" unless="debug" />

<!-- _________________________________ Custom _______________________________ -->

<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
</project>
15 changes: 15 additions & 0 deletions transparencyTest/hxformat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"lineEnds": {
"leftCurly": "both",
"rightCurly": "both",
"objectLiteralCurly": {
"leftCurly": "after"
}
},
"sameLine": {
"ifElse": "next",
"doWhile": "next",
"tryBody": "next",
"tryCatch": "next"
}
}
13 changes: 13 additions & 0 deletions transparencyTest/source/Main.hx
Original file line number Diff line number Diff line change
@@ -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));
}
}
26 changes: 26 additions & 0 deletions transparencyTest/source/PlayState.hx
Original file line number Diff line number Diff line change
@@ -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);
}
}
40 changes: 12 additions & 28 deletions window/windowMod/FlxWindowModifier.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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){
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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();
Expand All @@ -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);}

}