Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/larsiusprime/SteamWrap
Haxe native extension for the Steam API
https://github.com/larsiusprime/SteamWrap
Last synced: about 1 month ago
JSON representation
Haxe native extension for the Steam API
- Host: GitHub
- URL: https://github.com/larsiusprime/SteamWrap
- Owner: larsiusprime
- License: mit
- Created: 2016-02-06T02:35:15.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-09-20T00:46:31.000Z (about 1 year ago)
- Last Synced: 2024-08-02T07:24:47.222Z (4 months ago)
- Language: Haxe
- Homepage:
- Size: 3.3 MB
- Stars: 106
- Watchers: 15
- Forks: 43
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-game-engine-dev - SteamWrap - Haxe native extension for the Steam API. (Libraries / Haxe)
README
SteamWrap
---------
Simple Haxe native extension Steam API wrapper. This code originally shipped in [Papers, Please](http://papersplea.se) and the changes in this fork were made for the PC release of [rymdkapsel](http://rymdkapsel.com). Windows, OS X and Linux/SteamOS builds are supported.#### Current Features:
- Achievements & Leaderboards
- Steam Controller Support
- UGC (user generated content)
- Stats (not well-tested)~~This repository comes with prebuilt binaries, which means it should work "out of the box".~~
(I'm in the process of updating the binaries, right now all it has is Windows)
#### Dependencies / Requirements:
- Haxe 3.2 or greater
- hxcpp 3.2.205 or greater
- OpenFL 3.6 or greater
- lime 2.8.3 or greaterProbably works with NME as well but I'm unsure of the requirements there. Ask Hugh.
#### To include steamwrap.ndll in your OpenFL or NME project:
1. Install the library:
latest git version:
```haxelib git steamwrap https://github.com/larsiusprime/SteamWrap```
2. Add the following nodes to your project.xml (assumes OpenFL or NME for now):
```
```
3. If you are doing non-Steam builds as well, it is practical to wrap this in a conditional. Run your builds as: `openfl test -Dsteam` to enable it, for example: `openfl test windows -Dsteam`.
```
```**!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!**
**This extension will automatically create a steam_appid.txt in your binary folder.**
**Do not ship your game with this file. Make sure it's stripped during the publishing stage.**
**Compiling with the "-Dfinal" flag should suppress creation of the steam_appid.txt**
```openfl test windows -Dsteam -Dfinal``` (for instance)
**!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!**4. Platform specific notes:
**Linux**
- Make sure libsteam_api.so is sitting next to steamwrap.ndll
- You will need a launch script to ensure libraries are loaded from the righ location. An example (Test.sh) is provided in the example folder
- When you release your game on Steam, set this launch script as your executable, NOT the raw linux binary itself#### Usage:
See steamwrap/example/Test.hx for a basic example.
#### To build steamwrap.ndll from source:
**Automatic steps**
1. Run setup.bat (windows) or setup.sh (mac/linux) and enter the values it asks you for
Or you can set it up manually:
------------
**Manual steps:**
1. Copy the hxcpp headers:
HAXE_DIR/lib/hxcpp/VERSION/include/hx/*.h -> STEAMWRAP_DIR/native/include/hx/*.h2. Copy the Steam SDK headers and libs:
STEAMSDK_DIR/public/steam/*.h -> native/include/steam/*.h
STEAMSDK_DIR/redistributable_bin/steam_api.dll -> native/lib/win32/
STEAMSDK_DIR/redistributable_bin/steam_api.lib -> native/lib/win32/
STEAMSDK_DIR/redistributable_bin/win64/steam_api64.dll -> native/lib/win64/
STEAMSDK_DIR/redistributable_bin/win64/steam_api64.lib -> native/lib/win64/
STEAMSDK_DIR/redistributable_bin/osx32/libsteam_api.dylib -> native/lib/osx64/
STEAMSDK_DIR/redistributable_bin/linux32/libsteam_api.so -> native/lib/linux32/
STEAMSDK_DIR/redistributable_bin/linux64/libsteam_api.so -> native/lib/linux64/3. Put some files in the build dir:
Windows:
```
ndll/Windows/steam_appid.txt
STEAMSDK_DIR/redistributable_bin/steam_api.dll -> ndll/Windows/ndll/Windows64/steam_appid.txt
STEAMSDK_DIR/redistributable_bin/steam_api64.dll -> ndll/Windows64/
```Mac:
```
ndll/Mac64/steam_appid.txt
STEAMSDK_DIR/redistributable_bin/steam_api.lib -> ndll/Mac64/
```Linux:
```
ndll/Linux/steam_appid.txt
STEAMSDK_DIR/redistributable_bin/steam_api.so -> ndll/Linux/
ndll/Linux64/steam_appid.txt
STEAMSDK_DIR/redistributable_bin/steam_api.so -> ndll/Linux64/
```**WHAT THIS DOES:**
The steam_api dll/dylib/so file must be next to your platform's steamwrap.ndll file in order for the extension to work. The dll/dylib/so file has all of the actual Steam API functionality, and the ndll file allows your Haxe project to communicate with it.
As for the `steam_appid.txt` file, it's only there to make the "Test" program work. That's because the "Test" program will appear in your platform's ndll/ folder when you use the "build.bat" or "build" script to compile it.
In order for your test program to work it must be able to find:
- steamwrap.ndll (so Haxe can talk to Steam)
- steam_api.dll/dylib/so (to provide the Steam API)
- steam_appid.txt (to make the Steam Client recognize your app as a particular Steam Game when testing)
------------**Final Steps:**
1. Run the "build" script (it's a basic haxelib command shortcut).
steamwrap.ndll will be output to ndll/[PLATFORM]Note: For linux you should have `g++-multilib` installed.
That's great, but we want to make sure it works! Let's run something with it. If you run the Test program now, you'll notice it exits immediately, asking you to supply an app ID.2. Edit steamwrap/example/Test.hx to include your Steam App ID and achievement ID's, etc.
Now you are ready to compile example/Test.hx. Run the build script again.
3. Start the Steam client, leave it open in the background, and run the Test app to make sure it connects.
Note: If you're running on Linux, you should run the "Test.sh" launcher script, not the "Test" binary directory