Skip to content

Instantly share code, notes, and snippets.

@CarloMaker
CarloMaker / Description
Last active October 31, 2015 15:43
Managing game states in Urho3d
/*
This is a simple game state inspired from a good article about managing game states
at http://gamedevgeek.com/tutorials/managing-game-states-in-c/ , i tried to adapt it in Urho3d
using events rather than loops update on virtual methods that kill performance.
*/
gamestateshandler expect a scene already create , you can simply modified as you like,
main.cpp{
{
bool isUrho3dRock = true ;
}
@CarloMaker
CarloMaker / GUIHELPER
Created January 22, 2014 11:27
Simple layout relative position
main(){
//load layout
XMLFile* xmlFile = cache->GetResource<XMLFile>(layoutName);
SharedPtr<UIElement> lay =GetContext()->GetSubsystem<UI>()->LoadLayout(xmlFile);
GetContext()->GetSubsystem<UI>()->GetRoot()->AddChild(lay);
Vector2 resEditor (1920,1080);// this is the resolution used in the editor - could be came from .xml
Vector2 currentResolution (1600,1080); // current resolution from EngineParameters
GuiHelper::ReDraw(lay,resEditor,currentResolution);