Archived

This topic is now archived and is closed to further replies.

Pipo DeClown

Input Output NewB AI

Recommended Posts

Pipo DeClown    804
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...
__________________________________________________________________________________________

Share this post


Link to post
Share on other sites
Pipo DeClown    804
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...
__________________________________________________________________________________________

Share this post


Link to post
Share on other sites
Pipo DeClown    804
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...
__________________________________________________________________________________________

Share this post


Link to post
Share on other sites