Skip to content

Commit

Permalink
made Test more user friendly, tweak build scripts, add "final" guard …
Browse files Browse the repository at this point in the history
…to include.xml
  • Loading branch information
larsiusprime committed Feb 11, 2016
1 parent 2a5cb90 commit 59881f9
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 57 deletions.
9 changes: 5 additions & 4 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ fi

#exit 0

# build test exe
# cd ..
# cd steamwrap
# haxe -cp .. Test.hx -main Test -cpp ../temp/hx/
# build the example program "Test"

cd ..
cd example
haxe -cp .. Test.hx -main Test -cpp ../temp/hx/
12 changes: 6 additions & 6 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
:: build the native ndll

cd native

haxelib run hxcpp Build.xml

cd ..

copy native\lib\win32\*.dll ndll\Windows

:: build the Text.exe
:: (uncomment the lines below to build the Test program after you've set it up properly)
:: build the example program "Test.exe"

::cd example
::haxe -cp .. Test.hx -main Test -cpp ..\temp\hx
::cd ..
cd example
haxe -cp .. Test.hx -main Test -cpp ..\temp\hx
cd ..

::copy temp\hx\Test.exe ndll\Windows
copy temp\hx\Test.exe ndll\Windows

107 changes: 64 additions & 43 deletions example/Test.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,38 @@ class Test
static function main()
{
trace("Start");

API.init(218410);

var appID:Int = -1; //PUT YOUR APP ID HERE!

if (appID == -1)
{
trace("You need to supply an app ID!");
Sys.exit(0);
}

API.init(appID);
API.whenAchievementStored = steamWrap_onAchievementStored;
API.whenLeaderboardScoreDownloaded = steamWrap_onLeaderboardScoreDownloaded;

var achs = ["AZRA_LVL_10", "AZRA_LVL_25", "AZRA_LVL_40"];

for (ach in achs) API.clearAchievement(ach);
for (ach in achs) API.setAchievement(ach);
var achs = []; //PUT SOME ACHIEVEMENTS HERE: ["BEAT_LEVEL_1","BEAT_LEVEL_2"], etc.

/*
var leaderBoardIds = ["YOUR", "LEADERBOARD", "IDS", "GO", "HERE"];
API.registerLeaderboards(leaderboardIds);
for (leaderboardId in leaderboardIds)
if (achs != null && achs.length > 0)
{
API.downloadLeaderboardScore(leaderboardId); (o
for (ach in achs) API.clearAchievement(ach);
for (ach in achs) API.setAchievement(ach);
}
*/
else
{
trace("You didn't define any achievements to test...");
}

//The controller code below assumes you have already read the Steam Docs
//on controller support and set up the "default" test configuration, so that
//you're testing locally with a game_actions_<YOURAPPID>.vdf file
//
//If you have no clue what this means, READ THE STEAM DOCS!
//
//It won't crash if you haven't, it just won't work

var controllers:Array<Int> = API.controllers.getConnectedControllers();

Expand Down Expand Up @@ -51,46 +65,53 @@ class Test
trace("fire = " + fire + " jump = " + jump);
trace("pause_menu = " + pause_menu);

var fireOrigins:Array<EControllerActionOrigin> = [];
var fireOriginCount = API.controllers.getDigitalActionOrigins(controllers[0], inGameControls, fire, fireOrigins);

trace("===DIGITAL ACTION ORIGINS===");
trace("fire: count = " + fireOriginCount + " origins = " + fireOrigins);

for (origin in fireOrigins) {
if (origin != NONE) {
trace("glpyh = " + Std.string(origin).toLowerCase());
if (controllers != null && controllers.length > 0)
{
var fireOrigins:Array<EControllerActionOrigin> = [];
var fireOriginCount = API.controllers.getDigitalActionOrigins(controllers[0], inGameControls, fire, fireOrigins);

trace("===DIGITAL ACTION ORIGINS===");
trace("fire: count = " + fireOriginCount + " origins = " + fireOrigins);

for (origin in fireOrigins) {
if (origin != NONE) {
trace("glpyh = " + Std.string(origin).toLowerCase());
}
}
}

trace("===ANALOG ACTION HANDLES===");
trace("throttle = " + throttle + " move = " + move + " camera = " + camera);

var moveOrigins:Array<EControllerActionOrigin> = [];
var moveOriginCount = API.controllers.getAnalogActionOrigins(controllers[0], inGameControls, move, moveOrigins);

trace("===ANALOG ACTION ORIGINS===");
trace("move: count = " + moveOriginCount + " origins = " + moveOrigins);

for (origin in moveOrigins) {
if (origin != NONE) {
trace("glpyh = " + Std.string(origin).toLowerCase());
trace("===ANALOG ACTION HANDLES===");
trace("throttle = " + throttle + " move = " + move + " camera = " + camera);
var moveOrigins:Array<EControllerActionOrigin> = [];
var moveOriginCount = API.controllers.getAnalogActionOrigins(controllers[0], inGameControls, move, moveOrigins);
trace("===ANALOG ACTION ORIGINS===");
trace("move: count = " + moveOriginCount + " origins = " + moveOrigins);
for (origin in moveOrigins) {
if (origin != NONE) {
trace("glpyh = " + Std.string(origin).toLowerCase());
}
}
}

while (true)
{
API.onEnterFrame();
Sys.sleep(0.1);
API.controllers.activateActionSet(controllers[0], inGameControls);
var currentActionSet = API.controllers.getCurrentActionSet(controllers[0]);
trace("current action set = " + currentActionSet);

var fireData = API.controllers.getDigitalActionData(controllers[0], fire);
trace("fireData: bState = " + fireData.bState + " bActive = " + fireData.bActive);

var moveData = API.controllers.getAnalogActionData(controllers[0], move);
trace("moveData: eMode = " + moveData.eMode + " x/y = "+ moveData.x + "/" + moveData.y + " bActive = " + moveData.bActive);
if (controllers != null && controllers.length > 0)
{
API.controllers.activateActionSet(controllers[0], inGameControls);
var currentActionSet = API.controllers.getCurrentActionSet(controllers[0]);
trace("current action set = " + currentActionSet);

var fireData = API.controllers.getDigitalActionData(controllers[0], fire);
trace("fireData: bState = " + fireData.bState + " bActive = " + fireData.bActive);

var moveData = API.controllers.getAnalogActionData(controllers[0], move);
trace("moveData: eMode = " + moveData.eMode + " x/y = " + moveData.x + "/" + moveData.y + " bActive = " + moveData.bActive);
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions include.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
<classpath name="steamwrap" />

<section if="windows">
<template path="native/lib/win32/steam_api.dll" rename="steam_api.dll" />
<template path="templates/steam_appid.txt" rename="steam_appid.txt" />
<template path="native/lib/win32/steam_api.dll" rename="steam_api.dll"/>
<template path="templates/steam_appid.txt" rename="steam_appid.txt" unless="final"/>
</section>

<section if="linux">
<!-- Copies into both 32 and 64 bit folders because I haven't found a way to differentiate between them using conditionals in this file -->
<template path="native/lib/linux64/libsteam_api.so" rename="../../../linux64/cpp/bin/libsteam_api.so" />
<template path="native/lib/linux32/libsteam_api.so" rename="../../../linux/cpp/bin/libsteam_api.so" />
<template path="templates/steam_appid.txt" rename="steam_appid.txt" />
<template path="templates/steam_appid.txt" rename="steam_appid.txt" unless="final"/>
</section>

<section if="mac">
<template path="native/lib/osx32/libsteam_api.dylib" rename="bin/${APP_FILE}.app/Contents/MacOS/libsteam_api.dylib" />
<template path="templates/steam_appid.txt" rename="bin/${APP_FILE}.app/Contents/MacOS/steam_appid.txt" />
<template path="templates/steam_appid.txt" rename="bin/${APP_FILE}.app/Contents/MacOS/steam_appid.txt" unless="final"/>
</section>

</project>
1 change: 1 addition & 0 deletions templates/steam_appid.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::ENV_STEAM_APP_ID::

0 comments on commit 59881f9

Please sign in to comment.