mobile bullshit cookin in progress???

This commit is contained in:
Cameron Taylor 2021-02-16 01:53:25 -05:00
parent f1d2fad105
commit 708741bda8
2 changed files with 65 additions and 7 deletions

View File

@ -2,7 +2,7 @@
<project>
<!-- _________________________ Application Settings _________________________ -->
<app title="Friday Night Funkin'" file="Funkin" packageName="com.ninjamuffin99.funkin" main="Main" version="0.2.7.1" company="ninjamuffin99" />
<app title="Friday Night Funkin'" file="Funkin" packageName="com.ninjamuffin99.funkin" package="com.ninjamuffin99.funkin" main="Main" version="0.2.7.1" company="ninjamuffin99" />
<!--Switch Export with Unique ApplicationID and Icon-->
<set name="APP_ID" value="0x0100f6c013bbc000" />
@ -27,7 +27,7 @@
<window if="desktop" orientation="landscape" fullscreen="false" resizable="true" vsync="false"/>
<!--Mobile-specific-->
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" />
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" resizable="false"/>
<!--Switch-specific-->
<window if="switch" orientation="landscape" fullscreen="true" width="0" height="0" resizable="true" />
@ -94,9 +94,9 @@
<!--<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_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-->
@ -121,7 +121,7 @@
<icon path="art/icon16.png" size='16'/>
<icon path="art/icon32.png" size='32'/>
<icon path="art/icon64.png" size='64'/>
<icon path="art/iconOG.png" size='256'/>
<icon path="art/iconOG.png" />
<!-- <haxedef name="SKIP_TO_PLAYSTATE" if="debug" /> -->

View File

@ -1,15 +1,73 @@
package;
import flixel.FlxGame;
import flixel.FlxState;
import openfl.Assets;
import openfl.Lib;
import openfl.display.FPS;
import openfl.display.Sprite;
import openfl.events.Event;
class Main extends Sprite
{
var gameWidth:Int = 1280; // Width of the game in pixels (might be less / more in actual pixels depending on your zoom).
var gameHeight:Int = 720; // Height of the game in pixels (might be less / more in actual pixels depending on your zoom).
var initialState:Class<FlxState> = TitleState; // The FlxState the game starts with.
var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions.
var framerate:Int = 60; // How many frames per second the game should run at.
var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode.
var startFullscreen:Bool = false; // Whether to start the game in fullscreen on desktop targets
// You can pretty much ignore everything from here on - your code should go in your states.
public static function main():Void
{
Lib.current.addChild(new Main());
}
public function new()
{
super();
addChild(new FlxGame(0, 0, TitleState));
if (stage != null)
{
init();
}
else
{
addEventListener(Event.ADDED_TO_STAGE, init);
}
}
private function init(?E:Event):Void
{
if (hasEventListener(Event.ADDED_TO_STAGE))
{
removeEventListener(Event.ADDED_TO_STAGE, init);
}
setupGame();
}
private function setupGame():Void
{
var stageWidth:Int = Lib.current.stage.stageWidth;
var stageHeight:Int = Lib.current.stage.stageHeight;
if (zoom == -1)
{
var ratioX:Float = stageWidth / gameWidth;
var ratioY:Float = stageHeight / gameHeight;
zoom = Math.min(ratioX, ratioY);
gameWidth = Math.ceil(stageWidth / zoom);
gameHeight = Math.ceil(stageHeight / zoom);
}
#if !debug
initialState = TitleState;
#end
addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen));
#if !mobile
addChild(new FPS(10, 3, 0xFFFFFF));