Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2105 - 1
#include <curses.h>
2
#include "main.h"
3
#include "frame.h"
4
 
5
int main_y,main_x,sub_y,sub_x;
6
WINDOW *main_window;
7
WINDOW *stay_window;
8
WINDOW *sub_window;
9
 
10
void frame_print(const char *msg, int clear, int center){
11
        if(clear){
12
                wclear(sub_window);
13
                if(center){
14
                        mvwprintw(sub_window,(main_y/4)-1,2,msg);
15
                }else{
16
                        mvwprintw(sub_window,2,2,msg);
17
                }
18
        }else{
19
                wprintw(sub_window, msg);
20
        }
21
        frame_refresh();
22
}
23
 
24
void frame_values(char *msg, int row, int line){
25
        mvwprintw(sub_window,line,row,msg);
26
        frame_refresh();
27
}
28
 
29
void frame_stay(char *msg, char* pad_frame, int axis_frame, int buttons_frame){
30
        mvwprintw(stay_window,2,2,msg,pad_frame,axis_frame,buttons_frame);
31
        wrefresh(stay_window);
32
        frame_refresh();
33
}
34
 
35
void frame_refresh(){
36
    box(sub_window,0,0);
37
        wrefresh(sub_window);
38
}
39
 
40
void frame_init(){
41
    initscr();
42
    noecho();
43
    curs_set(FALSE);
44
    getmaxyx(stdscr,main_y,main_x);
45
    sub_y = main_y/3;
46
    sub_x = main_x/4;
47
    main_window = newwin(main_y, main_x, 0, 0);
48
    stay_window = newwin(main_y/4, main_x/8, main_y/16, main_x/2-main_x/16);
49
    sub_window = newwin(main_y,main_x/2,sub_y,sub_x);
50
    start_color();    
51
    init_pair(1, COLOR_RED, COLOR_WHITE);
52
    wbkgd(main_window,COLOR_PAIR(1));
53
    wbkgd(stay_window,COLOR_PAIR(1));
54
    wbkgd(sub_window,COLOR_PAIR(1));
55
    box(main_window,0,0);
56
    box(sub_window,0,0);
57
    mvwprintw(main_window,0,(main_x/2)-strlen(TITLE)/2,TITLE);
58
    mvwprintw(main_window,main_y-1,(main_x/2)-strlen(COPY)/2,COPY);
59
    wrefresh(main_window);
60
    wrefresh(sub_window);
61
}