Please help me

Started by
4 comments, last by TIMPAN 19 years, 5 months ago
Ummm ... this is my first post , well I got this problem with handles input , output you know ... I can't seem to learn em , how did you do to learn em ? I am following the tutorials on www.gametutrials.net . Any hints ??? Here is the tutorial ; is this newbie stuff ? I erased all the commets , done by TheTutor at gametutorials.net // Done by TheTutor -- 4/26/03 #include <windows.h> // windows.h contains our DOS friendly functions that we will use #include <iostream> using namespace std; int main() { HANDLE input_handle; HANDLE output_handle; INPUT_RECORD input; COORD pos; DWORD info; CONSOLE_SCREEN_BUFFER_INFO screen_info; input_handle = GetStdHandle(STD_INPUT_HANDLE); output_handle = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO to be filled GetConsoleScreenBufferInfo(output_handle,&screen_info); SetConsoleMode(input_handle, ENABLE_PROCESSED_INPUT); while(1) { pos.X = screen_info.srWindow.Right / 2 - 5; pos.Y = screen_info.srWindow.Bottom / 2; SetConsoleCursorPosition(output_handle,pos ); // actually read. ReadConsoleInput(input_handle,&input,1,&info); if(input.Event.KeyEvent.bKeyDown) { char theChar = (char)input.Event.KeyEvent.uChar.AsciiChar; for(int i = 0; i < 10; ++i) cout << theChar; } } return 0; } /*----------------------------*| TheTutor | | thetutor@gametutorials.com | | © 2000-2003 GameTutorials | \*----------------------------*/ CRAZY stuff if ask me ,,, way to hard to take in all at once !!!
Advertisement
I don't think that a 'tutorial' like this is helpful at all.
First of all it uses Win32 specific API calls only (no std. C/C++ I/O stuff). Secondly it is poorly written (non-std. main() signature, infinitive main loop with no exit condition, ...).

Learn C or C++ basics instead of legacy API crap like that.


The above comment is very subjective. There might be people who think that stuff like that code you posted is actually useful.

Good luck anyway,
Pat.
>>The above comment is very subjective. There might be people who think that stuff like that code you posted is actually useful.

Not me
I agree totally.
If you are writing a Console application, I would use the iostream functions cin and cout.
Aww hey ... usefull or not I am gonna learn it like anything else :-) . And plus I got a commet " use cin and count "
_ Am I gonna do a text game ??? Yes I will but hey .. just asking since I'm going thrug all the www.gametutorials.net so I will someday get to the nitty stuff ... Meanwhile I will keep on ground zero since IMO it is very important to have solid ground to stand on , even if it's a forgot API or whatever someone said.
And plus if I just use cout and cin I woulden't be able to force the user to use the keyboard and what fun is that , not impossible but IMO the user shuld have an large amount of ways to express actions , not to many thu ... the amount of actions should increse under the games jurney :-) . And it's always good to try to do something creative with the knowlage you got , but never be passive to learn new things :-) !
Umm I seemd like you guys thought that I was a total noob but this is some of the things I have masterd so far


First C++ Program / Done

Keyboard Input / Done

For Loop / Done

For Loop Part2 / Done

While Loop / Done

While Loop Part2 / Done

Do While Loop / Done

If Statement / Done

If Statement Part2 / Done

Switch Statement / Done

Conditional Statements / Done

Operator Precedence / Done

Binary Operators / Fuggy logic

Preprocessor Directives / Done

Strings / Done

Functions / Done

Functions Part2 / Done

Random Numbers / Done

Macros / Can't remember ...

Random Numbers and Macros / Done

Arrays / Done

Structures / Done

Reading From a File / Done

Reading From a File Part2 / Done

Writing to a File / Done

Recursion / Done! Easy

Ternary Operator / Done

Pointers / Done

Pointers Part2 / Done

References / Some tactics are undefined

Dynamic Memory / Done

< YOU ARE HERE >

Introduction to Console Functions


Where there is an Done after I fully understand and I also improve , I am not the one who made this learning list the friendly people at gametutorials did ! I am not braging but I
just thought you'd be should know why I am learning this ... so please no more ... umm the dusty old api ; Wow have you been living under stone or what ? :-)

This topic is closed to new replies.

Advertisement