// Called by Rocket when it wants to enable or disable scissoring to clip content.		
		void RocketDocument3D::EnableScissorRegion(bool enable)
		{
			Urho3D::Graphics* graphics = GetSubsystem<Urho3D::Graphics>();

			if (enable)
				graphics->SetScissorTest(true, scissors);
			else
				graphics->SetScissorTest(false);
		}
void UrhoRenderer::HandleScreenModeChange(StringHash /*eventType*/, VariantMap& /*eventData*/)
{
    ConfigAPI *config = framework->Config();
    if (!config)
        return;

    HashMap<String, Variant> data;

    Urho3D::Graphics* graphics = GetSubsystem<Urho3D::Graphics>();
    if (graphics)
    {
        data["window position"] = graphics->GetWindowPosition();
        data["window size"] = Urho3D::IntVector2(graphics->GetWidth(), graphics->GetHeight());
        data["window fullscreen"] = graphics->GetFullscreen();
    
        /* Store potentially frequent runtime changes in memory only.
        The changes will be written to disk latest at a clean Framework exit. */
        ConfigFile &f = config->GetFile(ConfigAPI::FILE_FRAMEWORK);
        f.Set(ConfigAPI::SECTION_GRAPHICS, data);
    }
}
		RocketDocument3D::RocketDocument3D(Urho3D::Context* context) :
			Drawable(context, Urho3D::DRAWABLE_GEOMETRY)
		{
			Urho3D::Graphics* graphics = GetSubsystem<Urho3D::Graphics>();

			zorder = 0.f;

			noTextureVS = graphics->GetShader(Urho3D::VS, "Basic", "VERTEXCOLOR");
			noTexturePS = graphics->GetShader(Urho3D::PS, "Basic", "VERTEXCOLOR");

			diffTextureVS = graphics->GetShader(Urho3D::VS, "Basic", "DIFFMAP VERTEXCOLOR");
			diffTexturePS = graphics->GetShader(Urho3D::PS, "Basic", "DIFFMAP VERTEXCOLOR");

			//Urho3D::Material* mat = new Urho3D::Material(context);
			

			_rocketContext = std::shared_ptr<::Rocket::Core::Context>(
				::Rocket::Core::CreateContext("main2",
				::Rocket::Core::Vector2i(graphics->GetWidth(), graphics->GetHeight()),
				this));
			input = new RocketInput(Urho3D::Object::GetContext(), _rocketContext.get());

			::Rocket::Core::FontDatabase::LoadFontFace("Data/Fonts/Delicious-Bold.otf");
			::Rocket::Core::FontDatabase::LoadFontFace("Data/Fonts/Delicious-BoldItalic.otf");
			::Rocket::Core::FontDatabase::LoadFontFace("Data/Fonts/Delicious-Italic.otf");
			::Rocket::Core::FontDatabase::LoadFontFace("Data/Fonts/Delicious-Roman.otf");

			::Rocket::Core::ElementDocument *Document = _rocketContext->LoadDocument("Data/UI/rocketDemo.html");
//			::Rocket::Core::ElementDocument *Document = _rocketContext->LoadDocument("Data/UI/demo.rml");

			if (Document)
			{
				Document->Show();
			};

			SubscribeToEvent(Urho3D::E_UPDATE, HANDLER(RocketDocument3D, HandleUpdate));
			SubscribeToEvent(Urho3D::E_ENDRENDERING, HANDLER(RocketDocument3D, HandlePostRender));
		}
int UrhoRenderer::WindowHeight() const
{
    Urho3D::Graphics* gfx = GetSubsystem<Urho3D::Graphics>();
    return gfx ? gfx->GetHeight() : 0;
}