Monday, January 28, 2008

Yay...Error!

For computer class today I typed up quite a bit of code. It was code for a windows program and typing it up helped a lot. What didn't help is the fact that the compiler wasn't able to run it (quite the list of errors I might add!). I think I'm going to try C&Ping the code into Microsoft C++ compiler. Makes sense that the windows program should work in the Microsoft compiler...

I'm not really sure how to use MS Visual C++ but it's been mentally added to the list of things to learn. I had a pretty bad headache during comp class today and had to drink water every few minutes, but luckily it didn't hang around all day!

...water is such a good invention...

http://www.cprogramming.com/tutorial/opengl_first_windows_app.html

(link = code I typed (!C&P) into Dev C++)

Sunday, January 27, 2008

Windows App?

So I started finding out about tutorials on windows applications in C++. I asked Zhanar about it but all I could get out of her was "explore" so that's what I'm doing. I did a bit of research and it seems that there is some 'tension' between people using Microsoft DirectX and OpenGL. I decided to learn how to use OpenGL because that's the one I have a tutorial for. It seems the major difference between the two is that DirectX includes things for video and sound and other devices whereas OpenGL is solely video.

The tutorial is from the same website that I have been using (www.cprogramming.com). It has an easy to read format and makes sense to me most of the time. Details are described, which is important. There are tons of 'complicated' things to know about windows programs. For instance, the include thing is not but rather which makes sense, I guess.

One thing I instantly noticed about windows code was that it had things that I remembered from Visual Basic. Glancing at the example of code (hello world) on the cprogramming tutorial I could see a section where things such as size, cursor, or background could be assigned. The Visual Basic alternative would be the nice list of parameters for each form.

If all goes well, things should begin to sink in soon. I'm still rather baffled by all of this weird windows ... things? I don't even know what to call them......

Friday, January 25, 2008

Endless Loops

So I edited my help menu and while debugging ran into something nasty. When I type in a bunch of random letters I get an endless amount of error text. I need to then shut down the game. This is no good, but it must be solved at a later date.

Add it to the to-do list :]

Configurationsering

So as of now:

At school I have a login on a computer as Indy which is configured with Dev C++ and Firefox (tabbed for cprogramming.com and blogger.com perhaps?)

At home I'm configured for everything I do....

I have my intermediary flash drive with my programs on it. If this dies, all is not lost, for I have multiple copies on my home computer.

TODO: I've drawn up this concept in my mind. I'd like to be designing a "game engine" as such that when it is run, the code accesses ASCII files. If these files are then modified, the game can be easily edited without having to read pages of code, sí? Sí.

As of now, the program has all the text embedded in the code. Trying to edit this is like trying to edit a document that has been typed in notepad with returns for the end of the page. It's hard, to say the least.

Future goal: break away from this stupid little command window thingy :]

Wednesday, January 23, 2008

Strings!

Ok, so I've just learned some things about strings. My first RPG was rather lame. It had no loops (only if statements) and all the code was inside main (no functions... although none were 'needed'). I've been developing a more advanced version of the same RPG to make use of constant actions such as "get" or "inv" (to fill or access the characters inventory full of deviousness). Here is a sample of code:



#include
#include


using namespace std;

int main(){

char action[50]; //para: what do you want to do?

int actionnum; //a number assigned to the action for case

while( x == 1 ){
cin.getline ( action, 50, '\n' );

if( strcmp ( action, "get" ) == 0 || strcmp ( action, "take" ) == 0 ){
actionnum = 1;
cout<<"You get some stuff.\n";
}
}
}


So this program will prompt for the string "action" (cin.getline ... ). It then checks to see if the string "action" has the text "get" inside of it. This is done with the strcmp function. "strcmp" checks to see if two strings are equal or greater than or less than. If the first string is less than the second, it will return a negative value, if they are equal, it will return zero, and if the first string is greater, it will return a positive value. The if statement here just checks to see if they are equal. If they are, the function displays some text. ("You get some stuff.")

I've tested this setup in my program and it seems to be working quite well!

First Program

This summary is not available. Please click here to view the post.