Sunday, April 6, 2008
A simple game I'm working on
Click to go to the game's page
Sunday, December 9, 2007
Intro to NetBeans
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


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
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.