Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vgui_support: initial vgui2 support #3

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "vgui-dev"]
path = vgui-dev
url = https://github.com/FWGS/vgui-dev
[submodule "vgui2-dev"]
path = vgui2-dev
url = https://github.com/kungfulon/vgui2-dev.git
1 change: 1 addition & 0 deletions vgui2-dev
Submodule vgui2-dev added at 5fd52f
76 changes: 76 additions & 0 deletions vgui2_gameui.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
vgui2_gameui.cpp - implement IGameUIFuncs for vgui2 support
Copyright (C) 2022 FWGS

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

In addition, as a special exception, the author gives permission
to link the code of this program with VGUI library developed by
Valve, L.L.C ("Valve"). You must obey the GNU General Public License
in all respects for all of the code used other than VGUI library.
If you modify this file, you may extend this exception to your
version of the file, but you are not obligated to do so. If
you do not wish to do so, delete this exception statement
from your version.

*/

#include "vgui2_gameui.h"
#include <vgui_api.h>

namespace vgui_support
{
extern vguiapi_t *g_api;
};

bool GameUIFuncs::IsKeyDown( const char *keyname, bool &isdown )
{
isdown = false;
return false;
}

const char *GameUIFuncs::Key_NameForKey( int keynum )
{
return "";
}

const char *GameUIFuncs::Key_BindingForKey( int keynum )
{
return "";
}

vgui2::KeyCode GameUIFuncs::GetVGUI2KeyCodeForBind( const char *bind )
{
return vgui2::KEY_TAB;
// return ( vgui2::KeyCode )( vgui_support::g_api->KeyForBind( bind ) + 1 );
}

void GameUIFuncs::GetVideoModes( vmode_t **liststart, int *count )
{
}

void GameUIFuncs::GetCurrentVideoMode( int *wide, int *tall, int *bpp )
{
}

void GameUIFuncs::GetCurrentRenderer( char *name, int namelen, int *windowed, int *hdmodels, int *addons_folder, int *vid_level )
{
}

bool GameUIFuncs::IsConnectedToVACSecureServer()
{
return false;
}

int GameUIFuncs::Key_KeyStringToKeyNum( const char *pchKey )
{
return 0;
}
45 changes: 45 additions & 0 deletions vgui2_gameui.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
vgui2_gameui.h - vgui2 GameUIFuncs header
Copyright (C) 2022 FWGS

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

In addition, as a special exception, the author gives permission
to link the code of this program with VGUI library developed by
Valve, L.L.C ("Valve"). You must obey the GNU General Public License
in all respects for all of the code used other than VGUI library.
If you modify this file, you may extend this exception to your
version of the file, but you are not obligated to do so. If
you do not wish to do so, delete this exception statement
from your version.

*/

#ifndef VGUI2_GAMEUI_H
#define VGUI2_GAMEUI_H

#include <IGameUIFuncs.h>

class GameUIFuncs : public IGameUIFuncs
{
public:
virtual bool IsKeyDown( const char *keyname, bool &isdown );
virtual const char *Key_NameForKey( int keynum );
virtual const char *Key_BindingForKey( int keynum );
virtual vgui2::KeyCode GetVGUI2KeyCodeForBind( const char *bind );
virtual void GetVideoModes( vmode_t **liststart, int *count );
virtual void GetCurrentVideoMode( int *wide, int *tall, int *bpp );
virtual void GetCurrentRenderer( char *name, int namelen, int *windowed, int *hdmodels, int *addons_folder, int *vid_level );
virtual bool IsConnectedToVACSecureServer();
virtual int Key_KeyStringToKeyNum( const char *pchKey );
};

#endif // VGUI2_GAMEUI_H
Loading