This commit is contained in:
Riley Labrecque
2014-09-09 01:13:50 +03:00
parent f4d127e335
commit 13dfd29f13
56 changed files with 1776 additions and 54 deletions
+13 -2
View File
@@ -37,6 +37,14 @@ typedef int HGAMEVOICECHANNEL;
#define VOICE_OUTPUT_SAMPLE_RATE_IDEAL 11025
#define BYTES_PER_SAMPLE 2
// Texture formats we support for upload to textures
enum ETEXTUREFORMAT
{
eTextureFormat_RGBA, // 8 bits per channel
eTextureFormat_BGRA, // 8 bits per channel
eTextureFormat_BGRA16, // 16 bits per channel
};
// used for VR support
namespace vr { class IHmd; }
@@ -81,8 +89,11 @@ public:
// Create a new font returning our internal handle value for it (0 means failure)
virtual HGAMEFONT HCreateFont( int nHeight, int nFontWeight, bool bItalic, const char * pchFont ) = 0;
// Create a new texture returning our internal handle value for it (0 means failure)
virtual HGAMETEXTURE HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight ) = 0;
// Create a new texture returning our internal handle value for it (0 means failure), texture type specifies the type of data contained in pData
virtual HGAMETEXTURE HCreateTexture( byte *pData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat = eTextureFormat_RGBA ) = 0;
// update an existing texture, texture type specifies the type of data contained in pData
virtual bool UpdateTexture( HGAMETEXTURE texture, byte *pData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat = eTextureFormat_RGBA ) = 0;
// Draw a line, the engine itself will manage batching these (although you can explicitly flush if you need to)
virtual bool BDrawLine( float xPos0, float yPos0, DWORD dwColor0, float xPos1, float yPos1, DWORD dwColor1 ) = 0;
+1 -1
View File
@@ -198,7 +198,7 @@ void CLeaderboards::OnMenuSelection( LeaderboardMenuItem_t selection )
}
else if ( selection.m_bNextLeaderboard )
{
m_nCurrentLeaderboard = ++m_nCurrentLeaderboard % 2;
m_nCurrentLeaderboard = (m_nCurrentLeaderboard+1) % 2;
Show();
}
}
+1
View File
@@ -29,5 +29,6 @@ CMainMenu::CMainMenu( IGameEngine *pGameEngine ) : CBaseMenu<EClientGameState>(
AddMenuItem( MenuItem_t( "Web Callback", k_EClientWebCallback ) );
AddMenuItem( MenuItem_t( "Music Player", k_EClientMusic ) );
AddMenuItem( MenuItem_t( "Workshop Items", k_EClientWorkshop ) );
AddMenuItem( MenuItem_t( "HTML Page", k_EClientHTMLSurface ) );
AddMenuItem( MenuItem_t( "Exit Game", k_EClientGameExiting ) );
}
+2 -2
View File
@@ -1,4 +1,4 @@
//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============
//========= Copyright 1996-2008, Valve LLC, All rights reserved. ============
//
// Purpose: Class for tracking stats and achievements
//
@@ -300,7 +300,7 @@ void CRemoteStorageScreen::Render()
}
const int32 width = m_pGameEngine->GetViewportWidth();
const int32 height = m_pGameEngine->GetViewportHeight();
//const int32 height = m_pGameEngine->GetViewportHeight();
const int32 pxColumn1Left = width / 2 - CLOUDDISP_COLUMN_WIDTH / 2;
+1
View File
@@ -186,6 +186,7 @@ enum EClientGameState
k_EClientWebCallback,
k_EClientMusic,
k_EClientWorkshop,
k_EClientHTMLSurface,
};
+30 -2
View File
@@ -20,6 +20,7 @@
#include "Lobby.h"
#include "p2pauth.h"
#include "voicechat.h"
#include "htmlsurface.h"
#include "steam/steamencryptedappticket.h"
#ifdef WIN32
#include <direct.h>
@@ -156,6 +157,9 @@ void CSpaceWarClient::Init( IGameEngine *pGameEngine )
// P2P voice chat
m_pVoiceChat = new CVoiceChat( pGameEngine );
// HTML Surface page
m_pHTMLSurface = new CHTMLSurface(pGameEngine);
LoadWorkshopItems();
}
@@ -204,6 +208,9 @@ CSpaceWarClient::~CSpaceWarClient()
if ( m_pVoiceChat )
delete m_pVoiceChat;
if ( m_pHTMLSurface )
delete m_pHTMLSurface;
for( uint32 i = 0; i < MAX_PLAYERS_PER_SERVER; ++i )
{
if ( m_rgpShips[i] )
@@ -1016,6 +1023,12 @@ void CSpaceWarClient::OnGameStateChanged( EClientGameState eGameStateNew )
m_pMusicPlayer->Show();
SteamFriends()->SetRichPresence( "status", "Using music player" );
}
else if ( m_eGameState == k_EClientHTMLSurface )
{
// we've switched to the html page
m_pHTMLSurface->Show();
SteamFriends()->SetRichPresence("status", "Using the web");
}
}
//-----------------------------------------------------------------------------
@@ -1358,6 +1371,12 @@ void CSpaceWarClient::RunFrame()
m_pRemoteStorage->Render();
break;
case k_EClientHTMLSurface:
m_pHTMLSurface->RunFrame();
m_pHTMLSurface->Render();
break;
case k_EClientMinidump:
#ifdef _WIN32
RaiseException( EXCEPTION_NONCONTINUABLE_EXCEPTION,
@@ -2101,11 +2120,20 @@ bool CSpaceWarClient::LoadWorkshopItem( PublishedFileId_t workshopItemID )
uint64 unSizeOnDisk = 0;
char szItemFolder[1024] = { 0 };
if ( !SteamUGC()->GetItemInstallInfo( workshopItemID, &unSizeOnDisk, szItemFolder, sizeof(szItemFolder) ) )
bool bLegacyItem = false;
if ( !SteamUGC()->GetItemInstallInfo( workshopItemID, &unSizeOnDisk, szItemFolder, sizeof(szItemFolder), &bLegacyItem ) )
return false;
char szFile[1024];
_snprintf(szFile, sizeof(szFile), "%s/workshopitem.txt", szItemFolder);
if( bLegacyItem )
{
// szItemFolder just points directly to the item for legacy items that were published with the RemoteStorage API.
_snprintf( szFile, sizeof( szFile ), "%s", szItemFolder );
}
else
{
_snprintf( szFile, sizeof( szFile ), "%s/workshopitem.txt", szItemFolder );
}
CWorkshopItem *pItem = LoadWorkshopItemFromFile( szFile );
+4
View File
@@ -32,6 +32,7 @@ class CClanChatRoom;
class CP2PAuthPlayer;
class CP2PAuthedGame;
class CVoiceChat;
class CHTMLSurface;
// Height of the HUD font
#define HUD_FONT_HEIGHT 18
@@ -428,6 +429,9 @@ private:
// p2p voice chat
CVoiceChat *m_pVoiceChat;
// html page viewer
CHTMLSurface *m_pHTMLSurface;
// connection handler
STEAM_CALLBACK( CSpaceWarClient, OnP2PSessionConnectFail, P2PSessionConnectFail_t, m_CallbackP2PSessionConnectFail );
@@ -393,6 +393,10 @@
RelativePath=".\connectingmenu.cpp"
>
</File>
<File
RelativePath=".\htmlsurface.cpp"
>
</File>
<File
RelativePath=".\Leaderboards.cpp"
>
@@ -503,6 +507,10 @@
RelativePath=".\connectingmenu.h"
>
</File>
<File
RelativePath=".\htmlsurface.h"
>
</File>
<File
RelativePath=".\Leaderboards.h"
>