// PlaceLauncher.h #pragma once #include #include #include "LogManager.h" #include "Teleporter.h" #include "v8datamodel/Game.h" #include "v8tree/Instance.h" #include "util/standardout.h" #include "rbx/signal.h" enum JoinGameRequest { JOIN_GAME_REQUEST_PLACEID, JOIN_GAME_REQUEST_USERID, JOIN_GAME_REQUEST_PRIVATE_SERVER, JOIN_GAME_REQUEST_GAME_INSTANCE }; class Teleporter; class RobloxView; struct StartGameParams { int viewWidth; int viewHeight; void* view; int placeId; int userId; std::string accessCode; std::string gameId; std::string assetFolderPath; bool isTouchDevice; JoinGameRequest joinRequestType; }; class PlaceLauncher { RobloxView* rbxView; boost::scoped_ptr teleporter; bool isCurrentlyPlayingGame; bool isLeavingGame; int lastPlaceId; StartGameParams gameParams; // player join tracking rbx::signals::connection childConnection; rbx::signals::connection playerConnection; shared_ptr currentGame; PlaceLauncher(); PlaceLauncher(PlaceLauncher const&); void operator=(PlaceLauncher const&); shared_ptr setupGame( const StartGameParams& sgp ); shared_ptr setupPreloadedGame( const StartGameParams& sgp ); bool startGame( boost::function0 scriptFunction, shared_ptr preloadedGame); bool prepareGame(const StartGameParams& sgp); void deleteRobloxView( bool resetCurrentGame ); void finishGameSetup( boost::shared_ptr game); public: static PlaceLauncher& getPlaceLauncher(); RobloxView* getRbxView() { return rbxView; } bool startGame( const StartGameParams& sgp ); void leaveGame ( bool userRequestedLeave); void teleport( std::string ticket, std::string authUrl, std::string script); static void handleStartGameFailure(int status); weak_ptr getCurrentGame() { return currentGame; } void shutDownGraphics(); void startUpGraphics(void *wnd, unsigned int width, unsigned int height); };