zhangyi
Topic Author
Posts: 9
Joined: 09 Jul 2016, 09:31

Is there a iOS demo available?

11 Jul 2016, 10:16

Hi all:
I am trying to use noesis-gui in my project, that is an ogre project in iOS platform.
I can't find a available demo or sample for iOS platform , other than some code piece in noesis tutorial.
So is there anyone to give me a suggestion or to send me a demo?
Any idea is welcome!
By the way, my email is *******************.
Thanks!
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Is there a iOS demo available?

11 Jul 2016, 10:23

You can find a full iOS integration sample at

https://github.com/Noesis/Tutorials/tre ... ration/iOS

But you will need a trial of noesisGUI for testing it. Please, contact us in private for that.

Thanks!
 
zhangyi
Topic Author
Posts: 9
Joined: 09 Jul 2016, 09:31

Re: Is there a iOS demo available?

12 Jul 2016, 11:46

Thanks for your reply!
I have sent a email to [email protected] to request a newest trial version of noesisgui.
I have tried to study the iOS integration sample,
and i find nothing about event handling, such as touch response and register event.
Does this sample include the part of event handling in iOS platform?

Thanks!
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Is there a iOS demo available?

12 Jul 2016, 15:11

I have sent a email to [email protected] to request a newest trial version of noesisgui.
We have not received any email yet.
I have tried to study the iOS integration sample,
and i find nothing about event handling, such as touch response and register event.
Does this sample include the part of event handling in iOS platform?
I am analyzing the iOS integration sample and effectively is not sending touch events to the renderer. It is very easy, you basically must use the following functions from the IRenderer instance (the global variable xamlRenderer found in ViewController.mm).
void TouchDown(NsInt x, NsInt y, NsUInt32 id);
void TouchMove(NsInt x, NsInt y, NsUInt32 id);
void TouchUp(NsInt x, NsInt y, NsUInt32 id);
You can get the events from the EAGLView class using touchesBegan, touchesMoved and touchesEnded.

We will upgrade the integration sample accordingly.

Having done that, you can follow our multiplatform Touch and Manipulation tutorial.

Besides that, touch events are promoted to mouse events when not being handled. That allows you to use for example the MouseDown, MouseEnter and MouseLeave events of the Button class.
 
zhangyi
Topic Author
Posts: 9
Joined: 09 Jul 2016, 09:31

Re: Is there a iOS demo available?

14 Jul 2016, 04:54

We have not received any email yet.
I guess it 's a email problem, and I have resent it with another email addr: ************************
We will upgrade the integration sample accordingly.
Can you give me a rough schedule about the new integration sample?

By the way, I want to know whether noesisgui have a plan to support Metal in iOS platform, and when?

Thanks!
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Is there a iOS demo available?

14 Jul 2016, 18:42

Can you give me a rough schedule about the new integration sample?
The change is super easy. Just calling TouchDown, TouchMove and TouchUp whenever you receive the events from the iOS window.

I wouldn't wait for having this solved in our repository because we are now 100% focused in the 1.3. But if this is very critical for you I would try to find time this week.
By the way, I want to know whether noesisgui have a plan to support Metal in iOS platform, and when?
Yes, it is in the plan for v1.3.
 
zhangyi
Topic Author
Posts: 9
Joined: 09 Jul 2016, 09:31

Re: Is there a iOS demo available?

18 Jul 2016, 04:26

Thanks for your suggestions!

I make some change in Integration Sample for testing, the following are code pieces

ViewController.mm
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch *touch = [touches anyObject];
    CGPoint p = [touch locationInView:self.view];
    widget->_xamlRenderer->TouchDown(p.x, p.y, widget->_button);
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch *touch = [touches anyObject];
    CGPoint currentPoint = [touch locationInView:self.view];
    widget->_xamlRenderer->TouchMove(p.x, p.y, widget->_button);
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch *touch = [touches anyObject];
    CGPoint p = [touch locationInView:self.view];
    //_xamlRenderer->TouchUp(currentPoint.x, currentPoint.y, 3);
    //Drawing::Point p = widget->_button->PointFromScreen(Drawing::Point(currentPoint.x, currentPoint.y));
    widget->_xamlRenderer->TouchUp(p.x, p.y, widget->_button);
}
WidgetTest.cpp
void OnClickedButton(Ptr<BaseComponent>& sender, const RoutedEventArgs& e)
{
    Ptr<Button> button = NsStaticCast<Ptr<Button>>(sender);
    button->SetContent("Click Meaaaaa!");
}

void WidgetTest::init(){
    _button = *new Button();
    _button->SetContent("Click Me!");
    _button->SetWidth(400);
    _button->SetHeight(200);
    _button->TouchUpEvent += MakeDelegate(&OnClickedButton);

    _grid = *new Grid();
    _grid->GetChildren()->Add(_button.GetPtr());
    _xamlRenderer = Noesis::GUI::CreateRenderer(_grid.GetPtr());
}

void WidgetTest::Release(){
}
There are some linked errors, as bellow
Undefined symbols for architecture armv7:

  "typeinfo for Noesis::Core::BaseComponent", referenced from:

      typeinfo for Noesis::Core::Delegate<void (Noesis::Core::Ptr<Noesis::Core::BaseComponent>&, Noesis::Gui::RoutedEventArgs const&)>::MultiDelegate::DelegateVector in WidgetTest.o

ld: symbol(s) not found for architecture armv7

clang: error: linker command failed with exit code 1 (use -v to see invocation)
So I confuse about the link error, and I'm sure that it is produced by MakeDelegate(&OnClickedButton).

I expect some help,thanks!
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Is there a iOS demo available?

18 Jul 2016, 09:23

Just a few comments about your code:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch *touch = [touches anyObject];
    CGPoint p = [touch locationInView:self.view];
    widget->_xamlRenderer->TouchDown(p.x, p.y, widget->_button);
}
You will probably need to scale the coordinates with the contentScale (needed for newer devices). Regarding the third parameter passed to TouchDown it must be a number that uniquely identifies the finger id (estimationUpdateIndex from UITouch class could be valid for that) or just a constant if you are not using multitouch.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    CGFloat s = self.layer.contentsScale;
    CGPoint pt = [[touches anyObject] locationInView:self];
    NsSize x = NsSize(pt.x * s);
    NsSize y = NsSize(pt.y * s);
    widget->_xamlRenderer->TouchDown(x, y, 0);
}
The signature of the function that handles the event is not correct:
void OnClickedButton(Ptr<BaseComponent>& sender, const RoutedEventArgs& e)
{
    Ptr<Button> button = NsStaticCast<Ptr<Button>>(sender);
    button->SetContent("Click Meaaaaa!");
}
It must be a raw pointer instead of Ptr:
void OnClickedButton(BaseComponent* sender, const RoutedEventArgs& e)
{
    Button* button = (Button*)(sender);
    button->SetContent("Click Meaaaaa!");
}
Regarding the error you are having I think it is due to having RTTI enabled in your project. Could you disable it? Right now, we should probably provide iOS binaries with RTTI enabled to avoid this. We are already doing that in OSX.
 
zhangyi
Topic Author
Posts: 9
Joined: 09 Jul 2016, 09:31

Re: Is there a iOS demo available?

18 Jul 2016, 10:15

Thanks for your help!

I followed your suggestions as bellow:

1. I disabled RTTI.
2. I changed the signature of the function OnClickedButton.
3. I set the third param of TouchDown to 0.
4. I considered the contentsScale of self.view

And it can be linked successfully, :D

However, there are still two questions

1. the handler function OnClickedButton was not triggered when I clicked the button.
2. the app would crash if I called the following code
UITouch *touch = [touches anyObject];
NSNumber* touchId = [touch estimationUpdateIndex] 
and error log
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITouch estimationUpdateIndex]: unrecognized selector sent to instance 0x1769d3a0'

*** First throw call stack:

(0x21bdffef 0x3026bc8b 0x21be5409 0x21be3327 0x21b12e78 0xf5f49 0x253daaed 0x2528d3f9 0x25286da1 0x2525cf95 0x254d38ab 0x2525b9a9 0x21ba5faf 0x21ba53bf 0x21ba3a25 0x21af0201 0x21af0013 0x2946f201 0x252bca09 0xf3457 0x3081daaf)

libc++abi.dylib: terminating with uncaught exception of type NSException
Thanks!
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Is there a iOS demo available?

18 Jul 2016, 14:36

Hmmm, forget about estimationUpdateIndex for now and use always 0 as touchId.

Who is online

Users browsing this forum: Ahrefs [Bot] and 6 guests