This commit is contained in:
Riley Labrecque
2014-01-29 13:48:54 +02:00
parent cef9939a5c
commit d3380d4157
70 changed files with 1051 additions and 388 deletions
+77
View File
@@ -0,0 +1,77 @@
//========= Copyright Valve LLC, All rights reserved. ============
//
// Purpose: Class for joining and showing clan chats
//
//================================================================
#include "stdafx.h"
#include "clanchatroom.h"
#include "BaseMenu.h"
#include <math.h>
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CClanChatRoom::CClanChatRoom( IGameEngine *pGameEngine ) : m_pGameEngine( pGameEngine )
{
}
//-----------------------------------------------------------------------------
// Purpose: Run a frame for the CClanChatRoom
//-----------------------------------------------------------------------------
void CClanChatRoom::RunFrame()
{
}
//-----------------------------------------------------------------------------
// Purpose: Shows / Refreshes the chat room
//-----------------------------------------------------------------------------
void CClanChatRoom::Show()
{
// start joining a chat, if we aren't in one already
if ( !m_steamIDChat.IsValid() || !m_SteamCallResultJoinChatRoom.IsActive() )
{
// pick a clan to join from the users current data
CSteamID steamIDBestClan;
for ( int i = 0; i < SteamFriends()->GetClanCount(); i++ )
{
CSteamID steamIDClan = SteamFriends()->GetClanByIndex( i );
int online, ingame, chatting;
if ( SteamFriends()->GetClanActivityCounts( steamIDClan, &online, &ingame, &chatting ) )
{
if ( chatting > 0 )
{
steamIDBestClan = steamIDClan;
break;
}
else if ( online )
{
steamIDBestClan = steamIDClan;
}
}
}
if ( steamIDBestClan.IsValid() )
{
SteamAPICall_t hCall = SteamFriends()->JoinClanChatRoom( steamIDBestClan );
m_SteamCallResultJoinChatRoom.Set( hCall, this, &CClanChatRoom::OnJoinChatRoom );
OutputDebugString( "joining clan chat...\n" );
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Called when SteamFriends()->JoinClanChatRoom() returns asynchronously
//-----------------------------------------------------------------------------
void CClanChatRoom::OnJoinChatRoom( JoinClanChatRoomCompletionResult_t *pResult, bool bIOFailure )
{
if ( pResult->m_eChatRoomEnterResponse == k_EChatRoomEnterResponseSuccess )
{
// we've entered
OutputDebugString( "succesfully joined clan chat\n" );
}
}
+42
View File
@@ -0,0 +1,42 @@
//========= Copyright © 1996-2009, Valve LLC, All rights reserved. ============
//
// Purpose: Class for joining and showing clan chat rooms
//
//=============================================================================
#ifndef CLANCHATROOM_H
#define CLANCHATROOM_H
#include "SpaceWar.h"
#include "GameEngine.h"
#include "StatsAndAchievements.h"
#include "SpaceWarClient.h"
class ISteamUser;
class CClanChatRoom
{
public:
// Constructor
CClanChatRoom( IGameEngine *pGameEngine );
// Run a frame
void RunFrame();
// shows / refreshes chat
void Show();
private:
// Engine
IGameEngine *m_pGameEngine;
// Called when SteamFriends()->JoinClanChatRoom() returns asynchronously
void OnJoinChatRoom( JoinClanChatRoomCompletionResult_t *pResult, bool bIOFailure );
CCallResult<CClanChatRoom, JoinClanChatRoomCompletionResult_t> m_SteamCallResultJoinChatRoom;
CSteamID m_steamIDChat;
};
#endif // CLANCHATROOM_H
+1 -3
View File
@@ -326,8 +326,6 @@ bool CGameEngineGL::BInitializeGraphics()
backing:NSBackingStoreBuffered
defer:NO];
[app setDelegate: app];
[m_window setDelegate: app];
[m_window setAcceptsMouseMovedEvents:YES];
GLint swapInt = 1;
@@ -2215,4 +2213,4 @@ void CGameEngineGL::ShowPixels ( CShowPixelsParams *params )
}
#endif
#endif
@@ -36,6 +36,7 @@
503C6DB41269002800B66E3B /* libsteam_api.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 503C6DB31269002800B66E3B /* libsteam_api.dylib */; };
504EDCBC126901EC00F96D63 /* libsteam_api.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 503C6DB31269002800B66E3B /* libsteam_api.dylib */; };
504EDCC21269026C00F96D63 /* steam_appid.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 504EDCC01269025A00F96D63 /* steam_appid.txt */; };
50D642871461EF3200A5739B /* clanchatroom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50D642851461EF3200A5739B /* clanchatroom.cpp */; };
50E77DEB1362190C000FC072 /* cglmbuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E77DD11362190C000FC072 /* cglmbuffer.cpp */; };
50E77DEC1362190C000FC072 /* cglmfbo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E77DD31362190C000FC072 /* cglmfbo.cpp */; };
50E77DED1362190C000FC072 /* cglmprogram.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E77DD51362190C000FC072 /* cglmprogram.cpp */; };
@@ -123,6 +124,8 @@
503C6DB31269002800B66E3B /* libsteam_api.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsteam_api.dylib; path = ../redistributable_bin/osx32/libsteam_api.dylib; sourceTree = "<absolute>"; };
504EDCB4126900D600F96D63 /* steamworksexample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "steamworksexample-Info.plist"; path = "osx/steamworksexample-Info.plist"; sourceTree = "<group>"; };
504EDCC01269025A00F96D63 /* steam_appid.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = steam_appid.txt; path = osx/steam_appid.txt; sourceTree = "<group>"; };
50D642851461EF3200A5739B /* clanchatroom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clanchatroom.cpp; sourceTree = "<group>"; };
50D642861461EF3200A5739B /* clanchatroom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clanchatroom.h; sourceTree = "<group>"; };
50E77DD11362190C000FC072 /* cglmbuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cglmbuffer.cpp; path = ../glmgr/cglmbuffer.cpp; sourceTree = "<group>"; };
50E77DD21362190C000FC072 /* cglmbuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cglmbuffer.h; path = ../glmgr/cglmbuffer.h; sourceTree = "<group>"; };
50E77DD31362190C000FC072 /* cglmfbo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cglmfbo.cpp; path = ../glmgr/cglmfbo.cpp; sourceTree = "<group>"; };
@@ -199,6 +202,7 @@
503C6D0B1268F49F00B66E3B /* VectorEntity.cpp */,
503C6D0D1268F49F00B66E3B /* voicechat.cpp */,
503C6CD91268F49F00B66E3B /* BaseMenu.cpp */,
50D642851461EF3200A5739B /* clanchatroom.cpp */,
503C6CDB1268F49F00B66E3B /* connectingmenu.cpp */,
503C6CE01268F49F00B66E3B /* gameengineosx.mm */,
503C6CE21268F49F00B66E3B /* glstringosx.mm */,
@@ -242,6 +246,7 @@
503C6D291268F4EE00B66E3B /* Headers */ = {
isa = PBXGroup;
children = (
50D642861461EF3200A5739B /* clanchatroom.h */,
503C6CEE1268F49F00B66E3B /* p2pauth.h */,
503C6CF01268F49F00B66E3B /* PhotonBeam.h */,
503C6CF21268F49F00B66E3B /* QuitMenu.h */,
@@ -399,6 +404,7 @@
50E77DF41362190C000FC072 /* glmgrcocoa.mm in Sources */,
50E77DF51362190C000FC072 /* glmgrext.cpp in Sources */,
50E77DF61362190C000FC072 /* mathlite.cpp in Sources */,
50D642871461EF3200A5739B /* clanchatroom.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};