Quick Links: Gideros Home | Download Gideros | Developer Guide
UIKit plugin example
  • MikeHartMikeHart +1 -1 (+4 / -1 )
    Guru
    Hi folks,

    here is the code I was working on for the UIKit plugin. Take it as you wish.

    Cheers
    Michael
    UIKit.zip
    10K

    Likes: Caroline, gorkem, techdojo, phongtt

    Dislikes: Ghando

  • ok. thanks. mike.

    @mikehart or @atilim or any plugin expert! :)

    ps: i'm starting now to study plugin system... only now... :\">

    but if i use c (not c++) i need to use a ..stub file like in sqlite plugin ?

    i created a little plugin.. with very simple function in it and added to player and work fine in Apple iPhone emulator...

    but for desktop (and gideror emulator) ? how do i do?
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • You should have asked this in a seperate topic. As I don't want be the reason for Görkem having to much fun about me, I let him answer this question.
  • Sorry, I just being pissed about it. Anyway, I attached the files I used to compile the plugin. Of course it is IOS only.
  • @MikeHart
    MikeHart said:

    You should have asked this in a seperate topic



    sorry Mike.
    you are right.
    I did not do maliciously.
    i'm so sorry really.

    Gianluca.
    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
  • Np. But your question will be asked by others in the future too and if it is handled in its own topic, it is easier to find for them. Anyway, do as you please. It was just a suggestion. Right now it is organized here, but on the mexican beer forum, people posted all over the forum. It was such a mess.
  • @MikeHart - you've done a fantastic job on this, Mike - it's made it easy for other people just to add on the bits that they need for their UI needs.

    Sorry that I haven't been able to contribute - real life issues have come my way, hopefully temporarily.
  • Thank you and Np, I can understand this totally.
  • Thanks for sharing Mike, looks like I've got some reading to do about plugins and how to get the stuff working.

    Sorry if this is a bit of a noob question but...

    I'm assuming that the plugin can be baked into some kind of library (.a ??) and then reused from project to project - yes ?

    Also as I actually do most of my development on a Windows PC, can that library be used along with the player (compiled and installed on my iPod touch) to develop and upload code from Windows using Gideros Studio??? - or have I got the wrong end of the stick?

    Regards

    Jon...
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • techdojo said:



    I'm assuming that the plugin can be baked into some kind of library (.a ??) and then reused from project to project - yes ?

    Also as I actually do most of my development on a Windows PC, can that library be used along with the player (compiled and installed on my iPod touch) to develop and upload code from Windows using Gideros Studio??? - or have I got the wrong end of the stick?

    Regards

    Jon...



    1. yes
    2. yes, as long you have compiled and installed the player first with XCode on your device.

  • Thank you for an excellent library Mike, very useful!

    Note: I got a few compiler warnings.

    Warning: Format string is not a string literal (potentially insecure)
    Warning: 'setStatusBarHidden:animated:'is deprecated (iOS 3.2 and above)

    I removed them by changing the following:

    Line
    81 NSLog(type); to NSLog(@"%@", type);

    1370 NSLog(filename); to NSLog(@"%@", filename);

    1665 NSLog(txt); to NSLog(@"%@", txt);


    Line
    1861 [[UIApplication sharedApplication] setStatusBarHidden:show animated:NO];

    to

    [[UIApplication sharedApplication] setStatusBarHidden:show withAnimation: UIStatusBarAnimationNone];

    1957 [[UIApplication sharedApplication] setStatusBarHidden:true animated:NO];

    to

    [[UIApplication sharedApplication] setStatusBarHidden:true withAnimation: UIStatusBarAnimationNone];

    There is a choice of three animations for the above:

    UIStatusBarAnimationNone
    UIStatusBarAnimationFade
    UIStatusBarAnimationSlide


    Cheers

    evs
  • gorkemgorkem +1 -1
    Maintainer
    @mikehart @evs @techdojo @gregbug @caroline I'd suggest you put this code sample to Github, and start contributing to it by adding a README file, inline comments, a few usage examples etc. I believe it'll be of help to many people in the forum.

    Someone get the ball rolling, please :)
  • @mikehart @gorkem - I've talked with Mike and put it up on github:

    https://github.com/carolight/MHUIKit

    Not sure how forking works, but I guess we'll find out :).

    Let me know if I need to change anything, or if you find somewhere better to host it.
  • For usage examples, I think the accompanying Gideros Studio project is very good.

    I haven't tackled inline comments or put in pragma marks.

    I did correct as @evs suggested.
  • gorkemgorkem +1 -1
    Maintainer
    So easy even *I* can understand without comments \:D/
  • Does anyone know a free good github client?
  • atilimatilim +1 -1 (+1 / -0 )
    Maintainer
    For Mac, I can recommend http://mac.github.com/ or http://www.atlassian.com/software/sourcetree/ (But I haven't used neither of them, only read good reviews)

    Likes: Caroline

  • Most of the documentation / forum posts about plugins refer to the iPhone, are there any plans for implementing a plugin system for android?

    I know plugins aren't for everyone but already having experience with the Android NDK and having looked at Caroline's TestPlugin example (http://www.giderosmobile.com/forum/discussion/571/a-simple-c-sample-plugin), I can't see any reason why it shouldn't be possible to implement on android, or am I missing something which prevents the use of plugins in android.

    Edit:
    Doh!!!!, I posted too soon, the last comment I managed to read (http://www.giderosmobile.com/forum/discussion/572#Item_2) mentioned that you're already on the case. :)

  • gorkemgorkem +1 -1
    Maintainer
    Yes, as you said, it's currently in the roadmap (http://bugs.giderosmobile.com/projects/gideros-studio-sdk/roadmap)
  • evsevs +1 -1
    Member
    Hello all,

    I've forked off ( "Fnarr! Fnarr!") and added a Simple PickerView with a lua usage example - picker.lua

    https://github.com/evsgithub/MHUIKit

    I also made the following additions to TextField2

    setTextColor(r, g, b)
    setBGColor(r, g, b)

    showKeyboard() - call after adding to view

    I hope It's not too buggy?


    Cheers

    evs


  • Thank evs, that is a great addition. Any reason why you didn't submit your additions to Caroline's hub?
  • Does someone know how to fix the scrollview problem?

    The problem here is:

    controls that are added to it, will be collected from the GC once it kicks in. The fastest way ro recognize this is to use the slider as this creates the most events.
  • evsevs +1 -1
    Member
    Hello Mike,

    I'm new to using github, but I read somewhere that it's best to fork off a hub to do your 'experiments', allowing the owner of the original hub to integrate then if they so wish.


    Cheers

    evs
  • evs said:

    I'm new to using github



    Darn - I had hoped you knew something about it :). So I'll integrate then? I guess I just download your fork into my code and recommit?

  • Caroline said:

    evs said:

    I'm new to using github



    Darn - I had hoped you knew something about it :). So I'll integrate then? I guess I just download your fork into my code and recommit?



    Please do that.

  • Doooh

    Scrollview issue... So simple to fix. I got it working. Now I have to figure out how to submit this back to the hub.
  • Mmmh, I uploaded it but on the web interface it isn't visible. @Caroline, what's wrong with it?
  • @mikehart - when you say you "uploaded it", what exactly did you do?

    I think I will have to go and read something about git...
  • I used the Software GITHUB to for this. I got the code thought from your up and it looks like I committed it to your hub again.
  • evsevs +1 -1
    Member
    Hello,

    It's probably because the git has Read-Only access.

    I used the fork icon online to create my own repository and I use Mac GitHub to manage it.

    I suppose Caroline would have to grant you Write access for you to commit to her hub?


    Cheers

    evs
  • I don't think it works like that - on reading this:

    http://help.github.com/send-pull-requests/

    I think that a person (@evs) creates a fork.
    evs then does a pull request.
    I receive the pull request and merge the fork with the master.

    We can experiment to see if this works with evs, and then @mikehart, you could create a fork. Or if you prefer to email me the changes, that will be fine too :).

  • evsevs +1 -1
    Member
    @Caroline

    Pull requested

    Cheers

    evs
  • @Caroline. Np. Will do that when I have time.
  • @evs - that seemed to work.

    @mikehart - I'm not sure how all this co-ordinates, but you'll presumably need the new uikit.mm.
  • Ok, I will create a fork then.
  • Ok, forked, changed, committed and pull request send. I am so happy that this damn scrollview issue seems to be fixed.
  • Merged. Thanks @mikehart :).
  • ndoss +1 -1 (+2 / -0 )
    Guru
    Wow!

    I haven't looked at anything related to iOS plugins until yesterday/today. I just read the guide section on plugins and compiled/ran the uikit example. I'm awed by how much work Caroline and Mike have done in his area and how much you guys have been willing to share. Impressive!

    Thanks!!

    --ND

    Likes: gorkem, MikeHart

  • Thanks for your kind words. It is still rough and needs some fine tuning but I think it is on a good track. I am very happy that @evs already contributed to it. @Caroline was working on a tableview and I hope she will implement it soon into this plugin.
  • @MikeHart - I'll get there eventually [-O< :)
  • gorkemgorkem +1 -1
    Maintainer
    @ndoss I'm pretty aware with the fact that beauties of Gideros Studio is not strongly mentioned on our web page. I think if you've just found out this powerful feature, then probably many users out there cannot see it easily as well. I'm preparing a newsletter now, and mention about UIKit plugin there first, and then write a blog post that explains UIKit thoroughly.
  • I've updated this with a very simple table view with a separate Gideros project as an example. You just provide a table, display text in the cells and receive a selected message when the user selects a cell.

    Before I go any further with this, the whole subviews thing needs to be looked at. I've spent some time going over this, but my C++ skills fail me.

    I would prefer that Gideros provides the table view cell with a contentView that has a view hierarchy for the cell, so that it can be totally formatted inside Gideros Studio, however, view hierarchies are currently not implemented.

    One way I tried approaching it was to have a static contentView for each cell, for example holding a Label and an image, and the label text and image could be updated for each cell. So as an example, if you have 10 visible cells, then you have 10 contentViews for which you can provide different text and different image. I attempted holding these contentView addresses in a table in Gideros, so they could be accessed by the event function, but I gave up on this, because holding the view hierarchy there is ugly.

    Having a subview hierarchy will become important, I'm sure, the more people use UIKit. I'm going to have to abdicate from this, because of lack of skills (AKA my brain hurts) :bz.

    Link is still:
    https://github.com/carolight/MHUIKit
  • As you don't want to do this anymore, is there a way I cna take over this hub or do we have to create now a new one? Maybe I can use my fork further for this. :-?
  • Oh, I didn't mean I don't want to do this, but I'm not competent at making those subviews work. I'm quite happy to merget forks from other people.

    However, at any time, we can take down the source from github and upload it anywhere as a new master.

  • Doesn't Gideros use just one OpenGL view? If it did then Gideros would have to have an OpenGL view for each cell, and that would get kinda messy I think. TableView API's seem kind of super complex to me because Apple uses tons of tricks to get them fast.
  • Gideros provides a root view, to which all UI items are attached. The UIKit plugin is using Apple's UITableView, just hooking into the events that the UITableView provides. The UITableView cells perform in exactly the same way as if the app is an Objective C app.

    If I were writing an Objective C app, I would provide a contentView to the UITableViewCell contentView property for each cell, which is what I would like Gideros to be able to do. The difficulty is that I would like this contentView to have its own subviews hierarchy.
  • Does Gideros draw to an OpenGL view or is it drawing using CoreGraphics? How would it handle drawing to multiple views?
  • As far as I can see, this is the way it works, but I could be wrong, as only @atilim knows the internals of Gideros.

    In Xcode, you can look at the loadview() method in GiderosiPhonePlayerViewController.mm.

    This method creates an OpenGL view (EAGLView) and a UIView. The UIView is the main root view, and the OpenGL view is added to the root view. I'm pretty sure that Gideros would be using OpenGL rather than CoreGraphics.

    I believe that Gideros would be using a single OpenGL view to draw on, although multiple views can be done using CAEAGLLayers layer backed views, according to this thread:
    http://stackoverflow.com/questions/4726745/multiple-opengl-views-on-iphone

    When you use any of the views in this UIKit plugin, they are added to the root view. They would appear on top of the OpenGL view, because they are added later than the OpenGL view.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID

In this Discussion

Top Posters