   help with basic win32
  I am trying to move the cursor around in the console but it only moves once perdirection so the most I can move it is up one or down one or left one or right one...why cant it keep going?heres my main:#include <iostream>#include <string>#include "Enemy.h"using namespace std;int main(){HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);    COORD Position;COORD newPos;Position.X=0;Position.Y=0;   Enemy_ animal;while(true){newPos=Enemy_::Move(animal,1,Position);SetConsoleCursorPosition(hOut,newPos);}system("pause");return 0;}and heres the movement or "Enemy" class in another file:#include <conio.h>#include <windows.h>class Enemy_{int x,y;char input;public:Enemy_();static COORD Move(Enemy_ here,int amount,COORD news);};Enemy_::Enemy_(){x=0;y=0;input=' ';}COORD Enemy_::Move(Enemy_ here,int amount,COORD news){here.input=_getch();if(here.input=='s'){here.y+=amount;}if(here.input=='w'){here.y-=amount;}if(here.input=='d'){here.x+=amount;}if(here.input=='a'){here.x-=amount;}news.X=here.x;news.Y=here.y;return news;}
  IIRC conio.h is not standard. It only works with Borland AFAIK. You shouldn't use it.Besides, I don't have experience on this console setting position thing, but a couple of ideas:1) Can conio.h be the problem? I guess mixing conio.h function calls with win32API calls (like SetConsoleCursorPosition, which seems quite win32) could be a bad idea. Just a thought, but you can give it a look.2) I don't see any code which prints to the screen. Are you only seeing how the cursor moves? Perhaps if you print something, it appears in the right position.   ;  ok I see your point on the conio...but getch works whereas cin shows the input and moves the cursor automaticaly after each keypress...so it doesnt work for me):any other way?oh, and using getche to show the content gives the same results as just the cursor..gah..   ;  Looks like a logical error to me:You're always passing Position to enemy move and store its return value in newpos. But you never assign newpos to Position, therefore you always start out from the start position.Try this:while ( true ){  newPos = Enemy_::Move( animal, 1, Position );    SetConsoleCursorPosition( hOut, newPos );  // store the new position in our variable  Position = newPos;};Quote:Original post by BlueBan007ok I see your point on the conio...but getch works whereas cin shows the input and moves the cursor automaticaly after each keypress...so it doesnt work for me):any other way?oh, and using getche to show the content gives the same results as just the cursor..gah..You can try with getchar, but I'm not sure if it will work. You must #include <cstdio>   