summaryrefslogtreecommitdiff
path: root/src/main.cpp
blob: 5c550dec5b867a27313c83a2924c6d42c79943a9 (plain)
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
31
32
33
34
35
36
37
38
#include "main.hpp"

int main()
{
    Screen s;

    Frame map("scripts/map.txt",0,0);
    Frame view(map,s.getHeight(),s.getWidth(),0,0);

    Character cursor('X',map.getHeight()/2,map.getWidth()/2);

    map.fillWindow();
    map.add(cursor);
    view.center(cursor);
    view.refresh(); 
    
    while(true)
    {
        char c = getch();

        if	(c == 'h')
		map.add(cursor,cursor.getRow(),cursor.getCol()-1);
        else if	(c == 'l')
            	map.add(cursor,cursor.getRow(),cursor.getCol()+1);
        else if	(c == 'k')
            	map.add(cursor,cursor.getRow()-1,cursor.getCol());
        else if	(c == 'j')
            	map.add(cursor,cursor.getRow()+1,cursor.getCol());
        else if	(c == 'q')
            	break;

        view.center(cursor);
        view.refresh();
        map.fillWindow();
    }

    return 0;
}