Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Cbswe

macrumors member
Original poster
Jan 11, 2010
40
0
Hi!

I recently picked up obj-c (started two days ago) and
as suspected I'm running into a wall of problems.
What I'm trying to achieve is simply an application which has the ability to display images (and videos) and I want to be able to control the flow of events
somehow already from when the app is launched.

Is there any method I can implemented and that will be run after the interface
has loaded.. or can I somehow get the app to call upon a method after it's initialization?

Any help is much appreciated and I'll gladly try to formulate the problem
more clearly if there is any doubt of what I'm asking.

//Carl
 
-awakeFromNib is what you're looking for.

What you should probably be looking for, though, is an easier first project. Your expectations are awfully high if you are just starting to learn Objective-C and Cocoa.

-Lee
 
-awakeFromNib is what you're looking for.

What you should probably be looking for, though, is an easier first project. Your expectations are awfully high if you are just starting to learn Objective-C and Cocoa.

-Lee

Thanks a lot!

Yes, I know I should start easier.. But I love a challenge :)

I'm not completely new at OO though. I've worked with java for more then a
year and I made a very simple FPS game with Java OpenGL.


My ultimate long-term goal with cocoa atm, is to re-implement Myst.
Being a huge myst-fan I'd love to see the original game running natively
in OS X!

I'd try to reverse-engineer it, but It's a little too hard.
And the game being so small, a re-implementation seems easier.
 
Good luck, then. My intention was not to discourage. We often see people that have just started programming, or have a little experience with other languages and are just starting Obj-C/Cocoa and they say they "just want to make a 2D game", etc. Setting the bar so high(even if they don't know they're setting the bar high) when they're just starting out tends to be discouraging for them because they won't see progress towards their ultimate goal for a long time. If you're already an adept programmer, than your goals may not be as far-fetched.

-Lee
 
Good luck, then. My intention was not to discourage. We often see people that have just started programming, or have a little experience with other languages and are just starting Obj-C/Cocoa and they say they "just want to make a 2D game", etc. Setting the bar so high(even if they don't know they're setting the bar high) when they're just starting out tends to be discouraging for them because they won't see progress towards their ultimate goal for a long time. If you're already an adept programmer, than your goals may not be as far-fetched.

-Lee

Ah I've myself met a lot of people who don't know much about how programming
works and think it's a lot like painting. :)
Of course it can be if you make it with certain "app-builders".

I was actually a little surprised at the role of the interface builder.
I thought building the interfaces in cocoa would be a lot like building
interfaces in java swing. But in retrospect it makes a lot of sense to make
the UI-builder graphical, especially when you write it for an OS where
appealing looks is essential.

By the way, I understand the majority of 3rd party cocoa apps is windowed.
How hard would you say it is to get the application to run full-screen?

//Carl
 
If that's your goal, and Cocoa + Obj-C isn't also a goal, then maybe you should consider a game engine, like Unity.

See this current thread:
https://forums.macrumors.com/threads/847348/

Thanks for the advice. I would agree. It's just that Myst is a very simple
game and I don't know if I actually can use a game engine to my advantage
for this particular task.

My current main worries is recreating effects properly such as the card
transition (you know when one images replaces the previous random pixel by
pixel, though fast of course) or the scanning of the telescope machine at the
observatorium on the main island.

Other worries are the low-level stuff.. Such as creating proper forks for the
images and sounds in the resources.

I wouldn't know if a game engine could actually help out with this sort of objectives.
 
Cbswe said:
My current main worries is recreating effects properly such as the card transition (you know when one images replaces the previous random pixel by pixel, though fast of course) or the scanning of the telescope machine at the observatorium on the main island.
You should probably study Core Image. Mac OS 10.4+ has a very rich selection of filters for doing this kind of thing.
 
A new interesting complication has arisen.
When I use a QTMovieView with a valid QTMovie and make the
QTMovie play at the end of awakeFromNib, the movie stops when the interface
has finished loading.

I'm thinking of threading it and delaying a thread that after interface
initialization plays the movie. But I'd love a more elegant solution.
 
A new interesting complication has arisen.
When I use a QTMovieView with a valid QTMovie and make the
QTMovie play at the end of awakeFromNib, the movie stops when the interface
has finished loading.

I'm thinking of threading it and delaying a thread that after interface
initialization plays the movie. But I'd love a more elegant solution.

Look at the delegate methods of NSApplication. Find something that's called when the app has finished launching. (Subtle keyword hints are included in prior 2 sentences.)

I could be more specific, but I think it's important for you to:
a) Search the docs yourself.
b) Read more of a class's doc than just the one thing you're looking for.
 
I'm thinking of threading it

Yeah, you do not want to do that. Do not start messing around with threads until you fully understand what you are dealing with. If there is a way to avoid threading (cf. NSTimer), take it and don't look back.
</voice-of-experience>
 
Look at the delegate methods of NSApplication. Find something that's called when the app has finished launching. (Subtle keyword hints are included in prior 2 sentences.)

I could be more specific, but I think it's important for you to:
a) Search the docs yourself.
b) Read more of a class's doc than just the one thing you're looking for.

Thanks. I'll make sure to do that! I'm thinking of buying a book on cocoa
to really get a proper understanding of how the components are supposed
to be used. Apple's cocoa introduction guide was way to shallow to go on..
Then again I'm sure it really was only made to get the user familiar with the
development environment more then anything else.

Yeah, you do not want to do that. Do not start messing around with threads until you fully understand what you are dealing with. If there is a way to avoid threading (cf. NSTimer), take it and don't look back.
</voice-of-experience>

Yes, threading is always a second hand solution in my book.
One time I had used threading to make basis for an engine and
after several weeks I suddenly realized I didn't have to thread it
after all.. Took a bit of rewriting to fix it. In the end the total code
decreased about a fifth in size. :)
 
Got the QT movie working!

I used a applicationDidFinishLaunching in the AppDelegate-code.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.