Talk:VGUI HTML Screen In Multiplayer

From Valve Developer Community
Jump to: navigation, search

Link

Hi, nice tut! But how does the link for an entity work? What must i do?

See the end of the singleplayer article --Daedalus 07:39, 11 Jun 2007 (PDT)

Status as of 27 December 2013

I'm using the new version of the SDK, downloaded from github, and notice that the directory structures have changed somewhat, and secondarily I'm getting some diagnostics. I'll add the directory structures first, and an update with what I understand from the diagnostics later.

Directory structure in 2013

vgui_int.cpp lives in source-sdk-2013/mp/src/game/client/vgui_int.cpp (using C++ #include notation). The parent project's IMyPanel.h and MyPanel.cpp live there too. On linux, the makefile, client_linux32_hl2mp.mak, is here as well.

The EntHTML.cpp and .h files live in source-sdk-2013/mp/src/vgui2/vgui_controls, along with the vgui_controls_linux32.mak makefile.


mypanel.res lives in source-sdk-2013/mp/game/mod_hl2mp/resource/UI/mypanel.res GameMenu.res lives in source-sdk-2013/mp/game/mod_hl2mp/resource/GameMenu.res

For Visual Studio 2010, we have the solution "games" at source-sdk-2013/mp/src/games.sln, whcih contains 6 projects, of which the interesting ones are "Client (HL2MP)" and "Server (HL2MP)". As shipped, all 6 build cleanly.

Building in 2013

VC 2013 is not yet supported, one builds the 2013 SDK with VC 2010 after "cloning" a set of files from https://github.com/ValveSoftware/source-sdk-2013

At the moment, detailed steps are subject to review, as I'm getting diagnostics (;-))

With VC 2010 on Windows, add the files to the specified project within gthe "games" solution.

For Linux, we have to modify the makefile (at least one, possibly two) which need the new files added to the "CPPFILES" list. It's convenient to move vgui_int.cpp and any new files to the beginning of the list, which then looks like:

In source-sdk-2013/mp/src/game/client/client_linux32_hl2mp.mak
CPPFILES= \
    vgui_int.cpp \
    HTMLView.cpp \
    EntHTML.cpp \
    ../../common/compiledcaptionswap.cpp \
    ../../common/language.cpp \
    


to the source-sdk-2013/mp/src/game/client/client_linux32_hl2mp.mak, add the following after the vgui_int.cpp recipe:

ifneq (clean, $(findstring clean, $(MAKECMDGOALS)))
-include $(OBJ_DIR)/EntHTML.P
endif

$(OBJ_DIR)/EntHTML.o : $(PWD)/EntHTML.cpp $(PWD)/vgui_controls_linux32.mak $(SRCROOT)/devtools/makefile_base_posix.mak
        $(PRE_COMPILE_FILE)
        $(COMPILE_FILE) $(POST_COMPILE_FILE)
ifneq (clean, $(findstring clean, $(MAKECMDGOALS)))
-include $(OBJ_DIR)/HTMLView.P
endif

$(OBJ_DIR)/HTMLView.o : $(PWD)/HTMLView.cpp $(PWD)/client_linux32_hl2mp.mak $(SRCROOT)/devtools/makefile_base_posix.mak
        $(PRE_COMPILE_FILE)
        $(COMPILE_FILE) $(POST_COMPILE_FILE)

Diagnostics seen thus far

[1] The first set of diagnostics are of the form

    • Error 2error C1083: Cannot open include file: 'EntHTML.h': No such file or directory c:\mysteamsdk\source-sdk-2013\mp\src\game\client\ihtmlview.h 12
    • c:\mysteamsdk\source-sdk-2013\mp\src\game\client\htmlview.cpp(38): fatal error C1083: Cannot open include file: 'EntHTML.h': No such file or directory

This was because I had placed the file in one of the two vgui_controls directories. This didn't work on Linux, so I moved it to the client directory. This avoided having to change the code to say

#include <vgui_controls/EntHTML.h>

in both IHTMLView.h and HTMLView.cpp

[2] A second error was

1>  HTMLView.cpp
1>c:\mysteamsdk\source-sdk-2013\mp\src\game\client\htmlview.cpp(49): error C2664: 'ConVar::ConVar(const char *,const char *,int,const char *,FnChangeCallback_t)' : cannot convert parameter 5 from 'void (__cdecl *)(ConVar *,const char *)' to 'FnChangeCallback_t'
1>          None of the functions with this name in scope match the target type

Casting the final parameter to FnChangeCallback_t stops the diagnostic... The code now says

ConVar cl_htmltarget("cl_htmltarget", "", FCVAR_CLIENTDLL, 
    "Sets the HTML address to <state>.", (FnChangeCallback_t) onTargetUpdate);

[3] Subsequently I receive a less clear error:

1>------ Build started: Project: Client (HL2MP), Configuration: Debug Win32 ------
1>Build started 12/27/2013 2:11:47 PM.
1>InitializeBuildStatus:
1>  Touching ".\Debug_mod_hl2mp\Client (HL2MP).unsuccessfulbuild".
1>CustomBuild:
1>  All outputs are up-to-date.
1>ClCompile:
1>  All outputs are up-to-date.
1>  HTMLView.cpp
1>c:\mysteamsdk\source-sdk-2013\mp\src\game\client\htmlview.cpp(69): error C2259: 'vgui::EntHTML' : cannot instantiate abstract class
1>          due to following members:
1>          'bool vgui::IHTMLEvents::Obsolete_OnStartURL(const char *,const char *,bool)' : is abstract
1>          c:\mysteamsdk\source-sdk-2013\mp\src\public\vgui\ihtml.h(147) : see declaration of 'vgui::IHTMLEvents::Obsolete_OnStartURL'
   ...

Rebuilding on Linux yeilds a similar series of errors, which I can now use to help hunt down the culprit ...*

---- HTMLView.cpp ----
/export/home/other-stuff/source-sdk-2013/mp/src/game/client/HTMLView.cpp: In constructor ‘CHTMLView_Panel::CHTMLView_Panel(vgui::VPANEL)’:
/export/home/other-stuff/source-sdk-2013/mp/src/game/client/HTMLView.cpp:69:48: error: cannot allocate an object of abstract type ‘vgui::EntHTML’
In file included from /export/home/other-stuff/source-sdk-2013/mp/src/game/client/IHTMLView.h:12:0,
                 from /export/home/other-stuff/source-sdk-2013/mp/src/game/client/HTMLView.cpp:27:
/export/home/other-stuff/source-sdk-2013/mp/src/game/client/EntHTML.h:30:7: note:   because the following virtual functions are pure within ‘vgui::EntHTML’: