fixed: all ready for input-testing

This commit is contained in:
2024-07-05 19:31:09 -04:00
parent 13519b619d
commit b792b0a8e7
7 changed files with 193 additions and 39 deletions

View File

@ -1,35 +1,35 @@
/*
* CS 246 Final Project
* File: display.h
* Purpose: handles map functionality
*/
#ifndef __DISPLAY_H__
#define __DISPLAY_H__
#include <iostream>
#include <string>
#include <vector>
#include "position.h"
#include "constants.h"
#include "cursor.h"
class display final {
private:
std::vector<std::string> contents;
cursor &curse;
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();
display(cursor &new_curse, int argc, char **argv);
void clear();
// use this instead of overloading for clarity
void print(std::ostream &out) const;
void print_line(const std::string &line, const int linenum);
virtual ~display() = default;
void render() const ;
// Only call this to refresh the entire output
virtual void render() = 0;
// will override any character that was there
void print_position(const position &pos, const char ch);
// Clears the contents buffer
virtual void clear() = 0;
virtual void print_char(const position &pos, const char ch,
const int attr =
A_NORMAL | COLOR_PAIR(COLOR_WHITE)) = 0;
virtual void print_str(const position &pos, const std::string &str,
const int attr =
A_NORMAL | COLOR_PAIR(COLOR_WHITE)) = 0;
// default arguments are to be set in the base class's declaration
};
#endif