TentaRJ / GameJolt-FNF-Integration

Add trophies, track player's play time and sessions, and connect to GameJolt with this project!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

????

machonessiebaby opened this issue · comments

image

Main.hx code let me know whats wrong pls

code:

package;

import GameJolt.GameJoltAPI;
import flixel.graphics.FlxGraphic;
import flixel.FlxG;
import flixel.FlxGame;
import flixel.FlxState;
import openfl.Assets;
import openfl.Lib;
import openfl.display.FPS;
import openfl.display.Sprite;
import openfl.events.Event;
import openfl.display.StageScaleMode;

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> = Cache; // 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
public static var fpsVar:FPS;
public static var gjToastManager:GJToastManager;

// 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();

	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();

gjToastManager = new GJToastManager();
addChild(gjToastManager);
}

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 = Cache;
	#end

	ClientPrefs.loadDefaultKeys();
	// fuck you, persistent caching stays ON during sex
	FlxGraphic.defaultPersist = true;
	// the reason for this is we're going to be handling our own cache smartly
	addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen));

	#if !mobile
	fpsVar = new FPS(10, 3, 0xFFFFFF);
	addChild(fpsVar);
	Lib.current.stage.align = "tl";
	Lib.current.stage.scaleMode = StageScaleMode.NO_SCALE;
	if(fpsVar != null) {
		fpsVar.visible = ClientPrefs.showFPS;
	}
	#end

	#if html5
	FlxG.autoPause = false;
	FlxG.mouse.visible = false;
	#end
}

}

nvm m dumb i think i forgot import GameJolt; ;-;