Creating a Cocoa app using C or Perl (NOT Objective-C) - c

I'm having a hard time understanding how to use Cocoa with either C or Perl.
Background:
I've seen it mentioned in quite a few places that Mac's Cocoa API can be used with C, Perl etc. but I haven't found any information on how to go about doing this. I've also found a couple of articles saying that Cocoa can be used with Objective-C only.
I've seen CamelBones for Perl but it looks like I have to use XCode and a fair amount of Objective-C to use it.
Are there any resources on building a Cocoa app using just a C compiler and a text editor?

If you don't want to learn Objective-C, then forget about writing Cocoa apps. The Python and Ruby bridges are for using existing libraries in a Cocoa app, they are not a way for you to live in a bubble and avoid learning a new language.

Related

Making a GUI simulator in C

Hello StackOverflow Community,
I am writing a MicroMouse Simulator in C language. And I wanted something to visualize the way the maze is being solved like this -- http://www.youtube.com/watch?v=N9TkDgJNJso
I've been researching a way to accomplish this, but I haven't found anything with enough documentation to accomplish my goal.
I don't want to implement this using ASCII symbols, to me it doesn't look professional.
Is there any good GUI interfaces that I could use in C to help me accomplish this? And if so, how would I use it? I don't mind having to code in another language like Java or Python to accomplish my goal.
I saw the video that you want to make. After watching the video I feel you don't need a GUI library for this simulator program.
Here is a list of libraries that you can use.
1.OpenGL This is a 3D graphics API which also can be used for 2D and can be used with both c/c++
2.SDL This library is easy to understand for a beginner. For your program this library is better and can be used with both c/c++.
3.winBGIm This is same as the graphics.h that you found and can be used both c/c++ but it is only for windows.
If you are looking for GUI library then here's a short list.
1.GTK This is written in c and is a popular GUI library for c. You can find a GUI editor for gtk forms called glade which enables quick & easy development of user interfaces.
2.WxWidgets This is written in c++ so you have to use c++ rather than c.
3.FLTK
There are many more libraries besides these which you can find in google. You said
I do not mind having to code in another language like Java or Python to accomplish my goal.
Then for java you can use swing and If you are windows developer then use the windows form application in visual c++; then development of your program will be very easy.
SDL is one of candidate for C in order to make GUI Simulation. Lazyfoo is one of the best site I found for beginner.
SDL is strongly portable. It's written in C and there're a lot of documentation and tutorials.

Using Tk with C

I’m a C programmer with no desire to deal with C++ tool-kits, and I’m trying to build a simple graphical card game. I’m programming under Linux, but I’d like to have the option of a Windows port. From what I’ve read, my options are GTK+ and Tk.
I’m working through some GTK+ tutorials, and I’ll probably stick with that, but I don’t think I’m giving Tk a fair shot. Trouble is, all the Tk documentation I can find is either for using Tk with {Tcl, Ruby, Perl, Python}, or for embedding a Tcl interpreter into the C program and using Tk that way. Is there an easy(-ish) way to use Tk to build GUIs for a C program without digressing too much into Tcl?
Ideally, is there a tutorial (something along the lines of the TkDocs Tk Tutorial) but using something like the Tk C API?
Here are some useful links:
Combining C and tcl/tk
[An Overview of the Tk C Library][2]
Here's a reference: http://www.hume.com/html85/indexes/tkc_api.html
Intro to combine C with Tk: http://davesource.com/Fringe/.../tcl_tk/tcl_C.html

User Interface for C-code

I've written a code in linux OS which produces prog.out as output file.
Now I've to write GUI for the code.
what are best ways to write it?
PS - I wanted to choose between Java Swings and openGL.
Which is best for writing a simple GUI and integrating it with my C- Application
Thanks in advance
OpenGL is a rendering library, not a UI toolkit. Comparing it to Swing doesn't make sense. And you can't choose Swing for a C application, unless you'd rather do the UI in Java and interact with a C "backend".
For a pure C solution, the best choice would probably be the GTK+ toolkit.
Try Anjuta...
http://projects.gnome.org/anjuta/
If you are prepared to use another language (you mention Java) then you may find C++ and Qt to be a good fit. Linking to the existing C code will be trivial and Qt works well on a great many platforms should you ever wish to support other platforms in addition to Linux.

JavaFX, Flex and not default languages

Can I write programs in JavaFx or Flex with other languages (not ActionScript and JavaFX Script) like in Silverlight?
JavaFX can call Java and thus can call any code that generates Java classes. So you could in theory write code using JRuby or Groovy.
However, I would suggest that is not really how you could should JavaFx (or Flex). Rather you are really using these languages to build great UI using technologies that should be more reliable than AJAX/browser nightmares.
And that their real power comes when you are able to integrate them with back-end data sources (via REST/SOAP) that can be written in whatever language you want.
The question would be easier to answer if we understood why you would want to do this?
For JavaFX the answer is both yes and no, depending on what it is you want to achieve. JavaFX compiles to Java classes and in theory you can call the compiled JavaFX classes from any JVM language that can call Java classes. However, this isn't as simple as it sounds because some of the stunts they are pulling to implement the JavaFX language features make the implemented classes quite complex and the name mangling is not defined and subject to change. Any solution written this way would be very fragile.
However, much of the JavaFX functionality is based on pure Java libraries such as JMC (Java Media Components) for the media support and the scenegraph project (https://scenegraph.dev.java.net/) for the 2D scenegraph. These projects are written in Java and are much easier to call from Java and other JVM based languages.
I don't have any experience of Flex but as far as I know, you are stuck with MXML and ActionScript.
For flex you can only do MXML and Actionscript although there's an option to compile C/C++ code using Alchemy

Rich GUI OS X Frameworks?

What would you recommend for OS X development of a graphical application like those possible in WPF?
My specific background is in Smalltalk & Java, but I currently work mostly in DHTML/.NET (ASP.NET/C#).
Cocoa. Considered by many to be the best application framework ever. The language is Objective-C, SmallTalk-like language that inspired the creators of Java.
Really, there is no reasonable alternative to Cocoa for OS X development, unless you have specific needs like wanting to be cross-platform.
Aside from Interface Builder which is included as part of the Xcode tools, you can also use QT, GTK+, AWT & SWING (for your Java background), Tk, Squeak (for your Smalltalk background), Shoes (very cool little Ruby GUI toolkit), FXRuby (more Ruby), wxWidgets, XULRunner, and others I'm sure I've forgotten. For the most native-like apps, however, Interface Builder is your best bet.
Cocoa is the primary framework to use on Mac OS X. It's what Apple uses, it's what most new development uses, and it's where new features are principally added.
If you're coming from WPF, I think you might find quite a few of the concepts in Cocoa familiar. (Despite the fact that Cocoa is just a bit older.) It's built entirely around MVC, there are property-change notifications and bindings, there's animation support, there's a persistence and object-graph management framework, and so on.
(Also, you might want to add "mac" to the tags.)
With your Java background, don't get sidetracked by the now deprecated Cocoa-Java bridge. Early in OS X history, Apple provided a (laboriously hand-maintained) Java interface for the Cocoa libraries. Because of the semantic differences between Java and Objective-C, many of the most powerful features of Cocoa, including Key-value binding (upon which many other features are built) is very difficult, leading to divergence of Objetive-C and Java capabilities and the eventual deprecation of the bridge. All Cocoa development is best done with Objective-C or one of the many (automatically generated) bridges to dynamic languages such as Python or Ruby.
With your background in smalltalk, I would expect you could pick up Objective-C in a day or two.
I'm not sure what WPF is, but most development for the OSX platform is done in Objective-C with Cocoa. You can use the deprecated Carbon APIs with other languages like Java, but new applications for OSX really should be developed in Objective-C. You can start with Apple's guide with Xcode as your IDE.
To put it a different way than previous posters: if you are not designing your interface in InterfaceBuilder and manipulating it with Objective-C, then you are going to end up with an application that does not look, feel, act, or work the way a Macintosh application should, and it will stick out like a sore thumb to users. It will be an unpleasant experience for the user compared to other apps, and they will likely desire a different application because of it.
Toolkits like QT are acceptable if your application already uses QT and you want to port it fast, but if you're writing a new application (or a separate GUI) then write it in Cocoa using ObjC or ObjC++.
You might have a look at PyObjc which is a bridge between the Python programming language and Objective-C, including bindings for Mac OS X components, including Cocoa.
With a Smalltalk background, I'd recommend straight Cocoa and Objective-C. However, if you're leaning towards a dynamic language, RubyCocoa will let you use Ruby which I think you'll find easier to pick up than Python.

Resources