-
Console Functions Help
Ok, this is for people who have played "Dungeon of Moria", search for it on the forum if you don't know what I'm talking about, but back to the point. I would like to know how exactly he got the frames like he did, and how he go the message selection stuff *if anyone needs clearification on the latter, just ask*. I looked at the source, but I am not currently using MSVC++.
-
You can find a description of the window console functions at http://msdn.microsoft.com. I think this is what you are talking about.
- Sean
-
I've already been there, couldn't find anything
-
i basically made a window making function:
http://www.cprogramming.com/cboard/s...7&pagenumber=1
(scroll down a little on the page)
then i made the message thingy so that it is up to a specific lenght (check out the msg.h file) and then go to my source and check out line 393 which is this:
Code:
void printmessage (int last)
{
HANDLE hStdout;
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hStdout, FOREGROUND_RED);
for(count=0; count<=43; count++)
message1[count]=message2[count];
for(count=0; count<=43; count++)
message2[count]=message3[count];
for(count=0; count<=43; count++)
message3[count]=msg[last][count];
gotoxy(1,20);
printf("%s", message1);
gotoxy(1,21);
printf("%s", message2);
gotoxy(1,22);
printf("%s", message3);
SetConsoleTextAttribute(hStdout, FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN);
}
message1/2/3 are all global so that their content isn't cleared when the function is exited, so basically each message is 43 characters long, the 2 first for statements take the mesage below it and take it up one so lets say your screen looks like this:
dungeon
of
moria
the next time the function is called it prints the stuff like this
of
moria
(new message)
msg[last][count] is the variable (2 dimensional char array) that has all the messages, when i wanted to print a message i just type something like: printmessage(7); it goes in the function takes up the messages one space up and finds message 7 in msg.h it then takes the content to message3, and then message1/2/3 are all printed on 3 consecutive lines.
hope that was clear.
-
most of it was, thank you
-
I have a problem with the game function, I get this: "error before '}' ", and here's the code that it's talking about:
Code:
void game ()
{
HANDLE hStdout;
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
do{
SetConsoleTextAttribute (hStdout, 14);
SetConsoleTextAttribute (hStdout, bluef | greenf | redf);
} //<- this do loop is the error
}
void updateitems()
{
*Note, rest of updateitems() code is working and such*
-
>> this do loop is the error
Well, a do loop needs a while condition at it's end.
Code:
do
{
// something
}while( you still need to );
Why do you need to loop just the changing of the colour?