Topic:   Objective-C   (Read 9293 times)


0 Members and 1 Guest are viewing this topic.

alias


  • Guest
Objective-C
« on: June 02, 2008, 08:56:05 PM »
Not for the light hearted. If you have Xcode have a look at this site for a basic beginners tutorial. http://masters-of-the-void.com/what-you-need.htm

If anything is confusing, feel free to post or PM me.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: Objective-C
« Reply #1 on: July 06, 2008, 02:30:11 PM »
How much do you know about Open Gl coding in Xcodes?

Also, is there a list of all the NS commands in Xcodes?
Like : NSBeep(); - Makes a Beeping Sound

Also, I now understand why Gm only allows one beep at a time. I tried a for next loop where it beeped multiple times and....

...my computer went nuts. One long BBBBBBBBBBBBEEEEEEEEEE. And it froze everything up.

So, hope you can help me.


Thanks,
-Gandolf

alias


  • Guest
Re: Objective-C
« Reply #2 on: July 06, 2008, 10:44:47 PM »
i dont know all that much about openGL. cept that it opperates within any coacoa app. That means that you can switch between objective C and open GL code at any time. If you know how to code open GL that is.

Yes their is, NScommands are for Objective-C. Like NSstring*["text"] for string variables. They are all documented within Xcode.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: Objective-C
« Reply #3 on: July 07, 2008, 08:29:10 AM »
I have a open Gl tutorial, and in order to make a rpg game, I will need the playing area to be in OpenGl, so I will learn it, and try to make it work.

Thanks, I will look around for the nscommands.


-Gandolf

alias


  • Guest
Re: Objective-C
« Reply #4 on: July 07, 2008, 09:03:50 PM »
Good luck with that. I doubt making a game is a good place to start (i have tried), programming in Cocoa is FAR more advanced than BASIC. Firstly you must understand the concept of object orientated code. Then you need to understand about graphics. In objective-c the way graphics works is far removed from any other language. Since the code is detached from the GUI, you have to understand how to bridge them together. Id be happy to send you some source code explaining the small amount that i DO know, and if you find any resources please share it with me as i am learning the language myself and hoping to one day make a game in it too.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: Objective-C
« Reply #5 on: July 07, 2008, 10:09:35 PM »
Do you know how to bridge a button click to C code?

I just figured out how to bridge all the aspects of the Gui to C code.


-Gandolf
« Last Edit: July 07, 2008, 10:10:32 PM by Gandolf »

alias


  • Guest
Re: Objective-C
« Reply #6 on: July 08, 2008, 09:05:45 AM »
Yes, using an App Controller, with actions and outputs. Ive made a calculator of sorts.

Good luck bridging Open GL btw, i tried read a tutorial on it and was mildly confused/amused. I sorta got it too work at least.
« Last Edit: July 08, 2008, 09:07:02 AM by alias »

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: Objective-C
« Reply #7 on: July 08, 2008, 02:29:15 PM »
I have ran into a problem.


Lets say I have two buttons on the screen. One button is called "Add Beep", another is called "Beep".

I have the beep in a for command that beeps from 1 to the add beep variable.

When you press the add beep button, it adds onto that variable so it can beep multiple times when you press beep.

But, the problem I find is that I have to initialize that variable each time I click the button, so it can never go any higher.
 How do I make a variable that I won't have to int each time I click the button?


-Gandolf

P.S. If you still have your calculator source, do you think I could take a look at it?
« Last Edit: July 08, 2008, 02:29:54 PM by Gandolf »

alias


  • Guest
Re: Objective-C
« Reply #8 on: July 08, 2008, 07:30:31 PM »
Sure its at school, it did it as a computer science project, i shall trya dn find it.
I think the problem is it only executes the code from the beginning every time you click each button, where are you writing your code? If its in main.m then thats wrong. If its in the class files then all you need to do is send the variable to be stored in another "object".

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: Objective-C
« Reply #9 on: July 08, 2008, 07:50:53 PM »
Ah. I had it in the .m file. I saw a send variable to another object thing in an example, but I couldn't understand it.

Could you explain?


-Gandolf

alias


  • Guest
Re: Objective-C
« Reply #10 on: July 08, 2008, 10:08:24 PM »
Send me your source code and ill see what i can do. This might be beyond my level, but ill try making an app that does what you say tonight to see if what im saying is right, or if its something else.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: Objective-C
« Reply #11 on: July 17, 2008, 04:03:15 PM »
Ah, I didn't see this post. Well, I gave up on the button thing, and decided to move on to a canvas approach. Open GL is way too complicated.

So, now, I need to make a canvas that sprites will move in. The only problem is, How?

Do I use NSImage, Customview, or ImageCell?

Also, what is the command to send a variable to be stored in another object?


Thanks,
-Gandolf

P.S. Did you ever find the Calculator source?

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: Objective-C
« Reply #12 on: July 17, 2008, 06:14:29 PM »
I figured out why I am having so many problems with Xcodes.

It's because of my limited knowledge in Objective-C. I don't understand it well enough, only a little bit.

Could you explain If Statements, cases, fors, loops, Sending a variable to another object or class, variables, and any knowledge you can think of?


Thanks,
-Gandolf

alias


  • Guest
Re: Objective-C
« Reply #13 on: July 17, 2008, 11:55:54 PM »
if statements are simple
if ((x = 1) && (y = 1))
{ do whats in these brackets}
else
{do whats in these}

heres a loop
do
{do whats in these brackets}
while ((x=1))

Im not sure how variable sending is done, i believe its somthing like the ways its done in TNT

so you have the procedure
procedure(varible that is send)
{code}
return(variable you want to send back)
im sorry i dont know all that much about that, ill have to ask my teacher whens the holidays are over.


BTW objective C doesnt use "canvases" or sprites. The way to open an open GL window is when in the app interface builder theres an open GL icon, after that it gets endlessly confusing.
« Last Edit: July 17, 2008, 11:57:43 PM by alias »

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4408
    • View Profile
Re: Objective-C
« Reply #14 on: July 18, 2008, 10:44:05 AM »
Good news!

Last night I read a 69 page manual on Objective-C, and now it is way easier to understand. ( http://www.cocoalab.com/BecomeAnXcoder.pdf )

Also, I was playing with the ImageView command, and that is perfect for making a canvas in which sprites can travel across and interact without having to learn Open Gl. It's just a little slower, and it doesn't have rotate sprite command.

And, with all the knowledge I gained, I created a calculator from scratch. Next I will look into the key input and how to move a sprite determined by a key press.

Here is the calc: http://www.mediafire.com/?cicuddgdbt3


Thanks Alias,

-Gandolf