C++ Usage
Hi, I have downloaded and integrated Noesis in my custom engine. I have been checking the Documentation and the C++ Examples, but I can't find tutorials like the "Common Tutorials" but for C++, like an equivalent that shows you how to do Animations, Render Shapes, etc., but all in C++. I want to try and create a more simple version of the 3D Menu example but from scratch, without a XAML or the Application Framework.
Where can I find some C++ tutorials/examples that shows you how to create a menu like the 3D menu example?
I've created some buttons, text and canvas, but I don't know where to look for animations, change between views (for menu changing when a button is pressed) and upload images.
I hope you can help me.
Where can I find some C++ tutorials/examples that shows you how to create a menu like the 3D menu example?
I've created some buttons, text and canvas, but I don't know where to look for animations, change between views (for menu changing when a button is pressed) and upload images.
I hope you can help me.
Re: C++ Usage
There is no specific documentation for that part. And although this should be straightforward most of the times following the documentation in the C++ headers, don't hesitate to request for help here for specific things. I am adding an internal task here to create a tutorial about this, but this is going to be low priority for now. Also, our API is very similar to C# WPF, so you will find a lot of references and documentation on the internet that probably will be compatible (or almost) with Noesis.
Re: C++ Usage
I see... Thanks for consider the documentation!
To what C++ headers do you refer? The wathever thing I want to do headers?
And Thanks to your reply, I found this animation tutorial in the Microsoft documentation, it is pretty much the same as Noesis! But now I will take your word about ask about specific things.
I have followed the tutorial but the animation is not working, here is the code I wrote:
And in the event that triggers the animation I wrote this:
The Canvas has a solid color background and a view is created from the canvas. A button triggers the event function and works fine, it's just the animation.
Also, I saw in the XAML tutorial that a BeginStoryboard is used, that need to be used in code too?
I hope you can help me again.
Thanks!
To what C++ headers do you refer? The wathever thing I want to do headers?
And Thanks to your reply, I found this animation tutorial in the Microsoft documentation, it is pretty much the same as Noesis! But now I will take your word about ask about specific things.
I have followed the tutorial but the animation is not working, here is the code I wrote:
Code: Select all
Ptr<Canvas> g_pMainCanvas = *new Canvas();
Ptr<TextBlock> g_pTitleText = *new TextBlock;
Ptr<Storyboard> g_pStoryboard = *new Storyboard();
Ptr<DoubleAnimation> g_pDoubleAnim = *new DoubleAnimation();
//The Text is what I want to animate.
g_pTitleText->SetText("My New Game");
g_pTitleText->SetFontSize(100.0f);
g_pTitleText->SetName("TitleName");
//Animation configuration.
g_pDoubleAnim->SetDuration(Duration(TimeSpan(0, 0, 3)));
g_pDoubleAnim->SetFrom(1.0f);
g_pDoubleAnim->SetTo(0.0f);
g_pDoubleAnim->SetRepeatBehavior(RepeatBehavior::Forever());
g_pDoubleAnim->SetAutoReverse(true);
//Storyboard cofiguration.
g_pStoryboard->GetChildren()->Add(g_pDoubleAnim);
g_pStoryboard->SetTargetName(g_pDoubleAnim, g_pTitleText->GetName());
g_pStoryboard->SetTargetProperty(g_pDoubleAnim, new PropertyPath(g_pTitleText->OpacityProperty));
g_pMainCanvas->SetWidth(width);
g_pMainCanvas->SetHeight(height);
g_pMainCanvas->GetChildren()->Add(g_pTitleText);
Code: Select all
void setConfigMenu(Noesis::BaseComponent* obj, const Noesis::RoutedEventArgs& args)
{
g_pStoryboard->Begin();
}
Also, I saw in the XAML tutorial that a BeginStoryboard is used, that need to be used in code too?
I hope you can help me again.
Thanks!
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: C++ Usage
Hi, when creating storyboards in code you have to specify a target to fire the animation. The target is used to search for the namescope required to resolve the target names.
Apart from that I have to clarify that setting the Name property in code for an element is not enough to find it later using FindName. To correctly register an element in the namescope you have to call RegisterName from an element in the UI tree, something like this:
An alternative to avoid using names is to specify the target object directly in the animation:
Hope this helps.
Code: Select all
g_pStoryboard->Begin(g_pTitleText);Code: Select all
layoutRoot->RegisterName("TitleName", g_pTitleText);Code: Select all
Storyboard::SetTarget(g_pDoubleAnim, g_pTitleText);Who is online
Users browsing this forum: No registered users and 3 guests