Number research (closes #3)
This commit is contained in:
parent
7354396a5f
commit
b92fcd4461
@ -18,6 +18,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "company.h"
|
#include "company.h"
|
||||||
#include "mail.h"
|
#include "mail.h"
|
||||||
|
#include "numbers.h"
|
||||||
|
|
||||||
#define KEY_QUIT 'q'
|
#define KEY_QUIT 'q'
|
||||||
|
|
||||||
@ -65,15 +66,17 @@ int main(int argc, const char* argv[])
|
|||||||
|
|
||||||
// setup various status windows
|
// setup various status windows
|
||||||
// the bottom windows will be one row shorter to fit the status line at the end
|
// the bottom windows will be one row shorter to fit the status line at the end
|
||||||
WINDOW* topleft = create_newwin(LINES/3, COLS/2, 0, 0);
|
WINDOW* topleft = create_newwin(LINES/4, COLS/2, 0, 0);
|
||||||
WINDOW* midleft = create_newwin(LINES/3, COLS/2, LINES/3, 0);
|
WINDOW* topmidleft = create_newwin(LINES/4, COLS/2, LINES/4, 0);
|
||||||
WINDOW* botleft = create_newwin(LINES/3 - 1, COLS/2, LINES*2/3, 0);
|
WINDOW* botmidleft = create_newwin(LINES/4, COLS/2, LINES*2/4, 0);
|
||||||
|
WINDOW* botleft = create_newwin(LINES/4 - 1, COLS/2, LINES*3/4, 0);
|
||||||
WINDOW* topright = create_newwin(LINES/2, COLS/2, 0, COLS/2);
|
WINDOW* topright = create_newwin(LINES/2, COLS/2, 0, COLS/2);
|
||||||
WINDOW* botright = create_newwin(LINES/2 - 1, COLS/2, LINES/2, COLS/2);
|
WINDOW* botright = create_newwin(LINES/2 - 1, COLS/2, LINES/2, COLS/2);
|
||||||
|
|
||||||
company_init(topleft, LINES/3, COLS/2);
|
company_init(topleft, LINES/4, COLS/2);
|
||||||
bool_init(midleft, LINES/3, COLS/2);
|
numbers_init(topmidleft, LINES/4, COLS/2);
|
||||||
mail_init(botleft, LINES/3 - 1, COLS/2);
|
bool_init(botmidleft, LINES/4, COLS/2);
|
||||||
|
mail_init(botleft, LINES/4 - 1, COLS/2);
|
||||||
booru_init(botright, LINES/2 - 1, COLS/2);
|
booru_init(botright, LINES/2 - 1, COLS/2);
|
||||||
|
|
||||||
time_t t;
|
time_t t;
|
||||||
@ -81,10 +84,11 @@ int main(int argc, const char* argv[])
|
|||||||
char ch;
|
char ch;
|
||||||
while ((ch = tolower(getch())) != KEY_QUIT)
|
while ((ch = tolower(getch())) != KEY_QUIT)
|
||||||
{
|
{
|
||||||
bool_refresh(NULL);
|
|
||||||
booru_refresh(NULL);
|
|
||||||
mail_refresh(NULL);
|
|
||||||
company_refresh(NULL);
|
company_refresh(NULL);
|
||||||
|
numbers_refresh(NULL);
|
||||||
|
bool_refresh(NULL);
|
||||||
|
mail_refresh(NULL);
|
||||||
|
booru_refresh(NULL);
|
||||||
|
|
||||||
time(&t);
|
time(&t);
|
||||||
tm = *localtime(&t);
|
tm = *localtime(&t);
|
||||||
@ -104,6 +108,7 @@ int main(int argc, const char* argv[])
|
|||||||
bool_destroy();
|
bool_destroy();
|
||||||
booru_destroy();
|
booru_destroy();
|
||||||
mail_destroy();
|
mail_destroy();
|
||||||
|
numbers_destroy();
|
||||||
company_destroy();
|
company_destroy();
|
||||||
|
|
||||||
destroy_win(topleft);
|
destroy_win(topleft);
|
||||||
|
31
FemMonitor/numbers.c
Normal file
31
FemMonitor/numbers.c
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "numbers.h"
|
||||||
|
|
||||||
|
|
||||||
|
static WINDOW* window = NULL;
|
||||||
|
static int height;
|
||||||
|
static int width;
|
||||||
|
|
||||||
|
void numbers_init(WINDOW* win, int h, int w)
|
||||||
|
{
|
||||||
|
window = win;
|
||||||
|
height = h;
|
||||||
|
width = w;
|
||||||
|
|
||||||
|
mvwprintw(window, 0, START_COL, " Number Research ");
|
||||||
|
wrefresh(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void* numbers_refresh(void* arg)
|
||||||
|
{
|
||||||
|
srand((unsigned) time(NULL));
|
||||||
|
mvwprintw(window, START_ROW, START_COL, "%d", rand());
|
||||||
|
wrefresh(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void numbers_destroy()
|
||||||
|
{
|
||||||
|
}
|
10
FemMonitor/numbers.h
Normal file
10
FemMonitor/numbers.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef numbers_h
|
||||||
|
#define numbers_h
|
||||||
|
|
||||||
|
#include <ncurses.h>
|
||||||
|
|
||||||
|
void numbers_init(WINDOW* win, int h, int w);
|
||||||
|
void* numbers_refresh(void* arg);
|
||||||
|
void numbers_destroy(void);
|
||||||
|
|
||||||
|
#endif /* numbers_h */
|
Loading…
x
Reference in New Issue
Block a user