s/display/draw.
This commit is contained in:
		
							parent
							
								
									28ce3e07bd
								
							
						
					
					
						commit
						06782215b2
					
				
							
								
								
									
										4
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
									
									
									
									
								
							| @ -12,7 +12,7 @@ SRC_OBJECTS = ${SRC_DIR}/common.o   \ | |||||||
|               ${SRC_DIR}/deck.o     \
 |               ${SRC_DIR}/deck.o     \
 | ||||||
|               ${SRC_DIR}/cursor.o   \
 |               ${SRC_DIR}/cursor.o   \
 | ||||||
|               ${SRC_DIR}/keyboard.o \
 |               ${SRC_DIR}/keyboard.o \
 | ||||||
|               ${SRC_DIR}/display.o  \
 |               ${SRC_DIR}/draw.o     \
 | ||||||
|               ${SRC_DIR}/game.o     \
 |               ${SRC_DIR}/game.o     \
 | ||||||
| 
 | 
 | ||||||
| TESTS_EXECUTABLE = ttysolitaire_test | TESTS_EXECUTABLE = ttysolitaire_test | ||||||
| @ -24,7 +24,7 @@ TESTS_OBJECTS = ${TESTS_DIR}/frame_test.o       \ | |||||||
|                 ${TESTS_DIR}/deck_test.o        \
 |                 ${TESTS_DIR}/deck_test.o        \
 | ||||||
|                 ${TESTS_DIR}/cursor_test.o      \
 |                 ${TESTS_DIR}/cursor_test.o      \
 | ||||||
|                 ${TESTS_DIR}/keyboard_test.o    \
 |                 ${TESTS_DIR}/keyboard_test.o    \
 | ||||||
|                 ${TESTS_DIR}/display_test.o     \
 |                 ${TESTS_DIR}/draw_test.o        \
 | ||||||
|                 ${TESTS_DIR}/game_test.o        \
 |                 ${TESTS_DIR}/game_test.o        \
 | ||||||
|                 ${TESTS_DIR}/test_helper.o      \
 |                 ${TESTS_DIR}/test_helper.o      \
 | ||||||
|                 ${TESTS_DIR}/test_helper_test.o \
 |                 ${TESTS_DIR}/test_helper_test.o \
 | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ | |||||||
| #include <string.h> | #include <string.h> | ||||||
| #include <ncurses.h> | #include <ncurses.h> | ||||||
| 
 | 
 | ||||||
| #include "display.h" | #include "draw.h" | ||||||
| #include "deck.h" | #include "deck.h" | ||||||
| #include "game.h" | #include "game.h" | ||||||
| 
 | 
 | ||||||
| @ -12,6 +12,12 @@ static const char *card_values[13] = { | |||||||
|   "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" |   "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | void draw_greeting() { | ||||||
|  |   mvprintw(10, 27, "Welcome to tty-solitaire."); | ||||||
|  |   mvprintw(11, 8, "Move with \u2190\u2191\u2192\u2193 or hjkl. Use the space bar to mark and move cards."); | ||||||
|  |   mvprintw(12, 19, "Press the space bar to play or q to quit."); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static void draw_value(struct card *card) { | static void draw_value(struct card *card) { | ||||||
|   mvwprintw(card->frame->window, 0, 0, card_values[card->value]); |   mvwprintw(card->frame->window, 0, 0, card_values[card->value]); | ||||||
|   mvwprintw(card->frame->window, |   mvwprintw(card->frame->window, | ||||||
| @ -1,5 +1,5 @@ | |||||||
| #ifndef DISPLAY_H | #ifndef TTY_SOLITAIRE_DRAW_H | ||||||
| #define DISPLAY_H | #define TTY_SOLITAIRE_DRAW_H | ||||||
| 
 | 
 | ||||||
| #include "card.h" | #include "card.h" | ||||||
| #include "stack.h" | #include "stack.h" | ||||||
| @ -11,6 +11,7 @@ | |||||||
| #define WHITE_ON_BLUE  3 | #define WHITE_ON_BLUE  3 | ||||||
| #define WHITE_ON_GREEN 4 | #define WHITE_ON_GREEN 4 | ||||||
| 
 | 
 | ||||||
|  | void draw_greeting(); | ||||||
| void draw_card(struct card *); | void draw_card(struct card *); | ||||||
| void draw_stack(struct stack *); | void draw_stack(struct stack *); | ||||||
| void draw_deck(struct deck *); | void draw_deck(struct deck *); | ||||||
| @ -9,7 +9,7 @@ | |||||||
| #include "card.h" | #include "card.h" | ||||||
| #include "stack.h" | #include "stack.h" | ||||||
| #include "deck.h" | #include "deck.h" | ||||||
| #include "display.h" | #include "draw.h" | ||||||
| #include "cursor.h" | #include "cursor.h" | ||||||
| #include "curses.h" | #include "curses.h" | ||||||
| #include "common.h" | #include "common.h" | ||||||
| @ -160,12 +160,6 @@ static void deal_cards(struct deck *deck) { | |||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void greet_player() { |  | ||||||
|   mvprintw(10, 27, "Welcome to tty-solitaire."); |  | ||||||
|   mvprintw(11, 8, "Move with \u2190\u2191\u2192\u2193 or hjkl. Use the space bar to mark and move cards."); |  | ||||||
|   mvprintw(12, 19, "Press the space bar to play or q to quit."); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void initialize_game() { | void initialize_game() { | ||||||
|   clear(); |   clear(); | ||||||
|   refresh(); |   refresh(); | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ | |||||||
| #include "stack.h" | #include "stack.h" | ||||||
| #include "game.h" | #include "game.h" | ||||||
| #include "cursor.h" | #include "cursor.h" | ||||||
| #include "display.h" | #include "draw.h" | ||||||
| #include "curses.h" | #include "curses.h" | ||||||
| 
 | 
 | ||||||
| static struct stack **cursor_stack(struct cursor *cursor) { | static struct stack **cursor_stack(struct cursor *cursor) { | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| #include <ncurses.h> | #include <ncurses.h> | ||||||
| #include <locale.h> | #include <locale.h> | ||||||
| 
 | 
 | ||||||
|  | #include "draw.h" | ||||||
| #include "game.h" | #include "game.h" | ||||||
| #include "keyboard.h" | #include "keyboard.h" | ||||||
| 
 | 
 | ||||||
| @ -24,7 +25,7 @@ int main(int argc, const char *argv[]) { | |||||||
|   init_pair(3, COLOR_WHITE, COLOR_BLUE); |   init_pair(3, COLOR_WHITE, COLOR_BLUE); | ||||||
|   init_pair(4, COLOR_WHITE, COLOR_GREEN); |   init_pair(4, COLOR_WHITE, COLOR_GREEN); | ||||||
| 
 | 
 | ||||||
|   greet_player(); |   draw_greeting(); | ||||||
| 
 | 
 | ||||||
|   while (key != KEY_SPACEBAR) { |   while (key != KEY_SPACEBAR) { | ||||||
|     switch (key = getch()) { |     switch (key = getch()) { | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| #include <assert.h> | #include <assert.h> | ||||||
| #include <stdbool.h> | #include <stdbool.h> | ||||||
| #include "../src/display.h" | #include "../src/draw.h" | ||||||
| 
 | 
 | ||||||
| void test_display() { | void test_draw() { | ||||||
|   assert(true); |   assert(true); | ||||||
| } | } | ||||||
| @ -8,7 +8,7 @@ int main(int argc, const char *argv[]) { | |||||||
|   test_card(); |   test_card(); | ||||||
|   test_cursor(); |   test_cursor(); | ||||||
|   test_deck(); |   test_deck(); | ||||||
|   test_display(); |   test_draw(); | ||||||
|   test_frame(); |   test_frame(); | ||||||
|   test_game(); |   test_game(); | ||||||
|   test_keyboard(); |   test_keyboard(); | ||||||
|  | |||||||
| @ -4,7 +4,7 @@ | |||||||
| void test_card(); | void test_card(); | ||||||
| void test_cursor(); | void test_cursor(); | ||||||
| void test_deck(); | void test_deck(); | ||||||
| void test_display(); | void test_draw(); | ||||||
| void test_frame(); | void test_frame(); | ||||||
| void test_game(); | void test_game(); | ||||||
| void test_keyboard(); | void test_keyboard(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user