android port
This commit is contained in:
+15
-16
@@ -15,7 +15,7 @@
|
||||
#include "steam/steam_gameserver.h"
|
||||
#endif
|
||||
|
||||
class CFunnyGameBridge: public IEngineBridge
|
||||
class CClientGameBridge: public IEngineBridge
|
||||
{
|
||||
virtual void Init() override;
|
||||
virtual void Tick( float fDelta ) override;
|
||||
@@ -33,18 +33,18 @@ class CFunnyGameBridge: public IEngineBridge
|
||||
};
|
||||
|
||||
|
||||
IEngineBridge *EngineBridge()
|
||||
IEngineBridge *ClientEngineBridge()
|
||||
{
|
||||
static CFunnyGameBridge s_bridge;
|
||||
static CClientGameBridge s_bridge;
|
||||
return &s_bridge;
|
||||
}
|
||||
|
||||
void XRInputCallback( IXRController *pController, EXRInputType_t eType, const char *szType, EXRInputActionType_t action, EXRInputValue_t value );
|
||||
|
||||
|
||||
EXPOSE_INTERFACE_FN(EngineBridge, IEngineBridge, ENGINE_BRIDGE_INTERFACE_VERSION)
|
||||
EXPOSE_INTERFACE_FN(ClientEngineBridge, IClientEngineBridge, CLIENT_ENGINE_BRIDGE_INTERFACE_VERSION)
|
||||
|
||||
void CFunnyGameBridge::Init()
|
||||
void CClientGameBridge::Init()
|
||||
{
|
||||
Console()->AddCommand("exec game/core/default.cfg\n");
|
||||
Console()->Execute();
|
||||
@@ -121,12 +121,12 @@ void CFunnyGameBridge::Init()
|
||||
*/
|
||||
}
|
||||
|
||||
void CFunnyGameBridge::Tick( float fDelta )
|
||||
void CClientGameBridge::Tick( float fDelta )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CFunnyGameBridge::TryToConnectToServer()
|
||||
void CClientGameBridge::TryToConnectToServer()
|
||||
{
|
||||
#ifdef STEAM
|
||||
if (g_pEngineConstants->m_bIsSteam)
|
||||
@@ -145,10 +145,10 @@ void CFunnyGameBridge::TryToConnectToServer()
|
||||
if (g_pServerConnection)
|
||||
{
|
||||
m_bIsConnectedToServer = true;
|
||||
C_BaseEntity **ppEntities = EntitySystem()->GetEntities();
|
||||
C_BaseEntity **ppEntities = ClientEntitySystem()->GetEntities();
|
||||
for ( int i = 0; i < MAX_EDICTS; i++ )
|
||||
{
|
||||
EntitySystem()->DestroyEntityByIndex(i);
|
||||
ClientEntitySystem()->DestroyEntityByIndex(i);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -156,9 +156,8 @@ void CFunnyGameBridge::TryToConnectToServer()
|
||||
#endif
|
||||
}
|
||||
|
||||
void CFunnyGameBridge::Frame( float fDelta )
|
||||
void CClientGameBridge::Frame( float fDelta )
|
||||
{
|
||||
|
||||
if (g_pMainWindow->GetRenderWidth() != m_pMainViewport->GetWidth())
|
||||
if (g_pMainWindow->GetRenderHeight() != m_pMainViewport->GetHeight())
|
||||
m_pMainViewport->UpdateResolution(g_pMainWindow->GetRenderWidth(), g_pMainWindow->GetRenderHeight());
|
||||
@@ -198,7 +197,7 @@ void CFunnyGameBridge::Frame( float fDelta )
|
||||
case MESSAGE_ENTITY_CLASS_SYNC:
|
||||
case MESSAGE_ENTITY_DATA_SYNC:
|
||||
case k_EMessage_PlayerSetLocalEntity:
|
||||
EntitySystem()->NetRecvPacket(&packet);
|
||||
ClientEntitySystem()->NetRecvPacket(&packet);
|
||||
pCurrentServer->RecievePacket();
|
||||
break;
|
||||
default:
|
||||
@@ -209,7 +208,7 @@ void CFunnyGameBridge::Frame( float fDelta )
|
||||
}
|
||||
}
|
||||
|
||||
EntitySystem()->Think();
|
||||
ClientEntitySystem()->Think();
|
||||
|
||||
float fTickRate = 1.0/60.0;
|
||||
m_fNetUpdateTimer += fDelta;
|
||||
@@ -220,19 +219,19 @@ void CFunnyGameBridge::Frame( float fDelta )
|
||||
m_fNetUpdateTimer-=fTickRate;
|
||||
m_fNetUpdateTimer = fmod(m_fNetUpdateTimer, fTickRate);
|
||||
if (pCurrentServer)
|
||||
EntitySystem()->NetSendThink(pCurrentServer);
|
||||
ClientEntitySystem()->NetSendThink(pCurrentServer);
|
||||
}
|
||||
g_pWorldRenderer->Frame(fDelta);
|
||||
g_pMainWindow->SetOutputImage(m_pMainViewport->GetRenderImage());
|
||||
}
|
||||
|
||||
void CFunnyGameBridge::Shutdown()
|
||||
void CClientGameBridge::Shutdown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#define CONNECT_INTERFACE(szName, pGlobal) if (!V_strcmp(psz, szName)) { pGlobal = (typeof(pGlobal))pInterface; return; }
|
||||
void CFunnyGameBridge::ConnectInterface( const char *psz, void *pInterface )
|
||||
void CClientGameBridge::ConnectInterface( const char *psz, void *pInterface )
|
||||
{
|
||||
CONNECT_INTERFACE(FILESYSTEM_INTERFACE_VERSION, filesystem);
|
||||
CONNECT_INTERFACE(RENDER_CONTEXT_INTERFACE_VERSION, g_pRenderContext);
|
||||
|
||||
Reference in New Issue
Block a user