|
From: Mickael B. <mba...@gm...> - 2012-06-25 12:32:34
|
Hi Arno,
Thanks for your really quick answer ! :)
I've just taken a look at what you suggested. But I don't think this
corresponds to what I'm looking for...
I'll be more specific.
If I did understand correctly what does the Advisor, it will add a new
method inside the UIView java class (let's call it "layerClass") and a
native implementation inside org_xmlvm_ios_UIView.m from the code I'll put
inside advisor.xml. I deduced it from what did the toString() method added
inside NSString in advisor.xml :
<class name="NSString">
<injected-method name="toString" modifier="public">
<signature>
<return type="String"/>
</signature>
<code language="c" mode="replace">
<![CDATA[
return fromNSString(((org_xmlvm_ios_NSObject*)
me)->fields.org_xmlvm_ios_NSObject.wrappedObj);
]]>
</code>
</injected-method>
</class>
This adds the method inside "NSString.java" :
/*
* Injected methods
*/
public String toString(){
throw new RuntimeException("Stub");
}
and "org_xmlvm_ios_NSString.m" :
JAVA_OBJECT org_xmlvm_ios_NSString_toString__(JAVA_OBJECT me)
{
//XMLVM_BEGIN_WRAPPER[org_xmlvm_ios_NSString_toString__]
return fromNSString(((org_xmlvm_ios_NSObject*)
me)->fields.org_xmlvm_ios_NSObject.wrappedObj);
//XMLVM_END_WRAPPER
}
That's great, but not what I'm looking for.
What I want to do is add a class method inside the underlying UIViewWrapper
ObjC class.
>From what I'm understanding of it, UIViewWrapper is a generated ObjC class,
extending UIView, and adding methods for managing delegated methods such as
touch events, etc :
Inside "org_xmlvm_ios_UIView.h" :
@interface UIViewWrapper : UIView
// Append the wrapper method declarations defined in the class Macro
XMLVM_OBJC_OVERRIDE_CLASS_DECLARATIONS_org_xmlvm_ios_UIView
@end
Inside "org_xmlvm_ios_UIView.m" :
@implementation UIViewWrapper
// Append the wrapper methods defined in the class Macro
XMLVM_OBJC_OVERRIDE_CLASS_DEFINITIONS_org_xmlvm_ios_UIView
@end
What I need is to be able to add a class method inside UIViewWrapper, so
that it looks like something like this :
@implementation UIViewWrapper
// Append the wrapper methods defined in the class Macro
XMLVM_OBJC_OVERRIDE_CLASS_DEFINITIONS_org_xmlvm_ios_UIView
+ (Class) layerClass {
return [CAEAGLLayer class];
}
@end
Having generated this method for the "org_xmlvm_ios_UIView" class won't
solve my problem, since the method needs to be generated on the
UIViewWrapper class.
Maybe is it more clear now... :)
Mickael
2012/6/25 Arno Puder <ar...@pu...>
>
> checkout trunk/crossmobile, then look for a file called advisor.xml. In
> that file do a grep on "toString". This is an example on how a method
> toString() is injected to class NSString. You should be able to do the
> same for a method called layerClass. Once you have done that, do a "ant
> gen-xmlvm-ios" in crossmobile. This will re-generate the iOS API in
> ../xmlvm. For this to work you need to point property sdk.path in
> xmlvm.properties to an installation of the iOS 4.3 SDK (note that
> crossmobile cannot deal with 5.* API yet).
>
> Arno
>
>
> On 6/25/12 11:53 AM, Mickael Barbeaux wrote:
> > Hi everyone,
> >
> > I recently switched to the new C iOS API backend, and it really works
> well !
> > I'm currently working at implementing an OpenGLES 2.0 interface for
> > developing my own custom game renderer, based on what was done before on
> > the old C API backend.
> >
> > My main concern is about the way to define the layer class on a UIView.
> > As you may know, I order to use an OpenGLES 2.0 renderer inside a
> > UIView, Apple recommend to add this method inside your UIView subclass :
> >
> > + (Class) layerClass
> >
> > {
> >
> > return [CAEAGLLayer class];
> >
> > }
> >
> >
> > But how to reach the same effect using XMLVM ?
> > It seems that the UIView implementation is based on a ObjC wrapper class
> > (UIViewWrapper), but it is generated by XMLVM at XCode project
> > generation, and it seems I have no way to modify it.
> > As the method to implement is "static" (class method), I didn't find a
> > way to "override" it inside my UIView java subclass. Using a delegate
> > method won't help either.
> >
> > How can I process to achieve what I want to do ?
> > Should I do the same way as for the old C iOS API, that's to say
> > duplicate the UIView class and create a UIViewGL class with specific
> > implementation using the CAEAGLLayer class ? But then, how can I add the
> > "layerClass" inside the wrapper implementation, as it is now generated
> > automatically by the new iOS API ?
> >
> > Mickael
> >
> >
> >
> ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> >
> >
> >
> > _______________________________________________
> > xmlvm-users mailing list
> > xml...@li...
> > https://lists.sourceforge.net/lists/listinfo/xmlvm-users
> >
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> xmlvm-users mailing list
> xml...@li...
> https://lists.sourceforge.net/lists/listinfo/xmlvm-users
>
--
Barbeaux Mikael
Ingénieur SI - Spécialité J2EE
---------------------------------------------------------
Ippon Technologies
3 rue Bellanger
92300 LEVALLOIS PERRET
Port: 06.18.85.00.73
www.ippon.fr
|