Friday, April 8, 2011

Learning Basics of Objective-C


WHAT YOU NEED
To make iPhone and iPod Touch games/apps you need to have an apple computer, a iphone developer's license, the iPhone SDK (software development kit), and the knowledge of Programming in Objective-C. When I say apple computer, I mean a real Macintosh. I don't think just having Mac OS X on a Windows computer will work. An iPhone developer's license is $99 a year and you don't NEED that until you want to put your app on to the App Store. The iPhone SDK includes all the tools necessary for making iPhone and iPod apps. Finally, I said you needed knowledge of Programming in Objective-C. Unless you hire a programmer to program for you, you have to know Objective-C, which is what you are going to learn, if you continue reading...


CLASSES, OBJECTS, and METHODS
First concept you should know in Objective-C is that it is an object oriented programming language. Object Oriented programming is a programming paradigm that uses "objects." First off I am going to give definitions (very simple ones):
Object- a thing, commonly referred to as an instance
Method- actions that are performed on the object/instance
Class- where object/instances comes from
OK, I will give you an example so you can easily understand this. Lets say you own a computer. You have a specific computer; one no one else has (an object obviously cant be two places at once). Your specific computer is an instance of a computer. You do certain things to your computer, certain actions, like going on the internet, using email, playing games, or watching movies. Theses actions would be referred to as methods. So in this example the class would be called Computer, your instance would be your specific computer (lets name it myComputer), and the methods for this class would be:
-(void) goInternet;
-(void) useEmail;
-(void) playGame;
-(void) watchMovie;

Notice how I wrote them. That is the way you define your methods. First there is either going to be a plus or minus sign which means if it is a class method or instance method. Next there is the return type (in this case all void). Then there is the method name that you make (you can come up with, usually written in camel case form as I did).
XCODE: Xcode is the programming environment application you use to actually insert and edit code. When you create a new project there will be 2 separate files. One called @interface and the other @implementation. The @interface file (.h) is where you describe the class, and you define the methods and instance variables. The @implementation file (.m) is where you put in the actual code that implements your defined methods. This is how an interface file would look like:

@interface NewClassName: ParentClassName
{
//All your Instance Variable Declarations Go here!
}

methodDeclarations
@end
This is how an implementation file would look like:
@implementation NewClassName;
//All your method definitions Go Here!
@end

Instance variables make up your class. So say you had a class named Computer. Say that the Computer class has the instance variables name, age, size. Every Computer object you made would be made out of a name, age, and size. This is how you would declare (define) those variables:
int name;
int age;
int size;
The int part is the data type which will be discussed in the next section.

OK, the last thing I want to include in this section is show you the specific syntax used for applying methods to your Classes or instances: [classOrInstanceName method];
An example of a class method that would go with the above examples is:
myComputer = [Computer new];
The method new is a factory or class method. It is being applied to the Computer class. This method would return data and store it in the object myComputer.


DATA TYPES
Includes int, float, double, char, and more!
int- most basic data type, a variable declared as int can hold integral values
float- variable declared as float can be used to store values that has decimal values
double- similar to float, variable declared as double can store about twice as many digits as float
char- stores single character
id- variable declared as id can store any object of any type, this variable is important for some more advanced concepts like polymorphism and dynamic binding which is used a lot


LOOPING AND DECISIONS
The majority of the time when you are programming in Objective-C you use logic. You will most likely have to go through loops and have your program make decisions based on certain things.
A very popular decision making statement is th if-statement. The syntax goes like this:
if(boolean expression) {
//Code in here gets implemented if boolean is true
}
You can also do this which is called the if else statement:
if(boolean expression) {
//Code in here gets implemented if boolean is true
}else{
//Code in here gets implemented if boolean is false
}
Next is looping with the for statement. Here is an example:
int i= 0;
for(i = 0; i < 100; i++){
//Code here
}
So the code will be run, i will be incremented, i will be checked to see if it is less than 100 and if so the loop will continue. One way to stop a loop is to use a break; statement.
OK, one other loop to use is the while loop. The basic syntax for the while loop is:
while(condition){
//Code
}
This is almost like the if statement but it keeps running the code in the brackets until the condition is false.

INHERITANCE
This is a fairly easy concept to understand. Remember all the way up in the Classes, Objects, and Methods section on this page? I showed how the interface file looked like. In there it says ParentClassName. When you have a Parent class(the class that is at the top of all the other classes in a big hierarchy is NSObject, so you always get the methods of that class) you get all the methods and variables of that parent and you can automatically have them without having to rewrite them. The child of the parent class is also known as the subclass. The process of subclassing is very popular. When you want to subclass, you pick an existing class and put it into the place of the ParentClassName spot.

Monday, March 28, 2011

Mobile Game Programming (Beginning)


I think the best way to start out this topic and page (and develop on this subject) is to first get out all the basics and work my way into more complex subjects. Im reading a book called Learning iOS Game Programming by Michael Daley, and it is really good. It covers a whole bunch of ground. I just thought I'd mention that in case your looking for a good book. Back on Mobile Game Programming, I am definitely going to do it like I said above. Also the way I wanted this website to work, is for you guys to ask a question, and I would post it with an answer.

Saturday, March 19, 2011

Intuos 4 Wacom Tablet


Ok, above is my Intuos 4 Medium Wacom Tablet. As you can see it includes the pen, a mouse, a pen stand (which holds all the extra nibs), and the tablet itself. The pen is nice because it captures the slightest nuance of pressure with precision and accuracy. The pen also has customizable side switches. The mouse is nice because it is cordless and battery-free. Finally, the tablet has customizable expresskeys, a user-defined touch ring, touch ring toggle, and a wide format. Not only that but when you buy this tablet you get a lot of software applications from Adobe, Corel, and Autodesk. So I realized that this tablet was the one for me.

Thursday, March 17, 2011

How to Make drawings on the computer? (Beginning)


I used to think "How do artists draw really good drawings and graphics on the computer with there mouse." Then I heard about drawing on a sheet of paper and scanning it to your computer, and uploading it to a drawing/illustrating program (adobe) and tracing it. But still after you did that you would still have to trace it with a mouse. Then I found out about the tablet. There are many tablets including the Wacom tablets. A tablet is basically a device where you have the tablet itself and then a pen. You draw on the tablet with your pen and BAM its on the computer (you can still go through the same process above, drawing, scanning, tracing with your tablet).

What is the best drawing tablet brand? I would say it would be Wacom. Wacom is very popular and has a lot of good drawing tablet models so you don't have to pick from just two. The three types of Wacom tablets are: Bamboo, Intuos, and Cintiq. In each type there are many different tablets. The one I have is the Intuos 4 (medium), and I will post some pictures of it later on today or maybe this week. Its for the average tablet drawer. The Wacom Bamboo tablets are more for people who don't draw as much, and the Wacom Cintiq tablets are for serious pros (in my opinion, you might think differently).

Tuesday, March 15, 2011

Making Mobile Games (Beginning)


On this website, including all the other things im going to do, I will be discussing and informing you guys on what it takes to make games for phones such as the iPhone 4 or for Android. I might have a couple videos and most everything of this topic will be on the Mobile or Make/Design page of this website. Making iphone and android apps (games) requires the knowledge of programming in code and making graphics for your app (you might not need to though). So maybe in a matter of a couple of days I will have something out of this topic but right now I am just planning out what Im going to do.

Monday, March 14, 2011

Jailbreaking: What is it?


JAILBREAKING is basically a process that allows iPhone and iPod Touch users to run any code on their devices, as opposed to only the code authorized by APPLE. So when you JAILBREAK your apple device, you are running code that wasnt given to you by apple, but by hackers and pro modders who made a customized iOS for you. Is JAILBREAKING legal? Yes it is 100% legal, its just what you do after JAILBREAKING your device. Like if you download cracked applications (free apps that you usually have to pay for) on your apple device, now thats illegal.
Now that you know what it is how do you do it? Well first you need what I call a JAILBREAKER application. Then you need a customized iOS(There are different ones for each device and version). When you open your JAILBREAKER application, it should give you instructions on how to jailbreak your device, using your customized iOS.
Right now I am having trouble JAILBREAKING my iphone 4, 4.3, because PWNAGE Tool (a JAILBREAKER) needs to be patched up and fixed.

Sunday, March 13, 2011

Welcome!

This website/blog will be mostly about and include things related to Technology, Mobile phones and Games, Graphic Design, and Engineering. That means making games for mobile phones, jailbreaking for iPhone/iPod, drawing graphic images with a tablet, and other things like new technology. This site is for teens by a teen (but that doesn't mean no one else aloud).