Home » Developing U++ » Mac OS » Mac OS X port architecture
Re: best way to draw text/fonts on MacOS from C/C++ [message #33337 is a reply to message #33329] |
Tue, 26 July 2011 06:11   |
 |
daveremba
Messages: 32 Registered: June 2011 Location: Los Angeles, CA, USA
|
Member |
|
|
Regarding:
Quote: | - investigate how minimal Cocoa application looks like -
it is enough to display "Hello world" in otherwise emtpy window
(view?), preferably without the presence of .nib files
|
1. build the minimal app is easy, gcc on Mac knows
how to handle and link the file types without
any unusual flags (although one can get fancy and
specify architectures for "universal binaries" etc.)
The following command works, to mix a C main file
have it start an objective-C Cocoa application:
gcc main.c main.m cocoa_test2AppDelegate.m -framework Cocoa -o cocoa_test2_bundle.app/Contents/MacOS/cocoa_test2
theide code editor will load the .m files after I set the
filter to All Files.
2. The template code generated in Xcode sets up Cocoa
so it does expect to have a .nib file (if one deletes it
the app will not display a GUI).
One can however create a toplevel window manually and
handle the events for it. (Apple provides sample code
to do this for legacy Carbon apps, but we won't use it).
FLTK (and other modern GUI frameworks) create the
toplevel and handle events in Objective-C calling Cocoa.
One subclasses from NSView to create the window,
and one subclasses from NSObject to create
a delegate class to handle the events.
I have not finished looking the Fl_Cocoa.mm file yet.
One can access the FLTK/Cocoa bridge online. That is what I am looking at.
Dave
[Updated on: Tue, 26 July 2011 06:21] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed Apr 30 22:02:20 CEST 2025
Total time taken to generate the page: 0.02949 seconds
|