client/app: KEY_F9: Toggle Urho3D's debug HUD

This commit is contained in:
Perttu Ahola 2014-09-28 15:51:00 +03:00
parent ba42488bf8
commit 23a0df2d19

View File

@ -21,6 +21,8 @@
#include <GraphicsEvents.h> // E_SCREENMODE
#include <IOEvents.h> // E_LOGMESSAGE
#include <Log.h>
#include <DebugHud.h>
#include <XMLFile.h>
#pragma GCC diagnostic pop
extern "C" {
#include <lua.h>
@ -288,6 +290,12 @@ struct CApp: public App, public magic::Application
throw AppStartupError(ss_()+"Failed to load and run extension "+extname);
}
}
// Create debug HUD
magic::ResourceCache *magic_cache = GetSubsystem<magic::ResourceCache>();
magic::DebugHud *dhud = GetSubsystem<magic::Engine>()->CreateDebugHud();
dhud->SetDefaultStyle(magic_cache->GetResource<magic::XMLFile>(
"UI/DefaultStyle.xml"));
}
void on_update(magic::StringHash event_type, magic::VariantMap &event_data)
@ -331,6 +339,10 @@ struct CApp: public App, public magic::Application
log_e(MODULE, "Failed to load and run extension %s", cs(extname));
}
}
if(key == Urho3D::KEY_F9){
magic::DebugHud *dhud = GetSubsystem<magic::Engine>()->CreateDebugHud();
dhud->ToggleAll();
}
}
void on_screenmode(magic::StringHash event_type, magic::VariantMap &event_data)