I don't know how to draw a ASCll character

Jan 5, 2015 at 4:29am
I am unsure of how to draw a ASCll character to work this code that i found on this forum post:
http://www.cplusplus.com/forum/beginner/85814/


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <windows.h>
#include <dos.h>
#include <conio.h>
using namespace std;

int x=0, y=0;
void gotoXY(int argX, int argY);
int main(){
    while(true){
        if(GetAsyncKeyState(VK_UP))
            gotoXY(x, y+1);
        if(GetAsyncKeyState(VK_DOWN))
            gotoXY(x, y-1);
        if(GetAsyncKeyState(VK_LEFT))
            gotoXY(x-1, y);
        if(GetAsyncKeyState(VK_RIGHT))
            gotoXY(x+1, y);
    }
}

void gotoXY(int argX, int argY){
    x=argX;
    y=argY;
}


Please Help
Jan 5, 2015 at 6:56am
Sorry, what is it you are trying to do? As far as I know, for what you want, cout << "ascii character here"; works just fine.

The code you are posting basically is a test for if a key is being pressed, and sets the int values of x and y according to what is being pressed. It is occurring in an ongoing loop, thus constantly testing for these states.
Jan 6, 2015 at 7:03am
Oops Thankyou that clears some things up
Topic archived. No new replies allowed.