Skip to content

Instantly share code, notes, and snippets.

@nobolu-ootsuka-unrealengine
Created June 9, 2019 08:42
Show Gist options
  • Save nobolu-ootsuka-unrealengine/ddb8d5488f0b533c644690ab2cad8ac9 to your computer and use it in GitHub Desktop.
Save nobolu-ootsuka-unrealengine/ddb8d5488f0b533c644690ab2cad8ac9 to your computer and use it in GitHub Desktop.
MyPluginStyle.h
#pragma once
#include "UnrealEd.h"
#include "SlateStyle.h"
#define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush(RootToContentDir(RelativePath, TEXT(".png")), __VA_ARGS__)
class FMyPluginStyle : public FSlateStyleSet
{
public:
FMyPluginStyle()
: FSlateStyleSet("MyPluginStyle")
{
SetContentRoot(FPaths::GamePluginsDir() / TEXT("Developer/MyPlugin/Content"));
Set("MenuIcon", new IMAGE_BRUSH("menu_icon", FVector2D(16.f, 16.f)));
Set("ButtonImage", new IMAGE_BRUSH("button", FVector2D(80.f, 80.f)));
FSlateStyleRegistry::RegisterSlateStyle(*this);
}
~FMyPluginStyle()
{
FSlateStyleRegistry::UnRegisterSlateStyle(*this);
}
};
#undef IMAGE_BRUSH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment