グラフィックス.hおよびconio.hライブラリの使用方法を学習しようとしています.キーボード入力後に長方形を移動する必要があるグラフィックプログラムを開発しています.ex:プレーヤーが右を押すと、長方形は右側に移動する必要があります.問題は私ですユーザー入力を取得する方法がわかりません。ループ内でユーザー入力を連続的に取得する必要があります。これが私のコードです。どんな助けでも大歓迎です(キーワード、関数名など)
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <math.h>
void drawrect(int left,int top,int right,int bot);
int main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:\\TC\\BGI");
drawrect(5,400,40,450); // default start position
firsttime=1;//counter for if its first time in for loop
int currentl=5;
int currentt=400;
int currentr=40;
int currentb=450;
if(firsttime==1)
{
//get user input and drawrectangle with new inputs
//if player press right add 5 to currentl and current r and
//redraw the rectangle
}
getch();
closegraph();
}
void drawrect(int left,int top,int right,int bot)
{
rectangle(left,top,right,bot);
}