ValveSoftware / source-sdk-2013

The 2013 edition of the Source SDK
https://developer.valvesoftware.com/wiki/SDK2013_GettingStarted
Other
3.7k stars 1.99k forks source link

Problems controlling vgui rendering. #430

Closed Mine228 closed 6 years ago

Mine228 commented 6 years ago

So I've been trying to make it so a vgui hud element that is supposed to be rendered would continue to render when the main menu is displayed. This Element is supposed to work as an in game overlay on the screen when the players is withing the game world. However, it's Paint() function doesn't get called if the main menu is rendered. This seems to mimic the same behaviour that all the other player hud elements perform (like health, crosshairs, suit zoom overlay). I've been trying to track down a way to make it render regardless, but without any results. I've tried to force the Paint() function call within PaintTraverse() inside Panel.cpp, but it doesn't call my desired code.

So I would like to ask if anyone knows a solution to this problem, because at the moment I am left clueless.

thexa4 commented 6 years ago

If you set the parent of the panel to the PANEL_GAMEUIDLL VPANEL pointer you can get from enginevgui->GetPanel it should keep drawing and be visible. You can probably toggle the panel parent depending on what the user does. On Fri, Aug 11, 2017, at 17:49, Mince228 wrote:

So I've been trying to make it so a vgui hud element that is supposed to be rendered would continue to render when the main menu is displayed. This Element is supposed to work as an in game overlay on the screen when the players is withing the game world. However, it's Paint() function doesn't get called if the main menu is rendered. This seems to mimic the same behaviour that all the other player hud elements perform (like health, crosshairs, suit zoom overlay). I've been trying to track down a way to make it render regardless, but without any results. I've tried to force the Paint() function call within PaintTraverse() inside Panel.cpp, but it doesn't call my desired code.> So I would like to ask if anyone knows a solution to this problem, because at the moment I am left clueless.> — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub[1], or mute the thread[2].>

Links:

  1. https://github.com/ValveSoftware/source-sdk-2013/issues/430
  2. https://github.com/notifications/unsubscribe-auth/AASIDLyPMYJBXp5VOYuDLzwu113gItBfks5sXHgcgaJpZM4O008V
Mine228 commented 6 years ago

Thanks a lot for your response. I've tried using PANEL_ROOT and it seems to work exactly like I wanted. The hud element is drawn while the main menu is closed and when its open. Thanks again!

jonnyboy0719 commented 6 years ago

This is similar what I was going to do, thanks for the useful information. 👍

Mine228 commented 6 years ago

Btw, is there a way to control the depth layering of the hud elements? I want to specify which elements should be drawn on top of others.

thexa4 commented 6 years ago

You can use the zpos res file property when you use ApplySettings or the equivalent C++ function. (https://wiki.empiresmod.com/Panel)

kisak-valve commented 6 years ago

Closing as this appears to have been resolved.