MCPcopy Create free account
hub / github.com/PlayFab/gsdk / main

Function main

cpp/testapps/cppLinuxTestApp/main.cpp:50–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50int main()
51{
52 printf("Starting!\n");
53 try
54 {
55 // Super hacky short-term functionality PlayFab Test - TODO: Put the regular set of tests into proper Unit Test project
56 printf("========== Starting PlayFab Login API call.\n");
57 PlayFab::PlayFabSettings::titleId = "6195";
58 PlayFab::PlayFabSettings::threadedCallbacks = true;
59 PlayFab::ClientModels::LoginWithCustomIDRequest request;
60 request.CustomId = "test_GSDK";
61 request.CreateAccount = true;
62 PlayFab::PlayFabClientAPI::LoginWithCustomID(request, OnLoginSuccess, OnPlayFabFail);
63
64 Microsoft::Azure::Gaming::GSDK::start();
65 Microsoft::Azure::Gaming::GSDK::registerShutdownCallback(&inShutdown);
66 Microsoft::Azure::Gaming::GSDK::registerHealthCallback(&isHealthy);
67 Microsoft::Azure::Gaming::GSDK::registerMaintenanceCallback(&maintenanceScheduled);
68
69 // Test grabbing config
70 printf(" Config before Active.\n");
71 for (auto config : Microsoft::Azure::Gaming::GSDK::getConfigSettings())
72 {
73 printf("%s: %s\n", config.first.c_str(), config.second.c_str());
74 }
75
76 printf("\tStanding by!\n");
77 if (Microsoft::Azure::Gaming::GSDK::readyForPlayers())
78 {
79 printf("Game on!\n");
80
81 std::vector<Microsoft::Azure::Gaming::ConnectedPlayer> players;
82 players.push_back(Microsoft::Azure::Gaming::ConnectedPlayer("player1"));
83 players.push_back(Microsoft::Azure::Gaming::ConnectedPlayer("player2"));
84 Microsoft::Azure::Gaming::GSDK::updateConnectedPlayers(players);
85
86 printf(" Config after Active.\n");
87 for (auto config : Microsoft::Azure::Gaming::GSDK::getConfigSettings())
88 {
89 printf("%s: %s\n", config.first.c_str(), config.second.c_str());
90 }
91
92 printf("Logs directory is: %s\n", Microsoft::Azure::Gaming::GSDK::getLogsDirectory().c_str());
93 }
94 else
95 {
96 printf("Not allocated. Server is being shut down.\n");
97 }
98 }
99 catch (const std::exception &ex)
100 {
101 printf("Problem initializing GSDK: %s\n", ex.what());
102 }
103
104 printf("Press enter to exit the program.\n");
105 getchar();
106
107 return 0;

Callers

nothing calls this directly

Calls 2

whatMethod · 0.80
ConnectedPlayerClass · 0.50

Tested by

no test coverage detected