Rise
The Vieneo Province
Loading...
Searching...
No Matches
isteamtimeline.h
Go to the documentation of this file.
1//====== Copyright � Valve Corporation, All rights reserved. =======
2//
3// Purpose: interface to Steam Timeline
4//
5//=============================================================================
6
7#ifndef ISTEAMTIMELINE_H
8#define ISTEAMTIMELINE_H
9#ifdef _WIN32
10#pragma once
11#endif
12
13#include "steam_api_common.h"
14
15// callbacks
16#if defined( VALVE_CALLBACK_PACK_SMALL )
17#pragma pack( push, 4 )
18#elif defined( VALVE_CALLBACK_PACK_LARGE )
19#pragma pack( push, 8 )
20#else
21#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
22#endif
23
24// Controls the color of the timeline bar segments. The value names listed here map to a multiplayer game, where
25// the user starts a game (in menus), then joins a multiplayer session that first has a character selection lobby
26// then finally the multiplayer session starts. However, you can also map these values to any type of game. In a single
27// player game where you visit towns & dungeons, you could set k_ETimelineGameMode_Menus when the player is in a town
28// buying items, k_ETimelineGameMode_Staging for when a dungeon is loading and k_ETimelineGameMode_Playing for when
29// inside the dungeon fighting monsters.
40
41// Used in AddTimelineEvent, where Featured events will be offered before Standard events
49
50
52const uint32 k_unTimelinePriority_KeepCurrentValue = 1000000; // Use with UpdateRangeTimelineEvent to not change the priority
53const float k_flMaxTimelineEventDuration = 600.f;
55
57
58
59//-----------------------------------------------------------------------------
60// Purpose: Steam Timeline API
61//-----------------------------------------------------------------------------
63{
64public:
65
66 // Sets a description for the current game state in the timeline. These help the user to find specific
67 // moments in the timeline when saving clips. Setting a new state description replaces any previous
68 // description.
69 //
70 // Examples could include:
71 // * Where the user is in the world in a single player game
72 // * Which round is happening in a multiplayer game
73 // * The current score for a sports game
74 //
75 // Parameters:
76 // - pchDescription: provide a localized string in the language returned by SteamUtils()->GetSteamUILanguage()
77 // - flTimeDelta: The time offset in seconds to apply to this event. Negative times indicate an
78 // event that happened in the past.
79 virtual void SetTimelineTooltip( const char *pchDescription, float flTimeDelta ) = 0;
80 virtual void ClearTimelineTooltip( float flTimeDelta ) = 0;
81
82 // Changes the color of the timeline bar. See ETimelineGameMode comments for how to use each value
83 virtual void SetTimelineGameMode( ETimelineGameMode eMode ) = 0;
84
85 /******************* Timeline Events *******************/
86
87 // The following functions add events and/or tags to the timeline. There are helpers to add simple events or tags in a single call.
88 // or you can use StartEvent and CloseEvent to customize what gets added.
89 //
90 // Examples of events to add could include:
91 // * a boss battle
92 // * a cut scene
93 // * a large team fight
94 // * picking up a new weapon or ammunition
95 // * scoring a goal
96 //
97 // Adding an event and a time range with the simple API:
98 // SteamTimeline()->AddSimpleTimelineEvent( "steam_heart", Localize( "#user healed" ), Localize( "#health_amount", 27 ), 15, 0, 0, k_ETimelineEventClipPriority_None );
99 // SteamTimeline()->AddTaggedTimeRange( Localize( "#player_resting" ), "steam_flag", /* don't show filter */nullptr, 15, /* start now */0, 10 );
100 // SteamTimeline()->AddTaggedTimeRange( Localize( "#player_cast_light" ), "steam_starburst", Localize( "#player_spells" ), 10, /* start 10 sec ago */ -10, 5 );
101 //
102 // Adding a marker and time range in one event:
103 // TimelineEventHandle_t event = SteamTimeline()->StartEvent( /* start now */ 0 );
104 // SteamTimeline()->ShowEventOnTimeline( event, "steam_heart", Localize( "#player_healed" ), Localize( "#player_healed_amount", 27 ), 15 );
105 // SteamTimeline()->AddEventTag( event, Localize( "#player_cast_heal" ), "steam_heart", Localize( "#player_, 15, /* start now */0, 10 );
106 // ... // time passes
107 // SteamTimeline()->CloseEvent( event );
108 //
109 // Parameters used by the event functions:
110 //
111 // - ulOpenEvent: An event returned by StartEvent that has not yet had CancelEvent or CloseEvent called on it
112 // - ulEvent: An event that has had CloseEvent called on it, or an event returned from AddSimpleTimelineEvent or AddTaggedTimeRange (which
113 // are closed automatically.)
114 // - pchIcon: specify the name of the icon uploaded through the Steamworks Partner Site for your title
115 // or one of the provided icons that start with steam_
116 // - pchTitle & pchDescription: provide a localized string in the language returned by
117 // SteamUtils()->GetSteamUILanguage()
118 // - unIconPriority: specify how important this range is compared to other markers provided by the game.
119 // Ranges with larger priority values will be displayed more prominently in the UI. This value
120 // may be between 0 and k_unMaxTimelinePriority.
121 // - flStartOffsetSeconds: The time that this range started relative to now. Negative times
122 // indicate an event that happened in the past.
123 // - flDurationSeconds: How long the time range should be in seconds. For instantaneous events, this
124 // should be 0
125 // - ePossibleClip: By setting this parameter to Featured or Standard, the game indicates to Steam that it
126 // would be appropriate to offer this range as a clip to the user. For instantaneous events, the
127 // suggested clip will be for a short time before and after the event itself.
128 // - pchTagIcon: specify an icon name that will be used next to the tag name in the UI
129 // - pchTagName: The localized name of the tag to show in the UI.
130 // - pchTagGroup: The localized name of the tag group to show in the UI. If this is not specified, users will not be able to filter by this tag
131 // - unTagPriority: specify how important this tag is compared to other tags provided by the game.
132 // Returns:
133 // A TimelineEventHandle_t that can be used to make subsequent calls to refer to the timeline event. This event handle is invalid
134 // after the game exits.
135
136 // quick helpers that add to the timeline in one call
137 virtual TimelineEventHandle_t AddInstantaneousTimelineEvent( const char *pchTitle, const char *pchDescription, const char *pchIcon, uint32 unIconPriority, float flStartOffsetSeconds = 0.f, ETimelineEventClipPriority ePossibleClip = k_ETimelineEventClipPriority_None ) = 0;
138 virtual TimelineEventHandle_t AddRangeTimelineEvent( const char *pchTitle, const char *pchDescription, const char *pchIcon, uint32 unIconPriority, float flStartOffsetSeconds = 0.f, float flDuration = 0.f, ETimelineEventClipPriority ePossibleClip = k_ETimelineEventClipPriority_None ) = 0;
139
140 // Starts a timeline event at a the current time, plus an offset in seconds. This event must be ended with EndRangeTimelineEvent.
141 // Any timeline events that have not been ended when the game exits will be discarded.
142 virtual TimelineEventHandle_t StartRangeTimelineEvent( const char *pchTitle, const char *pchDescription, const char *pchIcon, uint32 unPriority, float flStartOffsetSeconds, ETimelineEventClipPriority ePossibleClip ) = 0;
143
144 // Updates fields on a range timeline event that was started with StartRangeTimelineEvent, and which has not been ended.
145 virtual void UpdateRangeTimelineEvent( TimelineEventHandle_t ulEvent, const char *pchTitle, const char *pchDescription, const char *pchIcon, uint32 unPriority, ETimelineEventClipPriority ePossibleClip ) = 0;
146
147 // Ends a range timeline event and shows it in the UI.
148 virtual void EndRangeTimelineEvent( TimelineEventHandle_t ulEvent, float flEndOffsetSeconds ) = 0;
149
150 // delete the event from the timeline. This can be called on a timeline event from AddInstantaneousTimelineEvent,
151 // AddRangeTimelineEvent, or StartRangeTimelineEvent/EndRangeTimelineEvent. The timeline event handle must be from the
152 // current game process.
153 virtual void RemoveTimelineEvent( TimelineEventHandle_t ulEvent ) = 0;
154
155 // add a tag to whatever time range is represented by the event
158
159 /******************* Game Phases *******************/
160
161 // Game phases allow the user to navigate their background recordings and clips. Exactly what a game phase means will vary game to game, but
162 // the game phase should be a section of gameplay that is usually between 10 minutes and a few hours in length, and should be the
163 // main way a user would think to divide up the game. These are presented to the user in a UI that shows the date the game was played,
164 // with one row per game slice. Game phases should be used to mark sections of gameplay that the user might be interested in watching.
165 //
166 // Examples could include:
167 // * A single match in a multiplayer PvP game
168 // * A chapter of a story-based singleplayer game
169 // * A single run in a roguelike
170 //
171 // Game phases are started with StartGamePhase, and while a phase is still happening, they can have tags and attributes added to them.
172 //
173 // Phase attributes represent generic text fields that can be updated throughout the duration of the phase. They are meant
174 // to be used for phase metadata that is not part of a well defined set of options. For example, a KDA attribute that starts
175 // with the value "0/0/0" and updates as the phase progresses, or something like a played-entered character name. Attributes
176 // can be set as many times as the game likes with SetGamePhaseAttribute, and only the last value will be shown to the user.
177 //
178 // Phase tags represent data with a well defined set of options, which could be data such as match resolution, hero played,
179 // game mode, etc. Tags can have an icon in addition to a text name. Multiple tags within the same group may be added per phase
180 // and all will be remembered. For example, AddGamePhaseTag may be called multiple times for a "Bosses Defeated" group, with
181 // different names and icons for each boss defeated during the phase, all of which will be shown to the user.
182 //
183 // The phase will continue until the game exits, until the game calls EndGamePhase, or until the game calls
184 // StartGamePhase to start a new phase.
185 //
186 // The game phase functions take these parameters:
187 // - pchTagIcon: The name of a game provided timeline icon or builtin "steam_" icon.
188 // - pchPhaseID: A game-provided persistent ID for a game phase. This could be a the match ID in a multiplayer game, a chapter name in a
189 // single player game, the ID of a character, etc.
190 // - pchTagName: The localized name of the tag in the language returned by SteamUtils()->GetSteamUILanguage().
191 // - pchTagGroup: The localized name of the tag group.
192 // - pchAttributeValue: The localized name of the attribute.
193 // - pchAttributeGroup: The localized name of the attribute group.
194 // - unPriority: Used to order tags and attributes in the UI displayed to the user, with higher priority values leading
195 // to more prominent positioning. In contexts where there is limited space, lower priority items may be hidden.
196 virtual void StartGamePhase() = 0;
197 virtual void EndGamePhase() = 0;
198
199 // Games can set a phase ID so they can refer back to a phase in OpenOverlayToPhase
200 virtual void SetGamePhaseID( const char *pchPhaseID ) = 0;
202 virtual SteamAPICall_t DoesGamePhaseRecordingExist( const char *pchPhaseID ) = 0;
203
204 // Add a tag that applies to the entire phase
205 virtual void AddGamePhaseTag( const char *pchTagName, const char *pchTagIcon, const char *pchTagGroup, uint32 unPriority ) = 0;
206
207 // Add a text attribute that applies to the entire phase
208 virtual void SetGamePhaseAttribute( const char *pchAttributeGroup, const char *pchAttributeValue, uint32 unPriority ) = 0;
209
210 /******************* Opening the overlay *******************/
211
212 // Opens the Steam overlay to a game phase.
213 //
214 // Parameters:
215 // - pchPhaseID: The ID of a phase that was previously provided by the game in SetGamePhaseID.
216 virtual void OpenOverlayToGamePhase( const char *pchPhaseID ) = 0;
217
218 // Opens the Steam overlay to a timeline event.
219 //
220 // Parameters:
221 // - ulEventID: The ID of a timeline event returned by StartEvent or AddSimpleTimelineEvent
222 virtual void OpenOverlayToTimelineEvent( const TimelineEventHandle_t ulEvent ) = 0;
223
224};
225
226#define STEAMTIMELINE_INTERFACE_VERSION "STEAMTIMELINE_INTERFACE_V004"
227
228// Global interface accessor
231
232
233//-----------------------------------------------------------------------------
234// Purpose: Callback for querying UGC
235//-----------------------------------------------------------------------------
245
246//-----------------------------------------------------------------------------
247// Purpose: Callback for querying UGC
248//-----------------------------------------------------------------------------
255
256
257
258#pragma pack( pop )
259
260
261#endif // ISTEAMTIMELINE_H
virtual void ClearTimelineTooltip(float flTimeDelta)=0
virtual void SetGamePhaseID(const char *pchPhaseID)=0
virtual void SetTimelineTooltip(const char *pchDescription, float flTimeDelta)=0
virtual void SetGamePhaseAttribute(const char *pchAttributeGroup, const char *pchAttributeValue, uint32 unPriority)=0
virtual TimelineEventHandle_t AddRangeTimelineEvent(const char *pchTitle, const char *pchDescription, const char *pchIcon, uint32 unIconPriority, float flStartOffsetSeconds=0.f, float flDuration=0.f, ETimelineEventClipPriority ePossibleClip=k_ETimelineEventClipPriority_None)=0
virtual SteamAPICall_t DoesGamePhaseRecordingExist(const char *pchPhaseID)=0
virtual void EndGamePhase()=0
virtual void AddGamePhaseTag(const char *pchTagName, const char *pchTagIcon, const char *pchTagGroup, uint32 unPriority)=0
virtual void OpenOverlayToGamePhase(const char *pchPhaseID)=0
virtual void StartGamePhase()=0
virtual TimelineEventHandle_t AddInstantaneousTimelineEvent(const char *pchTitle, const char *pchDescription, const char *pchIcon, uint32 unIconPriority, float flStartOffsetSeconds=0.f, ETimelineEventClipPriority ePossibleClip=k_ETimelineEventClipPriority_None)=0
virtual SteamAPICall_t DoesEventRecordingExist(TimelineEventHandle_t ulEvent)=0
virtual void UpdateRangeTimelineEvent(TimelineEventHandle_t ulEvent, const char *pchTitle, const char *pchDescription, const char *pchIcon, uint32 unPriority, ETimelineEventClipPriority ePossibleClip)=0
virtual void RemoveTimelineEvent(TimelineEventHandle_t ulEvent)=0
virtual void OpenOverlayToTimelineEvent(const TimelineEventHandle_t ulEvent)=0
virtual TimelineEventHandle_t StartRangeTimelineEvent(const char *pchTitle, const char *pchDescription, const char *pchIcon, uint32 unPriority, float flStartOffsetSeconds, ETimelineEventClipPriority ePossibleClip)=0
virtual void EndRangeTimelineEvent(TimelineEventHandle_t ulEvent, float flEndOffsetSeconds)=0
virtual void SetTimelineGameMode(ETimelineGameMode eMode)=0
ETimelineEventClipPriority
@ k_ETimelineEventClipPriority_None
@ k_ETimelineEventClipPriority_Invalid
@ k_ETimelineEventClipPriority_Standard
@ k_ETimelineEventClipPriority_Featured
#define STEAMTIMELINE_INTERFACE_VERSION
const uint32 k_unMaxTimelinePriority
ISteamTimeline * SteamTimeline()
const float k_flMaxTimelineEventDuration
const uint32 k_cchMaxPhaseIDLength
uint64 TimelineEventHandle_t
const uint32 k_unTimelinePriority_KeepCurrentValue
ETimelineGameMode
@ k_ETimelineGameMode_LoadingScreen
@ k_ETimelineGameMode_Staging
@ k_ETimelineGameMode_Invalid
@ k_ETimelineGameMode_Playing
@ k_ETimelineGameMode_Max
@ k_ETimelineGameMode_Menus
const char *typedef uint32(S_CALLTYPE *SteamAPI_CheckCallbackRegistered_t)(int iCallbackNum)
#define STEAM_DEFINE_USER_INTERFACE_ACCESSOR(type, name, version)
@ k_iSteamTimelineCallbacks
#define STEAM_CALL_RESULT(RESULT_TYPE)
unsigned long long uint64
Definition steamtypes.h:60
uint64 SteamAPICall_t
Definition steamtypes.h:93
char m_rgchPhaseID[k_cchMaxPhaseIDLength]