Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Steamworks.h"
- #undef max
- #undef min
- #include <iostream>
- #include <string>
- #include <limits>
- #pragma comment( lib, "../steam" )
- int main()
- {
- using namespace std;
- TSteamError err;
- std::cout << "Press any key to start steam engine.\n";
- getchar();
- if ( !SteamStartEngine( &err ) )
- {
- cout << "Error: " << err.szDesc << "\n";
- getchar();
- return EXIT_FAILURE;
- }
- std::cout << "Press any key to startup.\n";
- getchar();
- if ( !SteamStartup( STEAM_USING_ALL, &err ) )
- {
- cout << "Error: " << err.szDesc << "\n";
- getchar();
- return EXIT_FAILURE;
- }
- string userName;
- string password;
- cout << "Username: ";
- cin >> userName;
- cout << "Password: ";
- cin >> password;
- cin.ignore( numeric_limits<streamsize>::max(), '\n' );
- cin.clear();
- cout << "Press any key to create login call handle.\n";
- getchar();
- SteamCallHandle_t loginCall = SteamLogin( userName.c_str(), password.c_str(), 1, &err );
- if ( loginCall == STEAM_INVALID_CALL_HANDLE )
- {
- cout << "Invalid call handle.\n";
- getchar();
- return EXIT_FAILURE;
- }
- cout << "Press any key to process login.\n";
- getchar();
- TSteamProgress prog;
- while ( SteamProcessCall( loginCall, &prog, &err ) == 0 )
- {
- // cout << "Press any key to continue login.\n";
- // getchar();
- }
- if ( err.eSteamError != eSteamErrorNone )
- {
- cout << "Error logging in: " << err.szDesc << "\n";
- getchar();
- return EXIT_FAILURE;
- }
- cout << "Login completed.\n";
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement