Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Adding Steam API to Linux Template 64bit Tier 2

Author
Message
Parry
AGK Developer
14
Years of Service
User Offline
Joined: 16th Dec 2009
Location: Swampstone
Posted: 27th Jul 2018 21:57 Edited at: 27th Jul 2018 22:05
So I took another stab at adding Steam to the Linux Template and was successful this time.

If you haven't already install AGK2 on Linux check out this post first: https://forum.thegamecreators.com/thread/218161

Instructions for adding Steam to AGK2 Linux Template (Only tested on 64 bit system):

1> Boot into Linux and make sure Steam is running and you are logged into the account where you paid your Product Submission Fee.

2> Download the steam sdk and extract it into your template folder. It should add a folder called "sdk".

3> Edit MakeFile

Change:

INC = -I../../common/include -I../../common -I../interpreter -I../../bullet -I../../bullet/BulletCollision/CollisionShapes

To:

INC = -I./sdk/public/steam -I../../common/include -I../../common -I../interpreter -I../../bullet -I../../bullet/BulletCollision/CollisionShapes

Change:

# link the .o files
Executable: | $(OBJS)
$(CC) $(OBJS) -o build/LinuxApp$(ARCH) $(LDFLAGS) -Wl,-Bstatic -lAGKLinux -lglfw3 -Wl,-Bdynamic -lGL -lXt -lX11 -lXxf86vm -lXrandr -lpthread -lXi -lXinerama -lXcursor -lcurl -lopenal -ludev -ldl

To:

# link the .o files
Executable: | $(OBJS)
$(CC) $(OBJS) -L. -v -o build/LinuxApp$(ARCH) $(LDFLAGS) -Wl,-Bstatic -lAGKLinux -lglfw3 -Wl,-Bdynamic -lGL -lXt -lX11 -lXxf86vm -lXrandr -lpthread -lXi -lXinerama -lXcursor -lcurl -lopenal -ludev -ldl -lsteam_api

4>Create a new directory in the template directory named build.

5>Add "libsteam_api.so" in the template directory and template/build directory. It is located in "sdk\redistributable_bin\linux64"

6>Create a text file called "steam_appid.txt" and type your app id number. Save this file and place it also in: template/build

7> Create a text file called "LinuxApp64.sh" in the template/build and add the following text:

#!/bin/bash
#
# This is a script which runs the SteamworksExample in the Steam runtime

# The program location
TOP=$(cd "${0%/*}" && echo ${PWD})

PROGRAM="${TOP}/LinuxApp64"

# Steam sets this environment variable when launching games
if [ "$STEAM_RUNTIME" = "" ]; then
export STEAM_RUNTIME="${TOP}/../../tools/linux/runtime/i386"
export LD_LIBRARY_PATH="${STEAM_RUNTIME}/lib/i386-linux-gnu:${STEAM_RUNTIME}/lib:${STEAM_RUNTIME}/usr/lib/i386-linux-gnu:${STEAM_RUNTIME}/usr/lib:${LD_LIBRARY_PATH}"
fi

# Add the current directory to the library path to pick up libsteam_api.so
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:."

exec "${PROGRAM}" "$@"

# vi: ts=4 sw=4 expandtab

8> open a terminal window in template/build directory and make LinuxApp64.sh executable with this command:

chmod +x LinuxApp64.sh

9>Edit template.c to the following:

// Includes
#include "template.h"
#include "steam_api.h"
#include <string>

// Namespace
using namespace AGK;
using namespace std;

app App;

bool bResult = false;

void app::Begin(void)
{
agk::SetVirtualResolution (1024, 768);
agk::SetClearColor( 151,170,204 ); // light blue
agk::SetSyncRate(60,0);
agk::SetScissor(0,0,0,0);
bResult = SteamAPI_Init();
}

int app::Loop (void)
{
if (bResult)
{
agk:rint("Success...");

string sSteamName = SteamFriends()->GetPersonaName();
CSteamID steamId = SteamUser()->GetSteamID();
int iSteamID = steamId.GetAccountID();

agk:rint(sSteamName.c_str());
agk:rint(iSteamID);
}
else agk:rint("Failed...");

agk::Sync();
return 0; // return 1 to close app
}


void app::End (void)
{
SteamAPI_Shutdown();
}

10> Now this altered Linux Template is a Steam Linux Template. After compiling the executable you must use "./LinuxApp64.sh" to launch it. The steam overlay will not show up when you start the program. From what I have read, it will show up if launched from steam properly. So this isn't a bug. But I haven't yet tested this.

Good Luck!

Login to post a reply

Server time is: 2024-11-23 18:05:17
Your offset time is: 2024-11-23 18:05:17