Hello everyone
I’m trying to get a dynamic texture to display in slate. Previously I’ve just been pushing it into the HUD, but that’s a bit useless when you’re not doing PIE.
I found some older examples, I’m wondering if they’re outdated, because I can’t get them to build:
Headers
#include "SlateBasics.h"
#include "SlateBrush.h"
#include "SCompoundWidget.h"
#include "SImage.h"
#include "SSpinningImage.h"
class SPreview : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SPreview)
: _ItemImage(nullptr)
{}
SLATE_ARGUMENT(UTexture2D*, ItemImage)
SLATE_END_ARGS()
/** Constructs this widget. */
void Construct(const FArguments& InArgs);
FSlateBrush ItemBrush;
}
C++
#include "Preview.h"
#include "SlateBasics.h"
#include "SlateBrush.h"
#include "SCompoundWidget.h"
#include "SImage.h"
#include "SSpinningImage.h"
void SPreview::Construct(const FArguments& InArgs)
{
ItemBrush.SetResourceObject(InArgs._ItemImage);
ItemBrush.ImageSize.X = InArgs._ItemImage->GetSurfaceWidth();
ItemBrush.ImageSize.Y = InArgs._ItemImage->GetSurfaceHeight();
ItemBrush.DrawAs = ESlateBrushDrawType::Image;
ChildSlot
SNew(SPreview)
.ItemImage(&ItemBrush)
];
}
Errors
1>c:\program files\epic games\4.8\engine\source\runtime\assetregistry\public\ARFilter.h(6): error C2236: unexpected token 'struct'. Did you forget a ';'?1>c:\program files\epic games\4.8\engine\source\runtime\assetregistry\public\ARFilter.h(7): error C2143: syntax error : missing ';' before '{'
1>c:\program files\epic games\4.8\engine\source\runtime\assetregistry\public\ARFilter.h(7): error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files\epic games\4.8\engine\source\runtime\assetregistry\public\IAssetRegistry.h(79): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\epic games\4.8\engine\source\runtime\assetregistry\public\IAssetRegistry.h(79): error C2143: syntax error : missing ',' before '&'
1>c:\program files\epic games\4.8\engine\source\runtime\assetregistry\public\IAssetRegistry.h(126): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\epic games\4.8\engine\source\runtime\assetregistry\public\IAssetRegistry.h(126): error C2143: syntax error : missing ',' before '&'
What have I done that’s causing engine code to have errors? I have the Slate and SlateCore modules included. I went on to try a bunch of different things and they all cause errors in existing engine code. Argh.