aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Xbox/Sentient/Include/SenClientNews.h
blob: 22c39a1e568e6a27d93036e19d8067331c7cb452 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/********************************************************
*                                                       *
* Copyright (C) Microsoft. All rights reserved.         *
*                                                       *
********************************************************/

// Sentient Client News API
//
// Include this to get access to all News-related Sentient features.

#pragma once

#include "SenClientTypes.h"


namespace Sentient
{

	// Maximum number of items that will be returned from the service
	static const size_t MAX_NEWS_ITEM_COUNT = 20;

	// Default news cache expire time
	//  News cache expire time controls the duration between service synchronization.
	//  This duration is measured in seconds.  Default value is 6 minutes
	static const int CACHE_EXPIRE = 5 * 60 * 1000;

	// Extern linkage for News Item Count
	extern size_t newsItemCount;
	class NewsItemCountClass
	{
		public: NewsItemCountClass() { newsItemCount = MAX_NEWS_ITEM_COUNT; };
	};
	static NewsItemCountClass newsItemCountClass;

	// Extern linkage for cache expire
	extern int cacheExpire;
	class CacheExpireTimeoutClass
	{
		public: CacheExpireTimeoutClass() { cacheExpire = CACHE_EXPIRE; };
	};
	static CacheExpireTimeoutClass cacheExpireTimeoutClass;

	// Default characters per second
	//  Used for displaying local news messages through the PostLocalNews API
	//  Used for displaying default news messages through the SetDefaultNewsStrings API
	static const float DEFAULT_CHARS_PER_SEC = 2.0f;

	// Max size for news ticker messages
	static const size_t MAX_NEWS_TICKER_MESSAGE_SIZE = 256;

	/**************************
	 ***** News Types *****
	 **************************/

	enum SenTickerMessageType
	{
		SenTickerMessageType_Text = 0,
		SenTickerMessageType_MarketplaceOffer,
		SenTickerMessageType_Max
	};

	struct SenTickerData
	{
		wchar_t					message[MAX_NEWS_TICKER_MESSAGE_SIZE];
		SenTickerMessageType	messageType;
		INT64					data1;
		INT64					data2;
		float					charPerSec;
	};

	/**************************
	 ***** News Functions *****
	 **************************/

	// Ticker messages need to be pulled whenever the ticker is displayed. Call this function to get the next message to display

	/// @brief			public 
	///
	/// @param[in\out]	userIndex
	/// @param[in\out]	out_tickerData
	///
	/// @return			HRESULT
	///
	/// @details		<Insert detailed method documentation>
	///
	/// @related		<Related API>
	HRESULT SenGetTickerMessage(
		int userIndex, 
		SenTickerData *out_tickerData );

} // namespace Sentient