]> git.mdlowis.com Git - archive/afm.git/commitdiff
Added sources to gemfile.lock. Main now has two windows being created
authorMichael D. Lowis <mike@mdlowis.com>
Thu, 17 Jul 2014 01:39:11 +0000 (21:39 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Thu, 17 Jul 2014 01:39:11 +0000 (21:39 -0400)
Gemfile.lock
source/main.c

index 2f577ebd82d3d9039d898f4b01abcfab0aeae62b..7248244077934ab529df446b3c6361cf46e190a0 100644 (file)
@@ -1,4 +1,5 @@
 GEM
+  remote: https://rubygems.org/
   specs:
     json (1.8.1)
     rake (10.3.2)
index 45366f25b59c8f60b439db5d5c990268a5bdfc4e..094a6797294bb6d660bb8a7f598bca254d448e90 100644 (file)
@@ -1,23 +1,49 @@
 #include <ncurses.h>
 #include <stdbool.h>
 
-bool Running = true;
+static bool Running = true;
+static WINDOW* WindowLeft;
+static WINDOW* WindowRight;
 
 void handle_input(char ch) {
     if(ch == 'q')
         Running = false;
 }
 
+WINDOW* create_window(int x, int y, int height, int width) {
+    WINDOW* p_win = newwin(height, width, y, x);
+    box(p_win, 0, 0);
+    wrefresh(p_win);
+    return p_win;
+}
+
+void destroy_window(WINDOW* p_win) {
+    /* Erase remnants of the window */
+    wborder(p_win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
+    wrefresh(p_win);
+    /* Delete the window */
+    delwin(p_win);
+}
+
 int main(int argc, char** argv) {
+    /* Initialize ncurses and user input settings */
     initscr();
     raw();
     keypad(stdscr, TRUE);
     noecho();
-    printw("Hello, World! Please Press 'q' to quit.");
+    refresh();
+    /* Create the left and right windows */
+    WindowLeft  = create_window(0,0,20,20);
+    WindowRight = create_window(20,0,20,20);
     while(Running) {
-        refresh();
+        wprintw(WindowLeft,  "Left");
+        wprintw(WindowRight, "Right");
+        wrefresh(WindowLeft);
+        wrefresh(WindowRight);
         handle_input(getch());
     }
+    destroy_window(WindowLeft);
+    destroy_window(WindowRight);
     endwin();
     return 0;
 }