fixed building on windows (clangd is moron)
This commit is contained in:
@@ -118,8 +118,8 @@ void IEngine::Init()
|
|||||||
|
|
||||||
// Init IO
|
// Init IO
|
||||||
IVideo::Init();
|
IVideo::Init();
|
||||||
IInput::Init();
|
Input()->Init();
|
||||||
IInput::SetInputMode(INPUT_MODE_MENU);
|
Input()->SetInputMode(INPUT_MODE_MENU);
|
||||||
IFGUI::Init();
|
IFGUI::Init();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
#include "interface.h"
|
||||||
#include "mainmenu.h"
|
#include "mainmenu.h"
|
||||||
#include "tier0/lib.h"
|
#include "tier0/lib.h"
|
||||||
#include "tier1/commandline.h"
|
#include "tier1/commandline.h"
|
||||||
@@ -105,10 +106,22 @@ EInputKey IInput_StringToKey( char *psz )
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
interface CInput: public IInput
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void Init() override;
|
||||||
|
virtual void Frame() override;
|
||||||
|
virtual void Deinit() override;
|
||||||
|
virtual void KeyEvent( EInputKey key, EKeyEventType event ) override;
|
||||||
|
virtual void AxisEvent( EInputAxis axis, float fValue ) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
DECLARE_ENGINE_INTERFACE(Input, CInput)
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void IInput::Init( void )
|
void CInput::Init( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +147,7 @@ CUtlVector<EInputMode> g_inputModeStack = {INPUT_MODE_GAME, INPUT_MODE_MENU};
|
|||||||
// INPUT FIELD:
|
// INPUT FIELD:
|
||||||
// Doesn't recieve any events except for KEY_ESCAPE and KEY_ENTER
|
// Doesn't recieve any events except for KEY_ESCAPE and KEY_ENTER
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void IInput::KeyEvent( EInputKey key, EKeyEventType event )
|
void CInput::KeyEvent( EInputKey key, EKeyEventType event )
|
||||||
{
|
{
|
||||||
if (event == KEY_EVENT_TYPE_DOWN && key == KEY_ESCAPE)
|
if (event == KEY_EVENT_TYPE_DOWN && key == KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
@@ -213,7 +226,7 @@ void IInput::KeyEvent( EInputKey key, EKeyEventType event )
|
|||||||
// Axis events for the input devices such as mouse and controller.
|
// Axis events for the input devices such as mouse and controller.
|
||||||
// Game needs to explicitly support all of the devices.
|
// Game needs to explicitly support all of the devices.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void IInput::AxisEvent( EInputAxis axis, float fValue )
|
void CInput::AxisEvent( EInputAxis axis, float fValue )
|
||||||
{
|
{
|
||||||
if (g_inputModeStack[g_inputModeStack.GetSize()-1] == INPUT_MODE_GAME)
|
if (g_inputModeStack[g_inputModeStack.GetSize()-1] == INPUT_MODE_GAME)
|
||||||
{
|
{
|
||||||
@@ -233,7 +246,7 @@ void IInput::AxisEvent( EInputAxis axis, float fValue )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void IInput::Frame( void )
|
void CInput::Frame( void )
|
||||||
{
|
{
|
||||||
g_fAxisValues[AXIS_MOUSE_X] += g_fAxisModifiers[AXIS_CONTROLLER_PITCH];
|
g_fAxisValues[AXIS_MOUSE_X] += g_fAxisModifiers[AXIS_CONTROLLER_PITCH];
|
||||||
g_fAxisValues[AXIS_MOUSE_Y] += g_fAxisModifiers[AXIS_CONTROLLER_YAW];
|
g_fAxisValues[AXIS_MOUSE_Y] += g_fAxisModifiers[AXIS_CONTROLLER_YAW];
|
||||||
@@ -242,7 +255,7 @@ void IInput::Frame( void )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void IInput::Deinit( void )
|
void CInput::Deinit( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void IServer::Think( float fDelta )
|
|||||||
while(g_fAccumulator>=fTickrate)
|
while(g_fAccumulator>=fTickrate)
|
||||||
{
|
{
|
||||||
if (INetworking::IsClient())
|
if (INetworking::IsClient())
|
||||||
IInput::Frame();
|
Input()->Frame();
|
||||||
Console()->Execute();
|
Console()->Execute();
|
||||||
g_fAccumulator-=fTickrate;
|
g_fAccumulator-=fTickrate;
|
||||||
for (auto &entity: EntityManager()->m_entities)
|
for (auto &entity: EntityManager()->m_entities)
|
||||||
|
|||||||
@@ -452,16 +452,16 @@ void IVideo_HandleEvents()
|
|||||||
break;
|
break;
|
||||||
case SDL_EVENT_KEY_DOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
if (!key->repeat)
|
if (!key->repeat)
|
||||||
IInput::KeyEvent(ISDL_KeyName(key->key),KEY_EVENT_TYPE_DOWN);
|
Input()->KeyEvent(ISDL_KeyName(key->key),KEY_EVENT_TYPE_DOWN);
|
||||||
break;
|
break;
|
||||||
case SDL_EVENT_KEY_UP:
|
case SDL_EVENT_KEY_UP:
|
||||||
key = &event.key;
|
key = &event.key;
|
||||||
if (!key->repeat)
|
if (!key->repeat)
|
||||||
IInput::KeyEvent(ISDL_KeyName(key->key),KEY_EVENT_TYPE_UP);
|
Input()->KeyEvent(ISDL_KeyName(key->key),KEY_EVENT_TYPE_UP);
|
||||||
break;
|
break;
|
||||||
case SDL_EVENT_MOUSE_MOTION:
|
case SDL_EVENT_MOUSE_MOTION:
|
||||||
IInput::AxisEvent(AXIS_MOUSE_X, motion->yrel*m_pitch.GetFloat());
|
Input()->AxisEvent(AXIS_MOUSE_X, motion->yrel*m_pitch.GetFloat());
|
||||||
IInput::AxisEvent(AXIS_MOUSE_Y, -motion->xrel*m_yaw.GetFloat());
|
Input()->AxisEvent(AXIS_MOUSE_Y, -motion->xrel*m_yaw.GetFloat());
|
||||||
break;
|
break;
|
||||||
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
||||||
{
|
{
|
||||||
@@ -473,11 +473,11 @@ void IVideo_HandleEvents()
|
|||||||
|
|
||||||
if (axis == SDL_GAMEPAD_AXIS_RIGHTY)
|
if (axis == SDL_GAMEPAD_AXIS_RIGHTY)
|
||||||
{
|
{
|
||||||
IInput::AxisEvent(AXIS_CONTROLLER_PITCH, value);
|
Input()->AxisEvent(AXIS_CONTROLLER_PITCH, value);
|
||||||
}
|
}
|
||||||
if (axis == SDL_GAMEPAD_AXIS_RIGHTX)
|
if (axis == SDL_GAMEPAD_AXIS_RIGHTX)
|
||||||
{
|
{
|
||||||
IInput::AxisEvent(AXIS_CONTROLLER_YAW, -value);
|
Input()->AxisEvent(AXIS_CONTROLLER_YAW, -value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ int launcher_build()
|
|||||||
{
|
{
|
||||||
ldProject.objects.AppendTail((CObject){"external/windows/vulkan-1.dll"});
|
ldProject.objects.AppendTail((CObject){"external/windows/vulkan-1.dll"});
|
||||||
ldProject.objects.AppendTail((CObject){"external/windows/libSDL3.a"});
|
ldProject.objects.AppendTail((CObject){"external/windows/libSDL3.a"});
|
||||||
ldProject.objects.AppendTail((CObject){"external/windows/libdbghelp.a"});
|
|
||||||
ldProject.objects.AppendTail((CObject){"external/windows/libpthread.a"});
|
ldProject.objects.AppendTail((CObject){"external/windows/libpthread.a"});
|
||||||
ldProject.objects.AppendTail((CObject){"external/windows/libstdc++.a"});
|
ldProject.objects.AppendTail((CObject){"external/windows/libstdc++.a"});
|
||||||
if (bSteam)
|
if (bSteam)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#ifndef INPUT_H
|
#ifndef INPUT_H
|
||||||
#define INPUT_H
|
#define INPUT_H
|
||||||
|
|
||||||
|
#include "interface.h"
|
||||||
#include "tier0/platform.h"
|
#include "tier0/platform.h"
|
||||||
#include "tier1/utlvector.h"
|
#include "tier1/utlvector.h"
|
||||||
|
|
||||||
@@ -120,17 +121,16 @@ enum EInputMode
|
|||||||
|
|
||||||
extern CUtlVector<EInputMode> g_inputModeStack;
|
extern CUtlVector<EInputMode> g_inputModeStack;
|
||||||
|
|
||||||
interface IInput
|
interface IInput: public IInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init( void );
|
virtual void KeyEvent( EInputKey key, EKeyEventType event ) = 0;
|
||||||
static void KeyEvent( EInputKey key, EKeyEventType event );
|
virtual void AxisEvent( EInputAxis axis, float fValue ) = 0;
|
||||||
static void AxisEvent( EInputAxis axis, float fValue );
|
virtual void SetInputMode( EInputMode mode );
|
||||||
static void SetInputMode( EInputMode mode );
|
|
||||||
static void Frame( void );
|
|
||||||
static void Deinit( void );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
IInput *Input();
|
||||||
|
|
||||||
extern float g_fAxisValues[AXIS_NUM_AXIS];
|
extern float g_fAxisValues[AXIS_NUM_AXIS];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "dirent.h"
|
#include "dirent.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "signal.h"
|
#include "signal.h"
|
||||||
#include <dlfcn.h>
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include "dlfcn.h"
|
#include "dlfcn.h"
|
||||||
#include "execinfo.h"
|
#include "execinfo.h"
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "dbghelp.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PLATFORM_INTERFACE void Plat_FatalErrorFunc(const char* szFormat, ...)
|
PLATFORM_INTERFACE void Plat_FatalErrorFunc(const char* szFormat, ...)
|
||||||
{
|
{
|
||||||
va_list list;
|
va_list list;
|
||||||
@@ -136,6 +136,7 @@ PLATFORM_INTERFACE void Plat_Backtrace( void )
|
|||||||
free(symbols);
|
free(symbols);
|
||||||
#endif
|
#endif
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
|
/*
|
||||||
void* buffer[64];
|
void* buffer[64];
|
||||||
USHORT nptrs = CaptureStackBackTrace(0, 64, buffer, NULL);
|
USHORT nptrs = CaptureStackBackTrace(0, 64, buffer, NULL);
|
||||||
|
|
||||||
@@ -160,6 +161,7 @@ PLATFORM_INTERFACE void Plat_Backtrace( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(symbol);
|
free(symbol);
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user