s/display/draw.
This commit is contained in:
@@ -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,
|
||||
@@ -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 *);
|
||||
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user