window based application with OF?

Hey guys,

I’m looking through the code examples of iPhone apps with OF and the first thing I noticed is that the file structure is quite different from regular iPhone applications. So I was wondering if it’s still possible to use Objective-C and the Cocoa touch framework with OF applications?

Are there any examples on how this is done? Basically I’m trying to understand how to work with OF and still implement the recommended MVC pattern with regular windows and views (I need OF mainly for sound generation)

Any ideas?

hi,

this addon will do what you need,
https://github.com/julapy/ofxiOS

it allows you to build an iOS app like you would normally using the MVC structure,
and allows you to then create OF views inside your app.

good place to start is checking out the example included in the addon.

L.

Thanks for the link it’s quite useful.

But what if I want interaction within my OF program? I mean I’m guessing you can do more with OF than create squares and circles.

I’m actually trying to make something similar to this: http://vimeo.com/4027858
I think I have the audio part down, but I have no idea how to go about the interface, using OF. Drawing the grid might not be too hard but how do I go about making every square clickable within OF?

Maybe I’m going about this the wrong way so any help is very much appreciated.

Thanks!

to build the grid interface, i would make the grid out of smaller Square objects.
each Square object will have an x and y position and width and height.
once a touch event is fired, you’ll have to go through all the squares in the grid and check if the touch x and y position is inside any of the Squares. if so, you can turn that Square on or off.

search the forum for ofxMSAInteractiveObject.
its pretty much a basic button class which will tell you when a button has been pressed.
examples on how to use it should be ample.

L.

So basically I just need to build an interface but it doesn’t need to be touch-specific… it will just work?
Because the plugin you mentioned isn’t iOS specific I think.

If so, are there any built in tools (or addons) for more advanced interfaces?

ofxMSAInteractiveObject is not iOS specific.

you’ll still need to check if each square was pressed…
something like,

  
  
void testApp::touchDown(ofTouchEventArgs &touch)  
{  
    for( int i=0; i<numOfSquares; i++ )  
    {  
        // check if square was pressed using touch.x and touch.y values.  
    }  
}  
  

there are other gui interfaces available.
search for gui on the forum.

L.

Thanks for the link!
https://github.com/julapy/ofxiOS

Although I tried compiling the example and I get 40 linker errors. I’m sure its a simple fix but I can’t figure out why.

Any help would be greatly appreciated.

Ok, so I used a backup copy of OF and it worked fine. I think my project settings must have triggered something.

Thanks again though! this addon is exactly what I have been looking for!