renamed display to output
This commit is contained in:
@ -8,17 +8,17 @@
|
||||
|
||||
#include "constants.h"
|
||||
#include "input/file_input.h"
|
||||
#include "display/file_output.h"
|
||||
#include "output/file_output.h"
|
||||
#include "input/console_input.h"
|
||||
#include "display/console_output.h"
|
||||
#include "output/console_output.h"
|
||||
#include "input/curses_input.h"
|
||||
#include "display/curses_output.h"
|
||||
#include "output/curses_output.h"
|
||||
#include "rng.h"
|
||||
|
||||
feature proc_args(int argc, char **argv,
|
||||
std::unique_ptr<cursor> &curse,
|
||||
std::unique_ptr<input> &in,
|
||||
std::unique_ptr<display> &out,
|
||||
std::unique_ptr<output> &out,
|
||||
std::unique_ptr<RNG> &rng) {
|
||||
feature result = 0;
|
||||
std::string str;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define __ARGUMENTS_H__
|
||||
#include <memory>
|
||||
#include "cursor.h"
|
||||
#include "display.h"
|
||||
#include "output.h"
|
||||
#include "input.h"
|
||||
#include "rng.h"
|
||||
|
||||
@ -12,7 +12,7 @@ typedef unsigned int feature;
|
||||
feature proc_args(int argc, char **argv,
|
||||
std::unique_ptr<cursor> &curse,
|
||||
std::unique_ptr<input> &in,
|
||||
std::unique_ptr<display> &out,
|
||||
std::unique_ptr<output> &out,
|
||||
std::unique_ptr<RNG> &rng);
|
||||
|
||||
void panic_args(feature panic);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "constants.h"
|
||||
|
||||
CC3K::CC3K(const feature enabled_features,
|
||||
input *in, display *out, RNG *rng):
|
||||
input *in, output *out, RNG *rng):
|
||||
enabled_features{enabled_features},
|
||||
in{in}, out{out}, rng{rng} {
|
||||
curr_menu = std::make_unique<menu>(enabled_features);
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define __CC3K_H__
|
||||
|
||||
#include "input.h"
|
||||
#include "display.h"
|
||||
#include "output.h"
|
||||
#include "game.h"
|
||||
#include "menu.h"
|
||||
#include "result.h"
|
||||
@ -11,7 +11,7 @@ class CC3K final {
|
||||
private:
|
||||
const feature enabled_features;
|
||||
input *in;
|
||||
display *out;
|
||||
output *out;
|
||||
RNG *rng;
|
||||
|
||||
game_result gresult;
|
||||
@ -19,7 +19,7 @@ private:
|
||||
std::unique_ptr<menu> curr_menu;
|
||||
public:
|
||||
CC3K(const feature enabled_features,
|
||||
input *in, display *out, RNG *rng);
|
||||
input *in, output *out, RNG *rng);
|
||||
game_status run();
|
||||
};
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <memory>
|
||||
#include <math.h>
|
||||
|
||||
#include "display.h"
|
||||
#include "output.h"
|
||||
#include "fraction.h"
|
||||
#include "position.h"
|
||||
#include "potions.h"
|
||||
@ -31,7 +31,7 @@ public:
|
||||
virtual void apply_effect(potion *effect);
|
||||
|
||||
// override for different types
|
||||
virtual void print(display *out) = 0;
|
||||
virtual void print(output *out) = 0;
|
||||
|
||||
result calc_effects();
|
||||
void discard_level_effects();
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "position.h"
|
||||
|
||||
/* Attributes
|
||||
A_NORMAL Normal display (no highlight)
|
||||
A_NORMAL Normal output (no highlight)
|
||||
A_STANDOUT Best highlighting mode of the terminal.
|
||||
A_UNDERLINE Underlining
|
||||
A_REVERSE Reverse video
|
||||
|
@ -1,17 +0,0 @@
|
||||
#include "display.h"
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
display::display():
|
||||
contents{DISPLAY_BUFFER_SIZE, 0} {
|
||||
for (int i = 0; i < DISPLAY_BUFFER_SIZE; ++i)
|
||||
contents.push_back(0);
|
||||
}
|
||||
|
||||
void display::clear() {
|
||||
contents.clear();
|
||||
contents.reserve(DISPLAY_BUFFER_SIZE);
|
||||
|
||||
for (int i = 0; i < DISPLAY_BUFFER_SIZE; ++i)
|
||||
contents.push_back(0);
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
#ifndef __DISPLAY_H__
|
||||
#define __DISPLAY_H__
|
||||
|
||||
#include <ncurses.h>
|
||||
#include <vector>
|
||||
#include "position.h"
|
||||
#include "cursor.h"
|
||||
|
||||
class display {
|
||||
protected:
|
||||
// use an array of ints to keep track of what's on the screen
|
||||
// This will have a bit of buffer for the last line
|
||||
// just in case it overflows
|
||||
std::vector<int> contents;
|
||||
public:
|
||||
display();
|
||||
|
||||
virtual ~display() = default;
|
||||
|
||||
// Only call this to refresh the entire output
|
||||
virtual void render() = 0;
|
||||
|
||||
// Clears the contents buffer
|
||||
virtual void clear();
|
||||
|
||||
virtual void print_char(const position &pos, const char ch,
|
||||
const int attrs =
|
||||
A_NORMAL | COLOR_PAIR(COLOR_WHITE)) = 0;
|
||||
virtual void print_str(const position &pos, const std::string &str,
|
||||
const int attrs =
|
||||
A_NORMAL | COLOR_PAIR(COLOR_WHITE)) = 0;
|
||||
// default arguments are to be set in the base class's declaration
|
||||
};
|
||||
|
||||
#endif
|
@ -1,100 +0,0 @@
|
||||
#include "console_output.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <ncurses.h>
|
||||
|
||||
#include "../constants.h"
|
||||
|
||||
console_output::console_output(std::ostream &cout): out{cout} {}
|
||||
|
||||
/* Attributes
|
||||
black 30 40
|
||||
red 31 41
|
||||
green 32 42
|
||||
yellow 33 43
|
||||
blue 34 44
|
||||
magenta 35 45
|
||||
cyan 36 46
|
||||
white 37 47
|
||||
reset 0 (everything back to normal)
|
||||
bold/bright 1 (often a brighter shade of the same colour)
|
||||
underline 4
|
||||
inverse 7 (swap foreground and background colours)
|
||||
bold/bright off 21
|
||||
underline off 24
|
||||
inverse off 27
|
||||
|
||||
Format:
|
||||
\033[X;Ym
|
||||
X Y are numbers from above
|
||||
*/
|
||||
|
||||
std::string console_output::get_code(const int attrs) {
|
||||
if (attrs < 255)
|
||||
return "\033[0m";
|
||||
|
||||
std::string result = "\033[0m\033[";
|
||||
|
||||
if (attrs & A_BOLD)
|
||||
result += "1;";
|
||||
|
||||
if (attrs & A_UNDERLINE)
|
||||
result += "4;";
|
||||
|
||||
if (attrs & A_STANDOUT)
|
||||
result += "7;";
|
||||
|
||||
if ((attrs & COLOR_PAIR(COLOR_WHITE)) == COLOR_PAIR(COLOR_WHITE))
|
||||
result += "37;";
|
||||
else if ((attrs & COLOR_PAIR(COLOR_CYAN)) == COLOR_PAIR(COLOR_CYAN))
|
||||
result += "36;";
|
||||
else if ((attrs & COLOR_PAIR(COLOR_MAGENTA)) == COLOR_PAIR(COLOR_MAGENTA))
|
||||
result += "35;";
|
||||
else if ((attrs & COLOR_PAIR(COLOR_BLUE)) == COLOR_PAIR(COLOR_BLUE))
|
||||
result += "34;";
|
||||
else if ((attrs & COLOR_PAIR(COLOR_YELLOW)) == COLOR_PAIR(COLOR_YELLOW))
|
||||
result += "33;";
|
||||
else if ((attrs & COLOR_PAIR(COLOR_RED)) == COLOR_PAIR(COLOR_RED))
|
||||
result += "31;";
|
||||
else if ((attrs & COLOR_PAIR(COLOR_GREEN)) == COLOR_PAIR(COLOR_GREEN))
|
||||
result += "32;";
|
||||
else if ((attrs & COLOR_PAIR(COLOR_BLACK_ON_WHITE)) == COLOR_BLACK_ON_WHITE)
|
||||
result += "30;47;";
|
||||
|
||||
result[result.length() - 1] = 'm';
|
||||
return result;
|
||||
}
|
||||
|
||||
void console_output::render() {
|
||||
out << "\x1B[2J\x1B[H";
|
||||
|
||||
for (std::size_t idx = 0; idx < contents.size(); ++idx) {
|
||||
if (idx % DISPLAY_WIDTH == 0 && idx)
|
||||
out << std::endl;
|
||||
|
||||
out << get_code(contents[idx])
|
||||
<< (char)(contents[idx] ? contents[idx] : ' ');
|
||||
}
|
||||
|
||||
out << std::endl;
|
||||
}
|
||||
|
||||
void console_output::print_char(const position &pos, const char ch,
|
||||
const int attrs) {
|
||||
if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT)
|
||||
return;
|
||||
|
||||
contents[pos.y * DISPLAY_WIDTH + pos.x] = attrs | ch;
|
||||
}
|
||||
|
||||
void console_output::print_str(const position &pos, const std::string &str,
|
||||
const int attrs) {
|
||||
if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT)
|
||||
return;
|
||||
|
||||
int head = pos.y * DISPLAY_WIDTH + pos.x;
|
||||
|
||||
for (std::size_t i = 0; i < str.length(); ++i)
|
||||
contents[i + head] = attrs | str[i];
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
#ifndef __CONSOLE_OUTPUT_H__
|
||||
#define __CONSOLE_OUTPUT_H__
|
||||
|
||||
#include <iostream>
|
||||
#include "../display.h"
|
||||
|
||||
class console_output final : public display {
|
||||
private:
|
||||
std::ostream &out;
|
||||
std::string get_code(const int attrs);
|
||||
public:
|
||||
console_output(std::ostream &cout);
|
||||
|
||||
void render() override;
|
||||
void print_char(const position &pos,
|
||||
const char ch, const int attrs) override;
|
||||
void print_str(const position &pos,
|
||||
const std::string &str, const int attrs) override;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,38 +0,0 @@
|
||||
#include "curses_output.h"
|
||||
|
||||
#include "../constants.h"
|
||||
|
||||
curses_output::curses_output(cursor *new_curse):
|
||||
curse{new_curse} {}
|
||||
|
||||
void curses_output::render() {
|
||||
curse->show();
|
||||
}
|
||||
|
||||
void curses_output::clear() {
|
||||
curse->clear();
|
||||
}
|
||||
|
||||
void curses_output::print_char(const position &pos, const char ch,
|
||||
const int attrs) {
|
||||
if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT)
|
||||
return;
|
||||
|
||||
curse->print_char(pos, ch, attrs);
|
||||
}
|
||||
|
||||
void curses_output::print_str(const position &pos, const std::string &str,
|
||||
const int attrs) {
|
||||
if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT)
|
||||
return;
|
||||
|
||||
position tmp = pos;
|
||||
|
||||
for (std::size_t i = 0; i < str.length(); ++i) {
|
||||
curse->print_char(tmp, str[i], attrs);
|
||||
tmp += {1, 0};
|
||||
|
||||
if (tmp.x >= DISPLAY_WIDTH)
|
||||
tmp = {0, tmp.y + 1};
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
#ifndef __CURSES_OUTPUT_H__
|
||||
#define __CURSES_OUTPUT_H__
|
||||
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include "../cursor.h"
|
||||
#include "../display.h"
|
||||
|
||||
class curses_output final : public display {
|
||||
private:
|
||||
cursor *curse;
|
||||
public:
|
||||
curses_output(cursor *new_curse);
|
||||
|
||||
void render() override;
|
||||
void clear() override;
|
||||
void print_char(const position &pos,
|
||||
const char ch, const int attrs) override;
|
||||
void print_str(const position &pos,
|
||||
const std::string &str, const int attrs) override;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,38 +0,0 @@
|
||||
#include "file_output.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "../constants.h"
|
||||
|
||||
file_output::file_output(std::ofstream &&ofs):
|
||||
out{std::move(ofs)} {}
|
||||
|
||||
void file_output::render() {
|
||||
for (std::size_t idx = 0; idx < contents.size(); ++idx) {
|
||||
if (idx % DISPLAY_WIDTH == 0 && idx)
|
||||
out << std::endl;
|
||||
|
||||
out << (char)(contents[idx] ? contents[idx] : ' ');
|
||||
}
|
||||
|
||||
out << std::endl;
|
||||
}
|
||||
|
||||
void file_output::print_char(const position &pos, const char ch,
|
||||
const int attrs) {
|
||||
if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT)
|
||||
return;
|
||||
|
||||
contents[pos.y * DISPLAY_WIDTH + pos.x] = ch;
|
||||
}
|
||||
|
||||
void file_output::print_str(const position &pos, const std::string &str,
|
||||
const int attrs) {
|
||||
if (pos.x >= DISPLAY_WIDTH || pos.y >= DISPLAY_HEIGHT)
|
||||
return;
|
||||
|
||||
int head = pos.y * DISPLAY_WIDTH + pos.x;
|
||||
|
||||
for (std::size_t i = 0; i < str.length(); ++i)
|
||||
contents[i + head] = str[i];
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
#ifndef __FILE_OUTPUT_H__
|
||||
#define __FILE_OUTPUT_H__
|
||||
|
||||
#include <fstream>
|
||||
#include "../display.h"
|
||||
|
||||
class file_output final : public display {
|
||||
private:
|
||||
std::ofstream out;
|
||||
public:
|
||||
file_output(std::ofstream &&ofs);
|
||||
|
||||
void render() override;
|
||||
void print_char(const position &pos,
|
||||
const char ch, const int attrs) override;
|
||||
void print_str(const position &pos,
|
||||
const std::string &str, const int attrs) override;
|
||||
};
|
||||
|
||||
#endif
|
@ -6,7 +6,7 @@ dragon::dragon(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num):
|
||||
enemy_base{rng, enabled_features, rdragon, pos, gen_room_num, "D"} {}
|
||||
|
||||
void dragon::print(display *out) {
|
||||
void dragon::print(output *out) {
|
||||
out->print_char(pos, 'D', COLOR_PAIR(COLOR_RED));
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ class dragon final: public enemy_base {
|
||||
public:
|
||||
dragon(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num);
|
||||
void print(display *out) override;
|
||||
void print(output *out) override;
|
||||
const char *get_race_name() const override;
|
||||
long_result act(level *lvl, character *pc, bool hostile) override;
|
||||
};
|
||||
|
@ -6,7 +6,7 @@ dwarf::dwarf(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num):
|
||||
enemy_base{rng, enabled_features, rdwarf, pos, gen_room_num, "W"} {}
|
||||
|
||||
void dwarf::print(display *out) {
|
||||
void dwarf::print(output *out) {
|
||||
out->print_char(pos, 'W', COLOR_PAIR(COLOR_RED));
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ class dwarf final: public enemy_base {
|
||||
public:
|
||||
dwarf(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num);
|
||||
void print(display *out) override;
|
||||
void print(output *out) override;
|
||||
const char *get_race_name() const override;
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@ elf::elf(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num):
|
||||
enemy_base{rng, enabled_features, relf, pos, gen_room_num, "E"} {}
|
||||
|
||||
void elf::print(display *out) {
|
||||
void elf::print(output *out) {
|
||||
out->print_char(pos, 'E', COLOR_PAIR(COLOR_RED));
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ class elf final: public enemy_base {
|
||||
public:
|
||||
elf(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num);
|
||||
void print(display *out) override;
|
||||
void print(output *out) override;
|
||||
const char *get_race_name() const override;
|
||||
long_result attack(character *ch) override;
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ halfling::halfling(RNG *rng, const feature enabled_features,
|
||||
const int gen_room_num):
|
||||
enemy_base{rng, enabled_features, rhalfling, pos, gen_room_num, "L"} {}
|
||||
|
||||
void halfling::print(display *out) {
|
||||
void halfling::print(output *out) {
|
||||
out->print_char(pos, 'L', COLOR_PAIR(COLOR_RED));
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class halfling final: public enemy_base {
|
||||
public:
|
||||
halfling(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num);
|
||||
void print(display *out) override;
|
||||
void print(output *out) override;
|
||||
const char *get_race_name() const override;
|
||||
long_result get_hit(character *ch, const int tATK,
|
||||
const fraction &hit_rate);
|
||||
|
@ -6,7 +6,7 @@ human::human(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num):
|
||||
enemy_base{rng, enabled_features, rhuman, pos, gen_room_num, "H"} {}
|
||||
|
||||
void human::print(display *out) {
|
||||
void human::print(output *out) {
|
||||
out->print_char(pos, 'H', COLOR_PAIR(COLOR_RED));
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ class human final: public enemy_base {
|
||||
public:
|
||||
human(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num);
|
||||
void print(display *out) override;
|
||||
void print(output *out) override;
|
||||
const char *get_race_name() const override;
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@ merchant::merchant(RNG *rng, const feature enabled_features,
|
||||
const position &pos, const int gen_room_num):
|
||||
enemy_base{rng, enabled_features, rmerchant, pos, gen_room_num, "M"} {}
|
||||
|
||||
void merchant::print(display *out) {
|
||||
void merchant::print(output *out) {
|
||||
out->print_char(pos, 'M', COLOR_PAIR(COLOR_RED));
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ class merchant final: public enemy_base {
|
||||
public:
|
||||
merchant(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num);
|
||||
void print(display *out) override;
|
||||
void print(output *out) override;
|
||||
const char *get_race_name() const override;
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@ orc::orc(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num):
|
||||
enemy_base{rng, enabled_features, rorc, pos, gen_room_num, "O"} {}
|
||||
|
||||
void orc::print(display *out) {
|
||||
void orc::print(output *out) {
|
||||
out->print_char(pos, 'O', COLOR_PAIR(COLOR_RED));
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ class orc final: public enemy_base {
|
||||
public:
|
||||
orc(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num);
|
||||
void print(display *out) override;
|
||||
void print(output *out) override;
|
||||
const char *get_race_name() const override;
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
game::game(const enum race starting_race,
|
||||
const feature enabled_features,
|
||||
input *new_in,
|
||||
display *new_out,
|
||||
output *new_out,
|
||||
RNG *new_rng):
|
||||
enabled_features{enabled_features},
|
||||
in{new_in}, out{new_out}, rng{new_rng},
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define __GAME_H__
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "display.h"
|
||||
#include "output.h"
|
||||
#include "input.h"
|
||||
#include "rng.h"
|
||||
#include "characters.h"
|
||||
@ -22,7 +22,7 @@ private:
|
||||
const feature enabled_features;
|
||||
|
||||
input *in;
|
||||
display *out;
|
||||
output *out;
|
||||
RNG *rng;
|
||||
|
||||
unsigned int curr_turn;
|
||||
@ -42,7 +42,7 @@ public:
|
||||
game(const enum race starting_race,
|
||||
const feature enabled_features,
|
||||
input *new_in,
|
||||
display *new_out,
|
||||
output *new_out,
|
||||
RNG *new_rng);
|
||||
game_result run();
|
||||
size_t get_curr_level() const;
|
||||
|
@ -131,7 +131,7 @@ void level::gen_potions(RNG *rng, std::vector<position_list> &tiles) {
|
||||
}
|
||||
}
|
||||
|
||||
void level::print(display *out) const {
|
||||
void level::print(output *out) const {
|
||||
map.print(out);
|
||||
|
||||
for (size_t i = 0; i < plist.size(); ++i)
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "display.h"
|
||||
#include "output.h"
|
||||
#include "gold.h"
|
||||
#include "enemies.h"
|
||||
#include "enemy.h"
|
||||
@ -33,7 +33,7 @@ public:
|
||||
// read map from a string
|
||||
level(const std::string &map_data, character *player, RNG *rng,
|
||||
const feature enabled_features);
|
||||
void print(display *out) const;
|
||||
void print(output *out) const;
|
||||
|
||||
bool is_available(const position &pos, bool is_player = false) const;
|
||||
bool is_available_all(const position &pos) const;
|
||||
|
@ -7,7 +7,7 @@
|
||||
int main(int argc, char **argv) {
|
||||
std::unique_ptr<cursor> curse;
|
||||
std::unique_ptr<input> in;
|
||||
std::unique_ptr<display> out;
|
||||
std::unique_ptr<output> out;
|
||||
std::unique_ptr<RNG> rng;
|
||||
|
||||
feature enabled_features = proc_args(argc, argv, curse, in, out, rng);
|
||||
|
@ -124,7 +124,7 @@ position_list game_map::get_available_around(const position &pos) const {
|
||||
return result;
|
||||
}
|
||||
|
||||
void game_map::print(display *out) const {
|
||||
void game_map::print(output *out) const {
|
||||
for (std::size_t i = 0; i < map.size(); ++i)
|
||||
out->print_char(remap_index(i), map[i] <= 9 ? '.' : map[i],
|
||||
map[i] == '\\' || map[i] == '>' ||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "display.h"
|
||||
#include "output.h"
|
||||
#include "position.h"
|
||||
#include "rng.h"
|
||||
#include "fraction.h"
|
||||
@ -64,7 +64,7 @@ public:
|
||||
position_list get_room_list(int idx) const;
|
||||
std::vector<position_list> get_room_list() const;
|
||||
// IMPORTANT: always print a map before anything else
|
||||
void print(display *out) const;
|
||||
void print(output *out) const;
|
||||
|
||||
position get_up_stairs() const;
|
||||
position get_down_stairs() const;
|
||||
|
@ -159,7 +159,7 @@ const char *MSG_NCURSES =
|
||||
"Move with movement commands, press 'e' to confirm, 'q' to quit.";
|
||||
const position SEED_POS = {1, 25};
|
||||
|
||||
void menu::print(display *out, const unsigned int seed) {
|
||||
void menu::print(output *out, const unsigned int seed) {
|
||||
if (enabled_features & FEATURE_EXTRA_STUFF)
|
||||
out->print_str({0, 0}, NORMAL_SCREEN);
|
||||
else
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define __MENU_H__
|
||||
|
||||
#include "position.h"
|
||||
#include "display.h"
|
||||
#include "output.h"
|
||||
#include "input.h"
|
||||
|
||||
typedef unsigned int feature;
|
||||
@ -15,7 +15,7 @@ private:
|
||||
public:
|
||||
menu(const feature enabled_features);
|
||||
int run(input *in);
|
||||
void print(display *out, const unsigned int seed);
|
||||
void print(output *out, const unsigned int seed);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@ player_base::player_base(RNG *rng, const feature enabled_features,
|
||||
const enum race &nrace):
|
||||
character{rng, enabled_features, nrace, {0, 0}}, gold_cnt(0) {}
|
||||
|
||||
void player_base::print(display *out) {
|
||||
void player_base::print(output *out) {
|
||||
out->print_char(pos, '@', COLOR_PAIR(COLOR_BLUE));
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
|
||||
virtual void add_gold(int amount);
|
||||
|
||||
void print(display *out) override;
|
||||
void print(output *out) override;
|
||||
|
||||
std::string get_abbrev() const override;
|
||||
|
||||
|
@ -43,7 +43,7 @@ potion &potion::operator=(potion &&p) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void potion::print(display *out) {
|
||||
void potion::print(output *out) {
|
||||
out->print_char(pos, 'P', COLOR_PAIR(COLOR_GREEN));
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include "fraction.h"
|
||||
#include "display.h"
|
||||
#include "output.h"
|
||||
|
||||
enum potion_type : int;
|
||||
enum race : int;
|
||||
@ -36,7 +36,7 @@ public:
|
||||
void set_pos(const position &npos);
|
||||
virtual const char *get_name() const = 0;
|
||||
|
||||
virtual void print(display *out);
|
||||
virtual void print(output *out);
|
||||
};
|
||||
|
||||
typedef std::vector<potion *> potion_list;
|
||||
|
@ -39,7 +39,7 @@ void game_result::run(input *in) {
|
||||
in->get_command();
|
||||
}
|
||||
|
||||
void game_result::print(display *out) {
|
||||
void game_result::print(output *out) {
|
||||
out->print_str({0, 0}, WIN_SCREEN);
|
||||
out->print_str(MSG_START, msg, COLOR_PAIR(COLOR_YELLOW));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define __RESULT_H__
|
||||
|
||||
#include <string>
|
||||
#include "display.h"
|
||||
#include "output.h"
|
||||
#include "input.h"
|
||||
|
||||
enum game_status : int;
|
||||
@ -12,7 +12,7 @@ struct game_result final {
|
||||
std::string msg;
|
||||
|
||||
void run(input *in);
|
||||
void print(display *out);
|
||||
void print(output *out);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user