1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-30 08:27:38 +00:00

middle click drag

This commit is contained in:
Cameron Taylor 2021-05-16 19:17:58 -04:00
parent bd6936734a
commit 30a6db615b
4 changed files with 68 additions and 24 deletions

View file

@ -124,13 +124,13 @@
<!--haxelib name="newgrounds" unless="switch"/> -->
<haxelib name="faxe" if='switch'/>
<haxelib name="polymod"/>
<haxelib name="newgrounds"/>
<!-- <haxelib name="newgrounds"/> -->
<haxelib name="hxcpp-debug-server" if="desktop debug"/>
<!-- swf stufffff -->
<haxelib name="swf"/>
<library path="assets/tanky.swf" preload="true"/>
<library path="assets/tankBG.swf" preload="true"/>
<!-- <haxelib name="swf"/> -->
<!-- <library path="assets/tanky.swf" preload="true"/> -->
<!-- <library path="assets/tankBG.swf" preload="true"/> -->
<!-- <haxelib name="flixel-animate" /> -->
<!-- <haxelib name="spinehaxe" /> -->

View file

@ -34,6 +34,7 @@ import shaderslmfao.BuildingShaders.BuildingShader;
import shaderslmfao.BuildingShaders;
import shaderslmfao.ColorSwap;
import ui.PreferencesMenu;
import ui.stageBuildShit.StageBuilderState;
using StringTools;
@ -152,6 +153,8 @@ class TitleState extends MusicBeatState
*/
// netConnection.addEventListener(MouseEvent.MOUSE_DOWN, overlay_onMouseDown);
#elseif STAGEBUILD
FlxG.switchState(new StageBuilderState());
#else
new FlxTimer().start(1, function(tmr:FlxTimer)
{

View file

@ -1,20 +0,0 @@
package ui;
import flixel.FlxSprite;
import flixel.addons.display.FlxGridOverlay;
class StageBuilderState extends MusicBeatState
{
public function new()
{
super();
}
override function create()
{
super.create();
var bg:FlxSprite = FlxGridOverlay.create(10, 10);
add(bg);
}
}

View file

@ -0,0 +1,61 @@
package ui.stageBuildShit;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.display.FlxGridOverlay;
import flixel.group.FlxGroup;
import flixel.math.FlxPoint;
import flixel.ui.FlxButton;
class StageBuilderState extends MusicBeatState
{
private var hudGrp:FlxGroup;
private var sprGrp:FlxGroup;
override function create()
{
super.create();
FlxG.mouse.visible = true;
var bg:FlxSprite = FlxGridOverlay.create(10, 10);
add(bg);
sprGrp = new FlxGroup();
add(sprGrp);
hudGrp = new FlxGroup();
add(hudGrp);
var imgBtn:FlxButton = new FlxButton(20, 20, "Load Image", loadImage);
hudGrp.add(imgBtn);
}
function loadImage():Void
{
var img:FlxSprite = new FlxSprite().loadGraphic(Paths.image('newgrounds_logo'));
img.scrollFactor.set(0.5, 2);
sprGrp.add(img);
}
var oldCamPos:FlxPoint = new FlxPoint();
var oldMousePos:FlxPoint = new FlxPoint();
override function update(elapsed:Float)
{
if (FlxG.mouse.justPressedMiddle)
{
oldCamPos.set(FlxG.camera.scroll.x, FlxG.camera.scroll.y);
oldMousePos.set(FlxG.mouse.screenX, FlxG.mouse.screenY);
}
if (FlxG.mouse.pressedMiddle)
{
FlxG.camera.scroll.x = oldCamPos.x + (FlxG.mouse.screenX - oldMousePos.x);
FlxG.camera.scroll.y = oldCamPos.y + (FlxG.mouse.screenY - oldMousePos.y);
}
super.update(elapsed);
}
}