Cursor INSIDE an 8x8 grid.

How would I get my cursor to move INSIDE the grid?

My grid.

1
2
3
4
5
6
7
8
extern char mainGrid[8][8] = {	{ 'X','X','X','X','X','X','X','X', },
								{ 'X','X','X','X','X','X','X','X', },
								{ 'X','X','X','X','X','X','X','X', },
								{ 'X','X','X','X','X','X','X','X', },
								{ 'X','X','X','X','X','X','X','X', },
								{ 'X','X','X','X','X','X','X','X', },
								{ 'X','X','X','X','X','X','X','X', },
								{ 'X','X','X','X','X','X','X','X', } };


Some basic functionality:

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
26
27
28
29
30

void grid()
{
	for (int x = 0; x < 8; x++) {
		for (int y = 0; y < 8; y++) {
			if (x == position[0] && y == position[1])
				cout << character;
			else 
				cout << mainGrid[x][y];
			cout << " ";
			
		}	
		cout << endl;
	}
	
	cout << "Hit enter." << cin.get();
	position[1] = 1;
	system("cls");
	
	for (int x = 0; x < 8; x++) {
		for (int y = 0; y < 8; y++) {
			if (x == position[0] && y == position[1])
				cout << character;
			else 
				cout << mainGrid[x][y];
			cout << " ";
		}
		cout << endl;
	}
	cout << "Done! Press Enter." << cin.get();


I have some code set up for the numpad:

1
2
3
4
#define VK_NUMPAD8 0x68;
#define VK_NUMPAD2 0x62;
#define VK_NUMPAD6 0x66;
#define VK_NUMPAD4 0x64; 
Last edited on
Topic archived. No new replies allowed.