A few questions about some features
Hi,
As a UI developper in an indie team, I am considering using Noesis GUI for our game project. I've been testing the trial version for a couple of hours now and I have a few questions.
We would like to display UI in 3D scenes (like in the plane demo). It seems quite straightforward in Unity, but I cannot find a tutorial to use the feature using the native SDK. Could you tell me more about it? How does the XamlRenderer fit into the application? Is it possible to make it render to a texture for instance? The integration samples does not show how it works.
Also, we would like to reproduce the behaviour of a window in our game, like an inventory screen we could size and move anywhere on screen. Is there natively a widget performing such operation or would we have to develop it ourselves?
Thank you,
Alexandre.
As a UI developper in an indie team, I am considering using Noesis GUI for our game project. I've been testing the trial version for a couple of hours now and I have a few questions.
We would like to display UI in 3D scenes (like in the plane demo). It seems quite straightforward in Unity, but I cannot find a tutorial to use the feature using the native SDK. Could you tell me more about it? How does the XamlRenderer fit into the application? Is it possible to make it render to a texture for instance? The integration samples does not show how it works.
Also, we would like to reproduce the behaviour of a window in our game, like an inventory screen we could size and move anywhere on screen. Is there natively a widget performing such operation or would we have to develop it ourselves?
Thank you,
Alexandre.
Last edited by ZanAlex on 02 Feb 2015, 15:44, edited 1 time in total.
Re: A few questions about some features
Hi!
Yes, with the Native SDK you can render to texture. You are in charge of binding the target surface before calling us, so you can bind whatever kind of surface, being it the screen, an offscreen-surface, a texture render-target, etc. This is the idea shown in our integration tutorial:
Regarding the draggable window you have a small example in our ShowCase section, it is in C# but the idea is the same for C++, you have to implement the feature yourself although it is straightforward. If you need help just ask for it here.
Yes, with the Native SDK you can render to texture. You are in charge of binding the target surface before calling us, so you can bind whatever kind of surface, being it the screen, an offscreen-surface, a texture render-target, etc. This is the idea shown in our integration tutorial:
Code: Select all
d3dDevice->SetRenderTarget(0, color);
gXamlRenderer->Render(commands.GetPtr());
Re: A few questions about some features
Hi,
You're right Locationeebr, I had other things in mind at the moment, I should have checked out, sorry about that.
Thank you for your answers jsantos.
Regards,
You're right Locationeebr, I had other things in mind at the moment, I should have checked out, sorry about that.
Thank you for your answers jsantos.
Regards,
Last edited by ZanAlex on 02 Feb 2015, 17:06, edited 1 time in total.
Re: A few questions about some features
Hi Zan,
Do not worry about the comments from Locationeebr, it is a spam account. I just disabled it.
Do not worry about the comments from Locationeebr, it is a spam account. I just disabled it.
Re: A few questions about some features
Alright, no problem.
In fact I have another question. I'm trying to create my own UserControl and to use the object in another project. My goal is to encapsulate all the UI-only operation in the dll (called Code-Behind in Noesis documentation if I'm right) and to plug it to the main project. But I keep getting linking error when trying to call CustomControl's method in my main project. I put the .dll next to the .exe, linked the .lib and include the header.
I'm still discovering the API, therefore, I'm probably doing something wrong but I thought maybe you could see what's wrong with my structure. Here is most of the code I wrote for this.
CustomControl.h
Export.cpp
MainProject
Thank you,
Alexandre.
EDIT:
In fact it's even worst than what I thought, I cannot load a xaml file referencing my CustomControl. It crashes and tells me the control is not registered. After a few researches, I realized I forgot to call NsRegisterReflection in my application. But this function is not recognized and I cannot find it anywhere in the headers. Am I missing something?
In fact I have another question. I'm trying to create my own UserControl and to use the object in another project. My goal is to encapsulate all the UI-only operation in the dll (called Code-Behind in Noesis documentation if I'm right) and to plug it to the main project. But I keep getting linking error when trying to call CustomControl's method in my main project. I put the .dll next to the .exe, linked the .lib and include the header.
I'm still discovering the API, therefore, I'm probably doing something wrong but I thought maybe you could see what's wrong with my structure. Here is most of the code I wrote for this.
CustomControl.h
Code: Select all
class CustomControl: public Noesis::Gui::UserControl
{
public:
void SetOnRequest(std::function<void(std::string, std::string, std::string)> inCallback);
void DisplayErrorMsg(const std::string& inError);
void ClearErrorMsg();
void OnClicked(Noesis::Core::BaseComponent* sender, const Noesis::Gui::RoutedEventArgs& e);
private:
std::function<void(std::string, std::string, std::string)> _onRequest;
NS_IMPLEMENT_INLINE_REFLECTION(CustomControl, Noesis::Gui::UserControl)
{
NsMeta<Noesis::Core::TypeId>("CustomControl");
NsString source = "Xaml/CustomControl.xaml";
Noesis::Ptr<Noesis::Gui::UIElementData> data = NsMeta<Noesis::Gui::UIElementData>(Noesis::Core::TypeOf<SelfClass>());
data->OverrideMetadata<NsString>(Noesis::Gui::UserControl::SourceProperty, "Source",
Noesis::Gui::FrameworkPropertyMetadata::Create(source, Noesis::Gui::FrameworkOptions_None));
NsFunc("OnClicked", &CustomControl::OnClicked);
}
}
Code: Select all
extern "C" NS_DLL_EXPORT
void NsRegisterReflection(Noesis::Core::ComponentFactory* factory, NsBool registerComponents)
{
NS_REGISTER_COMPONENT(CustomControl)
}
Code: Select all
#include "CustomControl.h"
Noesis::Ptr<Noesis::FrameworkElement> pXaml = Noesis::GUI::LoadXaml<Noesis::FrameworkElement>("UI.xaml");
Noesis::Ptr<Noesis::IRenderer> pRenderer = Noesis::GUI::CreateRenderer(pXaml .GetPtr());
CustomControl* pCustomC = NsStaticCast<CustomControl*>(pXaml ->FindName("CustomControl"));
if (pCustomC != nullptr)
{
pCustomC ->DisplayErrorMsg(std::string("Test"));
}
Alexandre.
EDIT:
In fact it's even worst than what I thought, I cannot load a xaml file referencing my CustomControl. It crashes and tells me the control is not registered. After a few researches, I realized I forgot to call NsRegisterReflection in my application. But this function is not recognized and I cannot find it anywhere in the headers. Am I missing something?
Re: A few questions about some features
Yes, you must call this function manually. As explained in the Extending Tutorial:Alright, no problem.
In fact it's even worst than what I thought, I cannot load a xaml file referencing my CustomControl. It crashes and tells me the control is not registered. After a few researches, I realized I forgot to call NsRegisterReflection in my application. But this function is not recognized and I cannot find it anywhere in the headers. Am I missing something?
Note that this function is only invoked automatically by NoesisGUI SDK tools, like BuildTool or XamlPlayer. If you are inside your own application you must manually invoke this function after invoking kernel Init() and before InitSystems().
Code: Select all
// Register own classes
NsRegisterReflection(NsGetKernel()->GetComponentFactory(), true);
Re: A few questions about some features
In fact I cannot call NsRegisterReflection, the compiler does not find it. I cannot find this function in the headers I have. Where is it declared? Its only appearance seems to be NsCore/Package.h but including it does not solve the problem.
Re: A few questions about some features
That function is for yourself, noesisGUI does not need it because it loads dynamically the method. So basically you must include it in your own headers and export the function from the dynamic library.
Code: Select all
extern "C" __declspec(dllexport) void NsRegisterReflection(ComponentFactory*, NsBool)
{
/// Register your own components here
}
Re: A few questions about some features
Alright, everything is working as expected, I needed to refresh my memory about dynamic linkage.
Thank you for your help.
Thank you for your help.
Re: A few questions about some features
I am updating the extending tutorial to v1.2 these days. As soon as I have it I will provide you a link to our github repository.
Who is online
Users browsing this forum: Ahrefs [Bot] and 0 guests