s/display/draw.

This commit is contained in:
Murilo Pereira 2011-06-03 03:22:48 -03:00
parent 28ce3e07bd
commit 06782215b2
9 changed files with 20 additions and 18 deletions

View File

@ -12,7 +12,7 @@ SRC_OBJECTS = ${SRC_DIR}/common.o \
${SRC_DIR}/deck.o \
${SRC_DIR}/cursor.o \
${SRC_DIR}/keyboard.o \
${SRC_DIR}/display.o \
${SRC_DIR}/draw.o \
${SRC_DIR}/game.o \
TESTS_EXECUTABLE = ttysolitaire_test
@ -24,7 +24,7 @@ TESTS_OBJECTS = ${TESTS_DIR}/frame_test.o \
${TESTS_DIR}/deck_test.o \
${TESTS_DIR}/cursor_test.o \
${TESTS_DIR}/keyboard_test.o \
${TESTS_DIR}/display_test.o \
${TESTS_DIR}/draw_test.o \
${TESTS_DIR}/game_test.o \
${TESTS_DIR}/test_helper.o \
${TESTS_DIR}/test_helper_test.o \

View File

@ -3,7 +3,7 @@
#include <string.h>
#include <ncurses.h>
#include "display.h"
#include "draw.h"
#include "deck.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"
};
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) {
mvwprintw(card->frame->window, 0, 0, card_values[card->value]);
mvwprintw(card->frame->window,

View File

@ -1,5 +1,5 @@
#ifndef DISPLAY_H
#define DISPLAY_H
#ifndef TTY_SOLITAIRE_DRAW_H
#define TTY_SOLITAIRE_DRAW_H
#include "card.h"
#include "stack.h"
@ -11,6 +11,7 @@
#define WHITE_ON_BLUE 3
#define WHITE_ON_GREEN 4
void draw_greeting();
void draw_card(struct card *);
void draw_stack(struct stack *);
void draw_deck(struct deck *);

View File

@ -9,7 +9,7 @@
#include "card.h"
#include "stack.h"
#include "deck.h"
#include "display.h"
#include "draw.h"
#include "cursor.h"
#include "curses.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() {
clear();
refresh();

View File

@ -5,7 +5,7 @@
#include "stack.h"
#include "game.h"
#include "cursor.h"
#include "display.h"
#include "draw.h"
#include "curses.h"
static struct stack **cursor_stack(struct cursor *cursor) {

View File

@ -1,6 +1,7 @@
#include <ncurses.h>
#include <locale.h>
#include "draw.h"
#include "game.h"
#include "keyboard.h"
@ -24,7 +25,7 @@ int main(int argc, const char *argv[]) {
init_pair(3, COLOR_WHITE, COLOR_BLUE);
init_pair(4, COLOR_WHITE, COLOR_GREEN);
greet_player();
draw_greeting();
while (key != KEY_SPACEBAR) {
switch (key = getch()) {

View File

@ -1,7 +1,7 @@
#include <assert.h>
#include <stdbool.h>
#include "../src/display.h"
#include "../src/draw.h"
void test_display() {
void test_draw() {
assert(true);
}

View File

@ -8,7 +8,7 @@ int main(int argc, const char *argv[]) {
test_card();
test_cursor();
test_deck();
test_display();
test_draw();
test_frame();
test_game();
test_keyboard();

View File

@ -4,7 +4,7 @@
void test_card();
void test_cursor();
void test_deck();
void test_display();
void test_draw();
void test_frame();
void test_game();
void test_keyboard();