Does anyone have an idea how can i get the coordinates so i will know where am i typing when i use coordinates.
Like
x=5, y=20; i know approximately where that is, but i need the exact thing.
Does anyone have an idea how can i get the coordinates so i will know where am i typing when i use coordinates.
Like
x=5, y=20; i know approximately where that is, but i need the exact thing.
To do this you have to use goto coordinates.
The line of code would look like this:
but to make this work in your code, you need to create a function to understand the above coide.. here is one i created for my games:Code:gotoxy(12,15);cout << "text goes here";
Code:void gotoxy( int x, int y ) { COORD c; c.X = x - 1 ; c.Y = y - 1 ; // TO REMEMBER: 1ST NUMBER SPACES IN :: 2ND NUMBER SPACES DOWN SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), c ) ; }
You also need to understand that the above code requires <windows.h> and will only run on the Windows operating system. There is no standard way.
From C to shining C++!
Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
- Bubba
IDE and Compiler - Code::Blocks with MinGW
Operating System - Windows XP Professional x64 Edition
This is a platform dependant operation. These details would be appropriate now. You might look into:
Low-level I/O <= Windows
NCURSES (?) <= *nix
Edit: do you just wanna move the cursor around with that "gotoxy" or do you want to recieve notifications of user input in character cell coordinates?