Difference between revisions of "Talk:VGUI2: Creating a panel"

From Valve Developer Community
Jump to: navigation, search
(Calling the panel)
(solution??)
Line 39: Line 39:
 
  // virtual void OnTick();
 
  // virtual void OnTick();
 
  // virtual void OnCommand(const char* pcCommand);
 
  // virtual void OnCommand(const char* pcCommand);
 +
 +
--no need to comment out virtual void OnTick();. It is required if you will be making a console command to interact with it. --[[User:Brad Newsom|Brad Newsom]] 18:45, 3 Jan 2009 (PST)
  
 
== IMyPanel.h ==
 
== IMyPanel.h ==

Revision as of 02:45, 4 January 2009

Hopefully somebody will reformat the text. Btw.: There is still no <cpp> tag!

Text reformatted. --AiusEpsi 15:19, 3 Jul 2005 (PDT)

There is a <code> tag. MightyMooquack 15:32, 3 Jul 2005 (PDT)
And a cpp tag is much cooler: It has C++ syntax highlighting. Examples: SourceWiki.org --Leon Grapenthin 09:35, 6 Jul 2005 (PDT)
Is SourceWiki down? Because I can't access it anymore --Pon

Has anybody been able to follow this and get it to work? I'm having trouble and getting a error...

MyPanel.cpp(78) : fatal error C1010: unexpected end of file while looking for precompiled header directive

I tried compiling it after the modification to vgui_int.cpp when it says to run the game. Anybody having the same problem or am I just royally screwing up?

Cpchang13

you need to #include "cbase.h" Ts2do

solution??

This is how I solved the previous problem:

fatal error C1010: unexpected end of file while looking for precompiled header directive

  1. name your file CMyPanel.cpp not a MyPanel.cpp
  2. add following headers:

#include "cbase.h"
#include "IMyPanel.h"
using namespace vgui;
#include <vgui/IVGui.h>
#include <vgui_controls/Frame.h>


- comment following virtual functions (there is no implementation??):

// virtual void OnTick();
// virtual void OnCommand(const char* pcCommand);

--no need to comment out virtual void OnTick();. It is required if you will be making a console command to interact with it. --Brad Newsom 18:45, 3 Jan 2009 (PST)

IMyPanel.h

Why IMyPanel.h? Why not just MyPanel.h? Wouldn't it be less confusing if we took out the random insignificant things that make people needlessly wonder "why"? Isn't it best to keep things simple and straight forward? Especialy in tutorials? --Gijimbo 09:02, 1 June 2007 (MDT)

Ok so I'm guessing it's because they were following the "IClientPanel.h" and other "Iblahblah.h" naming conventions. But I still have the same question: why? --Gijimbo 09:20, 1 June 2007 (MDT)

Ok, what's the deal with IMyPanel.h in general, does it just provide a supporting class? Do all panels need an I(nterface)? --TheDistur 21:53, 18 Aug 2007 (PDT)

Basically, it's an include that gives the other source files access to the panel you've created. That's what the extern part is doing - giving any code that #include's the file access to the panel. --Daedalus 02:28, 19 Aug 2007 (PDT)
It just exposes the create(parent) and destroy() functions eh? If I have any more questions can I just shoot an email to the address on your user page? I don't want to talk about what might be obvious to most of you coders forever on the Talk page. --TheDistur 12:50, 19 Aug 2007 (PDT)
Correct. Basically, for a panel to be able to be used, it must be created (mypanel->Create(gameParent);) and to stop memory leaks, destroyed when no longer used.
As to posting further questions, I'd prefer if you asked the questions here, because other people might have exactly the same questions as yourself, and the answers would help them too. --Daedalus 05:32, 20 Aug 2007 (PDT)

Calling the panel

Ok so after following the different bits and pieces of corrections and helps that you guys have offered, I finaly got it to compile. Alas, the game menu was no different and "MyPanel" was nowhere to be found. I have the feeling that the "calling the panel" section is what needs attention; serious attention. If someone who has gotten the tut to work would post their whole modified working vgui_int.cpp file, I wouldn't mind revising the "calling the panel" section to make it more understandable/workable. --Gijimbo 09:08, 1 June 2007 (MDT)

I got the panel to show up but when increase the screen resolution the title of the panel becomes huge. When I open the panel editor it's title and numerous other text areas are huge as well. Any suggestions? I'm guessing it's in one of the res files used. --Gijimbo 10:14, 1 June 2007 (MDT)


Adding mypanel->Create(gameParent);

(This is Inside of Calling the Panel)

Where is this added? It just says "Add it after you include" (which never tells you what to include, I'm assuming were including IMyPanel.h)

Can anyone point me to what line or section it should be added into?

--LordNed