Browse Source

Provide vgui stub to avoid dependency of client of vgui lib

asheep
Roman Chistokhodov 7 years ago
parent
commit
51bf51a840
  1. 7
      cl_dll/CMakeLists.txt
  2. 39
      cl_dll/cdll_int.cpp
  3. 108
      utils/false_vgui/include/VGUI.h
  4. 130
      utils/false_vgui/include/VGUI_App.h
  5. 37
      utils/false_vgui/include/VGUI_Bitmap.h
  6. 44
      utils/false_vgui/include/VGUI_Color.h
  7. 57
      utils/false_vgui/include/VGUI_Cursor.h
  8. 194
      utils/false_vgui/include/VGUI_Dar.h
  9. 62
      utils/false_vgui/include/VGUI_Image.h
  10. 126
      utils/false_vgui/include/VGUI_KeyCode.h
  11. 24
      utils/false_vgui/include/VGUI_MouseCode.h
  12. 229
      utils/false_vgui/include/VGUI_Panel.h
  13. 82
      utils/false_vgui/include/VGUI_Scheme.h

7
cl_dll/CMakeLists.txt

@ -28,11 +28,6 @@ set (CLDLL_LIBRARY client) @@ -28,11 +28,6 @@ set (CLDLL_LIBRARY client)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w")
if (GOLDSOURCE_SUPPORT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGOLDSOURCE_SUPPORT -L${CMAKE_CURRENT_SOURCE_DIR}/.. -lSDL2 -Wl,--no-undefined")
if (APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -l:vgui.dylib")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -l:vgui.so")
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
@ -101,7 +96,7 @@ set (CLDLL_SOURCES @@ -101,7 +96,7 @@ set (CLDLL_SOURCES
scoreboard.cpp
MOTD.cpp)
include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public ../utils/vgui/include)
include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public ../utils/false_vgui/include)
if(USE_VOICEMGR)
#set(CLDLL_SOURCES

39
cl_dll/cdll_int.cpp

@ -26,7 +26,6 @@ @@ -26,7 +26,6 @@
#if defined(GOLDSOURCE_SUPPORT) && (defined(_WIN32) || defined(__linux__) || defined(__APPLE__)) && (defined(__i386) || defined(_M_IX86))
#define USE_VGUI_FOR_GOLDSOURCE_SUPPORT
#include "VGUI_Panel.h"
#include "VGUI_BorderLayout.h"
#include "VGUI_App.h"
#endif
@ -197,7 +196,7 @@ public: @@ -197,7 +196,7 @@ public:
static TeamFortressViewport* gViewPort = NULL;
TeamFortressViewport::TeamFortressViewport(int x, int y, int wide, int tall)
TeamFortressViewport::TeamFortressViewport(int x, int y, int wide, int tall) : Panel(x, y, wide, tall)
{
gViewPort = this;
Initialize();
@ -205,14 +204,14 @@ TeamFortressViewport::TeamFortressViewport(int x, int y, int wide, int tall) @@ -205,14 +204,14 @@ TeamFortressViewport::TeamFortressViewport(int x, int y, int wide, int tall)
void TeamFortressViewport::Initialize()
{
vgui::App::getInstance()->setCursorOveride( vgui::App::getInstance()->getScheme()->getCursor(vgui::Scheme::scu_none) );
//vgui::App::getInstance()->setCursorOveride( vgui::App::getInstance()->getScheme()->getCursor(vgui::Scheme::scu_none) );
}
void TeamFortressViewport::paintBackground()
{
int wide, tall;
getParent()->getSize( wide, tall );
setSize( wide, tall );
// int wide, tall;
// getParent()->getSize( wide, tall );
// setSize( wide, tall );
gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
}
@ -239,17 +238,18 @@ int DLLEXPORT HUD_VidInit( void ) @@ -239,17 +238,18 @@ int DLLEXPORT HUD_VidInit( void )
gHUD.VidInit();
#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
vgui::Panel* root=(vgui::Panel*)gEngfuncs.VGui_GetPanel();
root->setBgColor(128,128,0,0);
root->setLayout(new vgui::BorderLayout(0));
if (gViewPort != NULL)
{
gViewPort->Initialize();
}
else
{
gViewPort = new TeamFortressViewport(0,0,root->getWide(),root->getTall());
gViewPort->setParent(root);
if (root) {
root->setBgColor(128,128,0,0);
if (gViewPort != NULL)
{
gViewPort->Initialize();
}
else
{
gViewPort = new TeamFortressViewport(0,0,root->getWide(),root->getTall());
gViewPort->setParent(root);
}
}
#endif
return 1;
@ -332,7 +332,10 @@ Called by engine every frame that client .dll is loaded @@ -332,7 +332,10 @@ Called by engine every frame that client .dll is loaded
void DLLEXPORT HUD_Frame( double time )
{
#ifndef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
if (!gViewPort)
gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
#else
gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
#endif
}

108
utils/false_vgui/include/VGUI.h

@ -0,0 +1,108 @@ @@ -0,0 +1,108 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VGUI_H
#define VGUI_H
//If you are going to add stuff to the vgui core...
//
//Keep it simple.
//
//Never put code in a header.
//
//The name of the class is the name of the the file
//
//Each class gets its own .cpp file for its definition and a .h for its header. Helper
//classes can be used but only within the .cpp and not referenceable from anywhere else.
//
//Don't add unneeded files. Keep the API clean.
//
//No platform specific code in vgui\lib-src\vgui dir. Code in vgui\lib-src\vgui should
//only include from vgui\include or standard C includes. ie, if I see windows.h included
//anywhere but vgui\lib-src\win32 I will hunt you down and kill you. Don't give me any crap
//that mfc is platform inspecific.
//
//Always use <> and not "" for includes
//
//Use minimum dependencies in headers. Don't include another header if you can get away
//with forward declaring (which is usually the case)
//
//No macros in headers. They are tools of satan. This also means no use of DEFINEs, use enum
//
//Minimize global functions
//
//No global variables.
//
//Panel is getting pretty plump, try and avoid adding junk to it if you can
//TODO: Look and Feel support
// add Panel::setPaintProxy, if _paintProxy exists, it calls _paintProxy->paint
// instead of Panel::paint. Components should implement their painting in a seperate
// plugin class. Perhaps to encourage this, Panel::paint should just go away completely
// The other option is to have Panel have the interface Paintable
// class Paintable
// {
// public:
// virtual void paint()=0;
// };
// Then a component can implement its paint in the class itself and then call
// setPaintProxy(this). If this is the case _paintProxy->paint should always be called
// and never Panel::paint from within paintTraverse
//TODO: Figure out the 'Valve' Look and Feel and implement that instead of a the Java one
//TODO: Determine ownership policy for Borders, Layouts, etc..
//TODO: tooltips support
//TODO: ComboKey (hot key support)
//TODO: add Background.cpp, remove paintBackground from all components
// Panel implements setBackground, Panel::paintBackground calls _background->paintBackground
// similiar to the way Border works.
//TODO: Builtin components should never overide paintBackground, only paint
//TODO: All protected members should be converted to private
//TODO: All member variables should be moved to the top of the class prototype
//TODO: All private methods should be prepended with private
//TODO: Use of word internal in method names is not consistent and confusing
//TODO: Cleanup so bullshit publics are properly named, maybe even figure out
// a naming convention for them
//TODO: Breakup InputSignal into logical pieces
//TODO: Button is in a state of disarray, it should have ButtonModel support
//TODO: get rid of all the stupid strdup laziness, convert to vgui_strdup
//TODO: actually figure out policy on String and implement it consistently
//TODO: implement createLayoutInfo for other Layouts than need it
//TODO: BorderLayout should have option for a null LayoutInfo defaulting to center
//TODO: SurfaceBase should go away, put it in Surface
//TODO: ActionSignals and other Signals should just set a flag when they fire.
// then App can come along later and fire all the signals
//TODO: Change all method naming to starting with a capital letter.
#ifdef _WIN32
# define VGUIAPI __declspec( dllexport )
#else
# define VGUIAPI __attribute__ ((visibility("default")))
#include <sys/types.h> // size_t define
#endif
#define null 0L
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
namespace vgui
{
VGUIAPI void vgui_setMalloc(void *(*malloc)(size_t size) );
VGUIAPI void vgui_setFree(void (*free)(void* memblock));
VGUIAPI void vgui_strcpy(char* dst,int dstLen,const char* src);
VGUIAPI char* vgui_strdup(const char* src);
VGUIAPI int vgui_printf(const char* format,...);
VGUIAPI int vgui_dprintf(const char* format,...);
VGUIAPI int vgui_dprintf2(const char* format,...);
}
#endif

130
utils/false_vgui/include/VGUI_App.h

@ -0,0 +1,130 @@ @@ -0,0 +1,130 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VGUI_APP_H
#define VGUI_APP_H
#include<VGUI.h>
#include<VGUI_MouseCode.h>
#include<VGUI_KeyCode.h>
#include<VGUI_Dar.h>
#include<VGUI_Cursor.h>
namespace vgui
{
class Panel;
class TickSignal;
class Scheme;
class TickSignal;
class SurfaceBase;
class VGUIAPI App
{
public:
App() {}
App(bool externalMain) {}
public:
static App* getInstance() {return 0;}
//TODO: the public and public bullshit are all messed up, need to organize
//TODO: actually all of the access needs to be properly thought out while you are at it
public:
virtual void start() {}
virtual void stop() {}
virtual void externalTick() {}
virtual bool wasMousePressed(MouseCode code,Panel* panel) {return false;}
virtual bool wasMouseDoublePressed(MouseCode code,Panel* panel) {return false;}
virtual bool isMouseDown(MouseCode code,Panel* panel) {return false;}
virtual bool wasMouseReleased(MouseCode code,Panel* panel) {return false;}
virtual bool wasKeyPressed(KeyCode code,Panel* panel) {return false;}
virtual bool isKeyDown(KeyCode code,Panel* panel) {return false;}
virtual bool wasKeyTyped(KeyCode code,Panel* panel) {return false;}
virtual bool wasKeyReleased(KeyCode code,Panel* panel) {return false;}
virtual void addTickSignal(TickSignal* s) {}
virtual void setCursorPos(int x,int y) {}
virtual void getCursorPos(int& x,int& y) {}
virtual void setMouseCapture(Panel* panel) {}
virtual void setMouseArena(int x0,int y0,int x1,int y1,bool enabled) {}
virtual void setMouseArena(Panel* panel) {}
virtual void requestFocus(Panel* panel) {}
virtual Panel* getFocus() {return 0;}
virtual void repaintAll() {}
virtual void setScheme(Scheme* scheme) {}
virtual Scheme* getScheme() {return 0;}
virtual void enableBuildMode() {}
virtual long getTimeMillis() {return 0;}
virtual char getKeyCodeChar(KeyCode code,bool shifted) {return '\0';}
virtual void getKeyCodeText(KeyCode code,char* buf,int buflen) {}
virtual int getClipboardTextCount() {return 0;}
virtual void setClipboardText(const char* text,int textLen) {}
virtual int getClipboardText(int offset,char* buf,int bufLen) {return 0;}
virtual void reset() {}
virtual void internalSetMouseArena(int x0,int y0,int x1,int y1,bool enabled) {}
virtual bool setRegistryString(const char* key,const char* value) {return false;}
virtual bool getRegistryString(const char* key,char* value,int valueLen) {return false;}
virtual bool setRegistryInteger(const char* key,int value) {return false;}
virtual bool getRegistryInteger(const char* key,int& value) {return false;}
virtual void setCursorOveride(Cursor* cursor) {}
virtual Cursor* getCursorOveride() {return 0;}
virtual void setMinimumTickMillisInterval(int interval) {}
public: //bullshit public stuff
virtual void main(int argc,char* argv[])=0;
virtual void run() {}
virtual void internalCursorMoved(int x,int y,SurfaceBase* surfaceBase) {} //expects input in surface space
virtual void internalMousePressed(MouseCode code,SurfaceBase* surfaceBase) {}
virtual void internalMouseDoublePressed(MouseCode code,SurfaceBase* surfaceBase) {}
virtual void internalMouseReleased(MouseCode code,SurfaceBase* surfaceBase) {}
virtual void internalMouseWheeled(int delta,SurfaceBase* surfaceBase) {}
virtual void internalKeyPressed(KeyCode code,SurfaceBase* surfaceBase) {}
virtual void internalKeyTyped(KeyCode code,SurfaceBase* surfaceBase) {}
virtual void internalKeyReleased(KeyCode code,SurfaceBase* surfaceBase) {}
private:
virtual void init() {}
virtual void updateMouseFocus(int x,int y,SurfaceBase* surfaceBase) {}
virtual void setMouseFocus(Panel* newMouseFocus) {}
protected:
virtual void surfaceBaseCreated(SurfaceBase* surfaceBase) {}
virtual void surfaceBaseDeleted(SurfaceBase* surfaceBase) {}
virtual void platTick() {}
virtual void internalTick() {}
protected:
static App* _instance;
protected:
bool _running;
bool _externalMain;
Dar<SurfaceBase*> _surfaceBaseDar;
Panel* _keyFocus;
Panel* _oldMouseFocus;
Panel* _mouseFocus;
Panel* _mouseCapture;
Panel* _wantedKeyFocus;
bool _mousePressed[MOUSE_LAST];
bool _mouseDoublePressed[MOUSE_LAST];
bool _mouseDown[MOUSE_LAST];
bool _mouseReleased[MOUSE_LAST];
bool _keyPressed[KEY_LAST];
bool _keyTyped[KEY_LAST];
bool _keyDown[KEY_LAST];
bool _keyReleased[KEY_LAST];
Dar<TickSignal*> _tickSignalDar;
Scheme* _scheme;
bool _buildMode;
bool _wantedBuildMode;
Panel* _mouseArenaPanel;
Cursor* _cursor[Cursor::dc_last];
Cursor* _cursorOveride;
private:
long _nextTickMillis;
long _minimumTickMillisInterval;
friend class SurfaceBase;
};
}
#endif

37
utils/false_vgui/include/VGUI_Bitmap.h

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VGUI_BITMAP_H
#define VGUI_BITMAP_H
#include<VGUI.h>
#include<VGUI_Image.h>
namespace vgui
{
class Panel;
class VGUIAPI Bitmap : public Image
{
private:
int _id;
bool _uploaded;
public:
Bitmap() {}
protected:
virtual void setSize(int wide,int tall) {}
virtual void setRGBA(int x,int y,uchar r,uchar g,uchar b,uchar a) {}
public:
virtual void paint(Panel* panel) {}
protected:
uchar* _rgba;
};
}
#endif

44
utils/false_vgui/include/VGUI_Color.h

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VGUI_COLOR_H
#define VGUI_COLOR_H
#include<VGUI.h>
#include<VGUI_Scheme.h>
//TODO: rename getColor(r,g,b,a) to getRGBA(r,g,b,a)
//TODO: rename setColor(r,g,b,a) to setRGBA(r,g,b,a)
//TODO: rename getColor(sc) to getSchemeColor(sc)
//TODO: rename setColor(sc) to setSchemeColor(sc)
namespace vgui
{
class VGUIAPI Color
{
private:
uchar _color[4];
Scheme::SchemeColor _schemeColor;
public:
Color() {}
Color(int r,int g,int b,int a) {}
Color(Scheme::SchemeColor sc) {}
private:
virtual void init() {}
public:
virtual void setColor(int r,int g,int b,int a) {}
virtual void setColor(Scheme::SchemeColor sc) {}
virtual void getColor(int& r,int& g,int& b,int& a) {}
virtual void getColor(Scheme::SchemeColor& sc) {}
virtual int operator[](int index) {return 0;}
};
}
#endif

57
utils/false_vgui/include/VGUI_Cursor.h

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VGUI_CURSOR_H
#define VGUI_CURSOR_H
#include<VGUI.h>
namespace vgui
{
class Bitmap;
class VGUIAPI Cursor
{
public:
enum DefaultCursor
{
dc_user,
dc_none,
dc_arrow,
dc_ibeam,
dc_hourglass,
dc_crosshair,
dc_up,
dc_sizenwse,
dc_sizenesw,
dc_sizewe,
dc_sizens,
dc_sizeall,
dc_no,
dc_hand,
dc_last
};
private:
int _hotspot[2];
Bitmap* _bitmap;
DefaultCursor _dc;
public:
Cursor(DefaultCursor dc) {}
Cursor(Bitmap* bitmap,int hotspotX,int hotspotY) {}
public:
virtual void getHotspot(int& x,int& y) {}
private:
virtual void privateInit(Bitmap* bitmap,int hotspotX,int hotspotY) {}
public:
virtual Bitmap* getBitmap() {return 0;}
virtual DefaultCursor getDefaultCursor() {return dc_none;}
};
}
#endif

194
utils/false_vgui/include/VGUI_Dar.h

@ -0,0 +1,194 @@ @@ -0,0 +1,194 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VGUI_DAR_H
#define VGUI_DAR_H
#include<stdlib.h>
#include<string.h>
#include<VGUI.h>
namespace vgui
{
//Simple lightweight dynamic array implementation
template<class ELEMTYPE> class VGUIAPI Dar
{
public:
Dar()
{
_count=0;
_capacity=0;
_data=null;
ensureCapacity(4);
}
Dar(int initialCapacity)
{
_count=0;
_capacity=0;
_data=null;
ensureCapacity(initialCapacity);
}
public:
void ensureCapacity(int wantedCapacity)
{
if(wantedCapacity<=_capacity){return;}
//double capacity until it is >= wantedCapacity
//this could be done with math, but iterative is just so much more fun
int newCapacity=_capacity;
if(newCapacity==0){newCapacity=1;}
while(newCapacity<wantedCapacity){newCapacity*=2;}
//allocate and zero newData
ELEMTYPE* newData=new ELEMTYPE[newCapacity];
if(newData==null){exit(0);return;}
memset(newData,0,sizeof(ELEMTYPE)*newCapacity);
_capacity=newCapacity;
//copy data into newData
for(int i=0;i<_count;i++){newData[i]=_data[i];}
delete[] _data;
_data=newData;
}
void setCount(int count)
{
if((count<0)||(count>_capacity))
{
return;
}
_count=count;
}
int getCount()
{
return _count;
}
void addElement(ELEMTYPE elem)
{
ensureCapacity(_count+1);
_data[_count]=elem;
_count++;
}
bool hasElement(ELEMTYPE elem)
{
for(int i=0;i<_count;i++)
{
if(_data[i]==elem)
{
return true;
}
}
return false;
}
void putElement(ELEMTYPE elem)
{
if(hasElement(elem))
{
return;
}
addElement(elem);
}
void insertElementAt(ELEMTYPE elem,int index)
{
if((index<0)||(index>_count))
{
return;
}
if((index==_count)||(_count==0))
{
addElement(elem);
}
else
{
addElement(elem); //just to make sure it is big enough
for(int i=_count-1;i>index;i--)
{
_data[i]=_data[i-1];
}
_data[index]=elem;
}
}
void setElementAt(ELEMTYPE elem,int index)
{
if((index<0)||(index>=_count))
{
return;
}
_data[index]=elem;
}
void removeElementAt(int index)
{
if((index<0)||(index>=_count))
{
return;
}
//slide everything to the right of index, left one.
for(int i=index;i<(_count-1);i++)
{
_data[i]=_data[i+1];
}
_count--;
}
void removeElement(ELEMTYPE elem)
{
for(int i=0;i<_count;i++)
{
if(_data[i]==elem)
{
removeElementAt(i);
break;
}
}
}
void removeAll()
{
_count=0;
}
ELEMTYPE operator[](int index)
{
if((index<0)||(index>=_count))
{
return null;
}
return _data[index];
}
protected:
int _count;
int _capacity;
ELEMTYPE* _data;
};
#ifdef _WIN32
//forward referencing all the template types used so they get exported
template class VGUIAPI Dar<char>;
template class VGUIAPI Dar<char*>;
template class VGUIAPI Dar<int>;
template class VGUIAPI Dar<class Button*>;
template class VGUIAPI Dar<class SurfaceBase*>;
template class VGUIAPI Dar<class InputSignal*>;
template class VGUIAPI Dar<class FocusChangeSignal*>;
template class VGUIAPI Dar<class FrameSignal*>;
template class VGUIAPI Dar<class ActionSignal*>;
template class VGUIAPI Dar<class IntChangeSignal*>;
template class VGUIAPI Dar<class TickSignal*>;
template class VGUIAPI Dar<class Dar<char>*>;
template class VGUIAPI Dar<class Frame*>;
template class VGUIAPI Dar<class DesktopIcon*>;
template class VGUIAPI Dar<class ChangeSignal*>;
template class VGUIAPI Dar<class Panel*>;
template class VGUIAPI Dar<class Label*>;
template class VGUIAPI Dar<class RepaintSignal*>;
#endif
}
#endif

62
utils/false_vgui/include/VGUI_Image.h

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VGUI_IMAGE_H
#define VGUI_IMAGE_H
#include<VGUI.h>
#include<VGUI_Scheme.h>
#include<VGUI_Color.h>
//TODO:: needs concept of insets
namespace vgui
{
class Panel;
class VGUIAPI Image
{
friend class Panel;
private:
int _pos[2];
int _size[2];
Panel* _panel;
Color _color;
public:
Image();
public:
virtual void setPos(int x,int y) {}
virtual void getPos(int& x,int& y) {}
virtual void getSize(int& wide,int& tall) {}
virtual void setColor(Color color) {}
virtual void getColor(Color& color) {}
protected:
virtual void setSize(int wide,int tall) {}
virtual void drawSetColor(Scheme::SchemeColor sc) {}
virtual void drawSetColor(int r,int g,int b,int a) {}
virtual void drawFilledRect(int x0,int y0,int x1,int y1) {}
virtual void drawOutlinedRect(int x0,int y0,int x1,int y1) {}
virtual void drawSetTextFont(Scheme::SchemeFont sf) {}
virtual void drawSetTextFont(Font* font) {}
virtual void drawSetTextColor(Scheme::SchemeColor sc) {}
virtual void drawSetTextColor(int r,int g,int b,int a) {}
virtual void drawSetTextPos(int x,int y) {}
virtual void drawPrintText(const char* str,int strlen) {}
virtual void drawPrintText(int x,int y,const char* str,int strlen) {}
virtual void drawPrintChar(char ch) {}
virtual void drawPrintChar(int x,int y,char ch) {}
virtual void drawSetTextureRGBA(int id,const char* rgba,int wide,int tall) {}
virtual void drawSetTexture(int id) {}
virtual void drawTexturedRect(int x0,int y0,int x1,int y1) {}
virtual void paint(Panel* panel) {}
public:
virtual void doPaint(Panel* panel) {}
};
}
#endif

126
utils/false_vgui/include/VGUI_KeyCode.h

@ -0,0 +1,126 @@ @@ -0,0 +1,126 @@
//========= Copyright Š 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VGUI_KEYCODE_H
#define VGUI_KEYCODE_H
#include<VGUI.h>
namespace vgui
{
enum VGUIAPI KeyCode
{
KEY_0=0,
KEY_1,
KEY_2,
KEY_3,
KEY_4,
KEY_5,
KEY_6,
KEY_7,
KEY_8,
KEY_9,
KEY_A,
KEY_B,
KEY_C,
KEY_D,
KEY_E,
KEY_F,
KEY_G,
KEY_H,
KEY_I,
KEY_J,
KEY_K,
KEY_L,
KEY_M,
KEY_N,
KEY_O,
KEY_P,
KEY_Q,
KEY_R,
KEY_S,
KEY_T,
KEY_U,
KEY_V,
KEY_W,
KEY_X,
KEY_Y,
KEY_Z,
KEY_PAD_0,
KEY_PAD_1,
KEY_PAD_2,
KEY_PAD_3,
KEY_PAD_4,
KEY_PAD_5,
KEY_PAD_6,
KEY_PAD_7,
KEY_PAD_8,
KEY_PAD_9,
KEY_PAD_DIVIDE,
KEY_PAD_MULTIPLY,
KEY_PAD_MINUS,
KEY_PAD_PLUS,
KEY_PAD_ENTER,
KEY_PAD_DECIMAL,
KEY_LBRACKET,
KEY_RBRACKET,
KEY_SEMICOLON,
KEY_APOSTROPHE,
KEY_BACKQUOTE,
KEY_COMMA,
KEY_PERIOD,
KEY_SLASH,
KEY_BACKSLASH,
KEY_MINUS,
KEY_EQUAL,
KEY_ENTER,
KEY_SPACE,
KEY_BACKSPACE,
KEY_TAB,
KEY_CAPSLOCK,
KEY_NUMLOCK,
KEY_ESCAPE,
KEY_SCROLLLOCK,
KEY_INSERT,
KEY_DELETE,
KEY_HOME,
KEY_END,
KEY_PAGEUP,
KEY_PAGEDOWN,
KEY_BREAK,
KEY_LSHIFT,
KEY_RSHIFT,
KEY_LALT,
KEY_RALT,
KEY_LCONTROL,
KEY_RCONTROL,
KEY_LWIN,
KEY_RWIN,
KEY_APP,
KEY_UP,
KEY_LEFT,
KEY_DOWN,
KEY_RIGHT,
KEY_F1,
KEY_F2,
KEY_F3,
KEY_F4,
KEY_F5,
KEY_F6,
KEY_F7,
KEY_F8,
KEY_F9,
KEY_F10,
KEY_F11,
KEY_F12,
KEY_LAST
};
}
#endif

24
utils/false_vgui/include/VGUI_MouseCode.h

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VGUI_MOUSECODE_H
#define VGUI_MOUSECODE_H
#include<VGUI.h>
namespace vgui
{
enum VGUIAPI MouseCode
{
MOUSE_LEFT=0,
MOUSE_RIGHT,
MOUSE_MIDDLE,
MOUSE_LAST
};
}
#endif

229
utils/false_vgui/include/VGUI_Panel.h

@ -0,0 +1,229 @@ @@ -0,0 +1,229 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VGUI_PANEL_H
#define VGUI_PANEL_H
/*
TODO:
Maybe have the border know who they are added to.
A border can only be added to 1 thing, and will be
removed from the other. That way they can actually
be memory managed. Also do Layout's this way too.
TODO:
outlinedRect should have a thickness arg
*/
#include<VGUI.h>
#include<VGUI_Dar.h>
#include<VGUI_Scheme.h>
#include<VGUI_Color.h>
#include<VGUI_Cursor.h>
#include <VGUI_MouseCode.h>
#include <VGUI_KeyCode.h>
//#include <VGUI_RepaintSignal.h>
namespace vgui
{
enum KeyCode;
enum MouseCode;
class SurfaceBase;
class FocusChangeSignal;
class InputSignal;
class Cursor;
class Layout;
class FocusNavGroup;
class Border;
class Font;
class BuildGroup;
class App;
class LayoutInfo;
class RepaintSignal;
class VGUIAPI Panel
{
public:
Panel() {}
Panel(int x,int y,int wide,int tall) {setPos(x, y); setSize(wide, tall);}
private:
void init(int x,int y,int wide,int tall) {}
public:
virtual void setPos(int x,int y) {_pos[0] = x; _pos[1] = y;}
virtual void getPos(int& x,int& y) {x = _pos[0]; y = _pos[1];}
virtual void setSize(int wide,int tall) {_size[0] = wide, _size[1] = tall;}
virtual void getSize(int& wide,int& tall) {wide = _size[0], tall = _size[1];}
virtual void setBounds(int x,int y,int wide,int tall) {}
virtual void getBounds(int& x,int& y,int& wide,int& tall) {}
virtual int getWide() {return _size[0];}
virtual int getTall() {return _size[1];}
virtual Panel* getParent() {return _parent;}
virtual void setVisible(bool state) {_visible = state;}
virtual bool isVisible() {return _visible;}
virtual bool isVisibleUp() {return false;}
virtual void repaint() {}
virtual void repaintAll() {}
virtual void getAbsExtents(int& x0,int& y0,int& x1,int& y1) {}
virtual void getClipRect(int& x0,int& y0,int& x1,int& y1) {}
virtual void setParent(Panel* newParent) {_parent = newParent; newParent->addChild(this);}
virtual void addChild(Panel* child) {}
virtual void insertChildAt(Panel* child,int index) {}
virtual void removeChild(Panel* child) {}
virtual bool wasMousePressed(MouseCode code) {return false;}
virtual bool wasMouseDoublePressed(MouseCode code) {return false;}
virtual bool isMouseDown(MouseCode code) {return false;}
virtual bool wasMouseReleased(MouseCode code) {return false;}
virtual bool wasKeyPressed(KeyCode code) {return false;}
virtual bool isKeyDown(KeyCode code) {return false;}
virtual bool wasKeyTyped(KeyCode code) {return false;}
virtual bool wasKeyReleased(KeyCode code) {return false;}
virtual void addInputSignal(InputSignal* s) {}
virtual void removeInputSignal(InputSignal* s) {}
virtual void addRepaintSignal(RepaintSignal* s) {}
virtual void removeRepaintSignal(RepaintSignal* s) {}
virtual bool isWithin(int x,int y) {return false;} //in screen space
virtual Panel* isWithinTraverse(int x,int y) {return 0;}
virtual void localToScreen(int& x,int& y) {}
virtual void screenToLocal(int& x,int& y) {}
virtual void setCursor(Cursor* cursor) {}
virtual void setCursor(Scheme::SchemeCursor scu) {}
virtual Cursor* getCursor() {return 0;}
virtual void setMinimumSize(int wide,int tall) {}
virtual void getMinimumSize(int& wide,int& tall) {}
virtual void requestFocus() {}
virtual bool hasFocus() {return false;}
virtual int getChildCount() {return 0;}
virtual Panel* getChild(int index) {return 0;}
virtual void setLayout(Layout* layout) {}
virtual void invalidateLayout(bool layoutNow) {}
virtual void setFocusNavGroup(FocusNavGroup* focusNavGroup) {}
virtual void requestFocusPrev() {}
virtual void requestFocusNext() {}
virtual void addFocusChangeSignal(FocusChangeSignal* s) {}
virtual bool isAutoFocusNavEnabled() {return false;}
virtual void setAutoFocusNavEnabled(bool state) {}
virtual void setBorder(Border* border) {}
virtual void setPaintBorderEnabled(bool state) {}
virtual void setPaintBackgroundEnabled(bool state) {}
virtual void setPaintEnabled(bool state) {}
virtual void getInset(int& left,int& top,int& right,int& bottom) {}
virtual void getPaintSize(int& wide,int& tall) {}
virtual void setPreferredSize(int wide,int tall) {}
virtual void getPreferredSize(int& wide,int& tall) {}
virtual SurfaceBase* getSurfaceBase() {return 0;}
virtual bool isEnabled() {return _enabled = false;}
virtual void setEnabled(bool state) {_enabled = true;}
virtual void setBuildGroup(BuildGroup* buildGroup,const char* panelPersistanceName) {}
virtual bool isBuildGroupEnabled() {return false;}
virtual void removeAllChildren() {}
virtual void repaintParent() {}
virtual Panel* createPropertyPanel() {return 0;}
virtual void getPersistanceText(char* buf,int bufLen) {}
virtual void applyPersistanceText(const char* buf) {}
virtual void setFgColor(Scheme::SchemeColor sc) {}
virtual void setBgColor(Scheme::SchemeColor sc) {}
virtual void setFgColor(int r,int g,int b,int a) {}
virtual void setBgColor(int r,int g,int b,int a) {}
virtual void getFgColor(int& r,int& g,int& b,int& a) {}
virtual void getBgColor(int& r,int& g,int& b,int& a) {}
virtual void setBgColor(Color color) {}
virtual void setFgColor(Color color) {}
virtual void getBgColor(Color& color) {}
virtual void getFgColor(Color& color) {}
virtual void setAsMouseCapture(bool state) {}
virtual void setAsMouseArena(bool state) {}
virtual App* getApp() {return 0;}
virtual void getVirtualSize(int& wide,int& tall) {}
virtual void setLayoutInfo(LayoutInfo* layoutInfo) {}
virtual LayoutInfo* getLayoutInfo() {return 0;}
virtual bool isCursorNone() {return false;}
public: //bullshit public
virtual void solveTraverse() {}
virtual void paintTraverse() {}
virtual void setSurfaceBaseTraverse(SurfaceBase* surfaceBase) {}
protected:
virtual void performLayout() {}
virtual void internalPerformLayout() {}
virtual void drawSetColor(Scheme::SchemeColor sc) {}
virtual void drawSetColor(int r,int g,int b,int a) {}
virtual void drawFilledRect(int x0,int y0,int x1,int y1) {}
virtual void drawOutlinedRect(int x0,int y0,int x1,int y1) {}
virtual void drawSetTextFont(Scheme::SchemeFont sf) {}
virtual void drawSetTextFont(Font* font) {}
virtual void drawSetTextColor(Scheme::SchemeColor sc) {}
virtual void drawSetTextColor(int r,int g,int b,int a) {}
virtual void drawSetTextPos(int x,int y) {}
virtual void drawPrintText(const char* str,int strlen) {}
virtual void drawPrintText(int x,int y,const char* str,int strlen) {}
virtual void drawPrintChar(char ch) {}
virtual void drawPrintChar(int x,int y,char ch) {}
virtual void drawSetTextureRGBA(int id,const char* rgba,int wide,int tall) {}
virtual void drawSetTexture(int id) {}
virtual void drawTexturedRect(int x0,int y0,int x1,int y1) {}
virtual void solve() {}
virtual void paintTraverse(bool repaint) {if(repaint) paintBackground();}
virtual void paintBackground() {}
virtual void paint() {}
virtual void paintBuildOverlay() {}
virtual void internalCursorMoved(int x,int y) {}
virtual void internalCursorEntered() {}
virtual void internalCursorExited() {}
virtual void internalMousePressed(MouseCode code) {}
virtual void internalMouseDoublePressed(MouseCode code) {}
virtual void internalMouseReleased(MouseCode code) {}
virtual void internalMouseWheeled(int delta) {}
virtual void internalKeyPressed(KeyCode code) {}
virtual void internalKeyTyped(KeyCode code) {}
virtual void internalKeyReleased(KeyCode code) {}
virtual void internalKeyFocusTicked() {}
virtual void internalFocusChanged(bool lost) {}
virtual void internalSetCursor() {}
protected:
int _pos[2];
int _size[2];
int _loc[2];
int _minimumSize[2];
int _preferredSize[2];
Dar<Panel*> _childDar;
Panel* _parent;
SurfaceBase* _surfaceBase;
Dar<InputSignal*> _inputSignalDar;
Dar<RepaintSignal*> _repaintSignalDar;
int _clipRect[4];
Cursor* _cursor;
Scheme::SchemeCursor _schemeCursor;
bool _visible;
Layout* _layout;
bool _needsLayout;
FocusNavGroup* _focusNavGroup;
Dar<FocusChangeSignal*> _focusChangeSignalDar;
bool _autoFocusNavEnabled;
Border* _border;
private:
bool _needsRepaint;
bool _enabled;
BuildGroup* _buildGroup;
Color _fgColor;
Color _bgColor;
LayoutInfo* _layoutInfo;
bool _paintBorderEnabled;
bool _paintBackgroundEnabled;
bool _paintEnabled;
friend class Panel;
friend class App;
friend class SurfaceBase;
friend class Image;
};
}
#endif

82
utils/false_vgui/include/VGUI_Scheme.h

@ -0,0 +1,82 @@ @@ -0,0 +1,82 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VGUI_SCHEME_H
#define VGUI_SCHEME_H
#include<VGUI.h>
namespace vgui
{
class Font;
class Cursor;
class VGUIAPI Scheme
{
public:
enum SchemeColor
{
sc_user=0,
sc_black,
sc_white,
sc_primary1,
sc_primary2,
sc_primary3,
sc_secondary1,
sc_secondary2,
sc_secondary3,
sc_last
};
enum SchemeFont
{
sf_user=0,
sf_primary1,
sf_primary2,
sf_primary3,
sf_secondary1,
sf_last
};
enum SchemeCursor
{
scu_user=0,
scu_none,
scu_arrow,
scu_ibeam,
scu_hourglass,
scu_crosshair,
scu_up,
scu_sizenwse,
scu_sizenesw,
scu_sizewe,
scu_sizens,
scu_sizeall,
scu_no,
scu_hand,
scu_last
};
public:
Scheme() {}
public:
virtual void setColor(SchemeColor sc,int r,int g,int b,int a) {}
virtual void getColor(SchemeColor sc,int& r,int& g,int& b,int& a) {}
virtual void setFont(SchemeFont sf,Font* font) {}
virtual Font* getFont(SchemeFont sf) {return 0;}
virtual void setCursor(SchemeCursor sc,Cursor* cursor) {}
virtual Cursor* getCursor(SchemeCursor sc) {return 0;}
protected:
int _color[sc_last][4];
Font* _font[sf_last];
Cursor* _cursor[scu_last];
friend class Panel;
friend class Canvas;
};
}
#endif
Loading…
Cancel
Save