VGUI ImagePanel: Difference between revisions
Jump to navigation
Jump to search
(New page: An ImagePanel is a vgui2 element defined in the vgui_controls library, in the file ImagePanel.cpp. ImagePanels are available in all source games. An ImagePanel is a simple panel that displ...) |
mNo edit summary |
||
Line 22: | Line 22: | ||
And we're done! | And we're done! | ||
[[Category:VGUI_Controls| | [[Category:VGUI_Controls|I]] |
Revision as of 12:13, 7 June 2009
An ImagePanel is a vgui2 element defined in the vgui_controls library, in the file ImagePanel.cpp. ImagePanels are available in all source games. An ImagePanel is a simple panel that displays an image.
Example Usage
Before creating anything, we first need to include the ImagePanel header file.
#include <vgui_controls/ImagePanel.h>
ImagePanels can be created via the c++ keyword new with a simple call to ImagePanel:
vgui::ImagePanel* imagePanel = new ImagePanel(this, "myPanel");
Once we have our ImagePanel created, we can now add an image to it:
imagePanel->SetImage(scheme()->GetImage("myimage", false));
Its important to note that scheme()->GetImage begins from "materials/vgui" and no extensions should be provided. So, scheme()->GetImage("vgui/eye", false) would really point to "materials/vgui/vgui/eye.vmt".
And we're done!