Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposed Notification Overlay position #3

Merged
merged 2 commits into from
Apr 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions native/SteamWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,18 +399,36 @@ static bool CheckInit()
}

//-----------------------------------------------------------------------------------------------------------
value SteamWrap_Init(value onEvent)
value SteamWrap_Init(value onEvent, value notificationPosition)
{
bool result = SteamAPI_Init();
if (result)
{
g_eventHandler = new AutoGCRoot(onEvent);
s_callbackHandler = new CallbackHandler();
SteamUtils()->SetOverlayNotificationPosition( k_EPositionTopLeft );

switch (val_int(notificationPosition))
{
case 0:
SteamUtils()->SetOverlayNotificationPosition(k_EPositionTopLeft);
break;
case 1:
SteamUtils()->SetOverlayNotificationPosition(k_EPositionTopRight);
break;
case 2:
SteamUtils()->SetOverlayNotificationPosition(k_EPositionBottomRight);
break;
case 3:
SteamUtils()->SetOverlayNotificationPosition(k_EPositionBottomLeft);
break;
default:
SteamUtils()->SetOverlayNotificationPosition(k_EPositionBottomRight);
break;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style note: if you could please indent the case statements and their bodies by one tab each so they start one tab in from the open & close brackets

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops! fixed it.

}
return alloc_bool(result);
}
DEFINE_PRIM(SteamWrap_Init, 1);
DEFINE_PRIM(SteamWrap_Init, 2);

//-----------------------------------------------------------------------------------------------------------
void SteamWrap_Shutdown()
Expand Down
Binary file modified ndll/Windows/steamwrap.ndll
Binary file not shown.
16 changes: 13 additions & 3 deletions steamwrap/api/Steam.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ private enum LeaderboardOp
DOWNLOAD(id:String);
}

@:enum
abstract SteamNotificationPosition(Int) to Int
{
var TopLeft = 0;
var TopRight = 1;
var BottomRight = 2;
var BottomLeft = 3;
}

typedef ControllerHandle = Int64;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for using an enum on the haxe side too, so we can keep the user from dealing with "magic numbers"

typedef ControllerActionSetHandle = Int;
typedef ControllerDigitalActionHandle = Int;
Expand Down Expand Up @@ -51,8 +60,9 @@ class Steam

/**
* @param appId_ Your Steam APP ID (the numbers on the end of your store page URL - store.steampowered.com/app/XYZ)
* @param notificationPosition The position of the Steam Overlay Notification box.
*/
public static function init(appId_:Int) {
public static function init(appId_:Int, notificationPosition:SteamNotificationPosition = SteamNotificationPosition.BottomRight) {
#if sys //TODO: figure out what targets this will & won't work with and upate this guard
if (active) return;

Expand All @@ -68,7 +78,7 @@ class Steam
SteamWrap_GetGlobalStat = cpp.Lib.load("steamwrap", "SteamWrap_GetGlobalStat", 1);
SteamWrap_GetStat = cpp.Lib.load("steamwrap", "SteamWrap_GetStat", 1);
SteamWrap_IndicateAchievementProgress = cpp.Lib.load("steamwrap", "SteamWrap_IndicateAchievementProgress", 3);
SteamWrap_Init = cpp.Lib.load("steamwrap", "SteamWrap_Init", 1);
SteamWrap_Init = cpp.Lib.load("steamwrap", "SteamWrap_Init", 2);
SteamWrap_IsSteamRunning = cpp.Lib.load("steamwrap", "SteamWrap_IsSteamRunning", 0);
SteamWrap_RequestStats = cpp.Lib.load("steamwrap", "SteamWrap_RequestStats", 0);
SteamWrap_RunCallbacks = cpp.Lib.load("steamwrap", "SteamWrap_RunCallbacks", 0);
Expand All @@ -88,7 +98,7 @@ class Steam

// if we get this far, the dlls loaded ok and we need Steam to init.
// otherwise, we're trying to run the Steam version without the Steam client
active = SteamWrap_Init(steamWrap_onEvent);
active = SteamWrap_Init(steamWrap_onEvent, notificationPosition);

if (active) {
customTrace("Steam active");
Expand Down