Sunday, April 6, 2008

A simple game I'm working on

Click on the link below to get a view of what I'm working on right now.

Click to go to the game's page

Sunday, December 9, 2007

Intro to NetBeans

Remember my first post? I had you download a program called NetBeans. Now is when I will tell you how it works. This is just an IDE (Integrated Development Environment), it happens to be the best Java IDE I know of. Java, in case you don't already know is a great language for applications that don't have to be the fastest possible program on the earth, but that can easily be deployed onto almost any platform. The only requirement for a platform to run a Java application is that it have a JRE (Java Runtime Environment) installed. To begin with, we are just going to make a console application, but eventually I will dive into GUI (Graphical User Interface, a lot of acronyms in programming...) and even making Midlets. Midlets are applications for mobile devices, your cell phone being a prime example. Sound cool? Good, Java is probably my favorite programming language for the combination of ease of use, portability, and good support. Ok, enough jabber, let's go. Fire up NetBeans, this may take a while depending on your computer.

1) At first you will just see the welcome page. From the file menu select New->New Project, helloworld. Then click finish. We're going to keep things simple here. If you want, you can choose to place all of your java apps into a specific folder at this time. NetBeans will remember this and future projects will be created in the folder you chose.

2) The project has been created, now you should be looking at some code. Let's take a look at what the IDE made for you.

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/


package helloworld;

This line above is just telling java to look for functions inside of the helloworld package before it looks elsewhere.
/**
*
* @author Jeff
*/
Java is an object oriented language, so this line just creates the main object, known as a class in Java, for you project.
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}

}


Saturday, December 8, 2007

My First Tutorial

This will be my first attempt at writing a decent tutorial. For this one I have chosen to use C++. I think my first line of tutorials will be on this language, don't know why, just seems right. Ok,this will be a hello world program, kind of. I am going to walk you through setting up a blank Win32 Console Application in Visuall C++ 8 Express edition, since it's free. First things first, load up VC++, if you don't have it refer to the "What you need" post. Next on the file menu select new->Project or hit Ctrl+Shift+N



You should be looking at an empty _tmain function and an include to some currently unnecessary header files. Let's explain these things.

A header file is just a file that you can include into your application, any functions that you place into the header file will be available in any application which includes it. That is accomplished through the #include compiler directive.

Here is the code:

#include
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
cout<<"Hello World";

return 0;

}

pretty easy huh?

The first thing you see after the #include is 'using namespace std;' This tells the compiler where to look for functions. For now just think of it like that. Very important, but for now just remember to put it there and all will be fine.

Let's look at how a function works.

return_type function_name(arg_type arg_name,...)

_tmain is the name of the function that serves as the entry point to your program. It is run automatically when you run your application. The int argc is an integer (whole number) that tells you how many arguments were passed to your program and _TCHAR* argv[] is an array of character pointers that stores all of the arguments passed into your program. Wow, an array... ok so imagine a chest of drawers. Give each drawer a number. This is pretty much how an array works. Only whereas you can put whatever you want in a drawer, an array is limited to whatever type you make it, in this case a _TCHAR*. Pointers are a bit more complicated. A pointer doesn't actually store the value, it stores the location in memory at which you can find a value. By having an array of pointers you can efficiently store strings (words) of different lengths in the same array. Don't worry if this didn't all make sense. We will be doing more with this stuff later.

now you see 'cout<<"Hello world";' cout is a type of function, it lets you put text to the screen, it's counterpart cin lets you retrieve keyboard input. There are other alternatives which I think I will go into which have more power but are a bit more complex, so for now, we'll be using these for text stuff.

Now, for the 'return 0;' this just returns 0 to whatever called your program, 0 being the default all is well number. You can return whatever number you want. Most functions can return whatever type you want, but this one can only return a number. Well, that's it for now. I will be coming up with some interesting projects to tackle together in a bit. Hope this helps, and be sure to post comments and questions!

Friday, December 7, 2007

The Traditional First Step, Skipped for Definitions

Most people's first application is a "Hello World" app. This seems to be because it is so easy. but before we even do that, let's discuss the different types of coding that you are going to encounter. Each one has different ways of accomplishing your goals. So let's go.

Procedural: This is the most common type of programming. Also, it's the most basic type. In this style of code, the commands are executed one after the next. These are most commonly compiled and then you run the resulting application. C is an example of this type of code.

Scripted: This type of code does not need to be compiled, it runs right from the code you write. Python is a good example of this.

Object Oriented Programming (OOP): This is kind of hard to explain, but Java, C# and C++ are all examples of this type of code. In OOP code, you create objects to contain data, functions and interfaces and then build applications from the objects that you made. I'll explain more in a designated post.

GUI: The means a graphical user interface, although no really a type of code, it s an important concept. This is seen anytime you run a windows application. Buttons, text boxes, windows and all of the other controls you use everyday are all examples of a GUI.

Command Line: Wow, most people don't even know what this is anymore. That black screen with white text into which you enter commands is known as the command line. You can make applications that are extremely powerful and finely controlled with this style of coding. It is also much simpler and so is where we will begin.

What You Need

In order to make your own programs, you need at minimum, a compiler. There are some open source ones but starting a couple years ago, Microsoft started releasing free versions of their Visual Studio IDE (Integrated Development Environment). In order to download the IDEs, you just need to go here. I suggest download the C++ and C# version, ah heck. Get them all. Then, I want you to get a java IDE, my favorite is NetBeans, click here. You can start with the small version but if you have broadband and space to spare, just get the main one so that you can explore more. Well, that about sums it up for now, in the future if you want to do some Database programming get MySQL. Apache (included w/ the biggest version of NetBeans) is a webserver in case you want to do some web programming. Oh yeah, see if you can get a copy of Flash MX,8 or higher. We will probably delve into some ActionScript and Flash programming at some time. My favorite scripting language is Python, I promise we'll do some of that at some point. Let me know if there is something special that you want to do. I'll tell you what you need to accomplish it.