Advertisement

Input Output NewB AI

Started by April 29, 2002 06:34 AM
4 comments, last by Pipo DeClown 22 years, 6 months ago
How can you create a frame to write you source code in?
Hi! I have a problem, i think this should be an AI-thing but i''m not quite suire. #include <iostream.h> #include <stdlib.h> #include <fstream.h> #include <string.h> #include <conio.h> #include <stdio.h> #include <windows.h> #include <string> using namespace std; void main() { HANDLE OutputH; HANDLE InputH; INPUT_RECORD i_r; COORD pos; DWORD event=FALSE; OutputH = GetStdHandle(STD_OUTPUT_HANDLE); InputH=GetStdHandle(STD_INPUT_HANDLE); SetConsoleMode(InputH, ENABLE_PROCESSED_INPUT); pos.X=0; pos.Y=0; while(TRUE) { SetConsoleCursorPosition(OutputH, pos); ReadConsoleInput(InputH, &i_r, 1, &event); if (pos.X<0 ||pos.Y<0) { pos.X=0; pos.Y=0; } if(pos.X>80||pos.Y>80) { pos.X=80; pos.Y=80; } if(i_r.Event.KeyEvent.wVirtualKeyCode == VK_RIGHT) { pos.X++; cout <<"||||||||||||||||||||"; } if (i_r.Event.KeyEvent.wVirtualKeyCode == VK_LEFT) { pos.X--; cout<<"||||||||||||||||||||"; } if(i_r.Event.KeyEvent.wVirtualKeyCode == VK_SPACE) { pos.X=30; pos.Y=0; cout<<"||||||||||||||||||||"; } FlushConsoleInputBuffer(InputH); } system("pause"); return 0; } Thank you for helping me! BTW: i''m a newb............... __________________________________________________________________________________________ Can someone be nice and help me on my way to be the next Hideo Kojima? Thought So...
__________________________________________________________________________________________
Sorry! forgot to say what the prob is:

the SPACE key:
When you press it it prints something in the right, but i exually want it to print something in the middle....


Thnx Again!

__________________________________________________________________________________________
Can someone be nice and help me on my way to be the next Hideo Kojima? Thought So...
__________________________________________________________________________________________
Advertisement
Maybe I missed something, but I can''t see what this has to with AI.
[ PGD - The Home of Pascal Game Development! ] [ Help GameDev.net fight cancer ]
RTFM
uhm.........sorry!
But its a IF right?
and plz just tell me the prob~

__________________________________________________________________________________________
Can someone be nice and help me on my way to be the next Hideo Kojima? Thought So...
__________________________________________________________________________________________
No, this is nothing to do with AI. If you are a ''newb'', then post in the ''newb''s forum, which is where I''m moving this incidentally. You should also try reading the Forums FAQ.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions ]

This topic is closed to new replies.

Advertisement