/* * ===================================================================================== * * Filename: frame.hpp * * Description: Abstractions around NCurses windows * * Version: 1.0 * Created: 01/07/2023 09:55:52 PM * Revision: none * Compiler: gcc * * Author: Cara Salter (muirrum), cara@devcara.com * Organization: * * ===================================================================================== */ #pragma once #include #include "mob.hpp" class Frame { // dimensions int _height, _width; // Position int _row, _col; // FALSE when root window and TRUE for a subwindow bool _has_super; // Pointer to an ncurses window WINDOW* _w; // The super-window, if exists WINDOW* _super; public: // Init with no parent Frame(int nr_rows, int nr_cols, int row_0, int col_0); // Init with parent window Frame(Frame &super, int nr_rows, int nr_cols, int row_0, int col_0); ~Frame(); // Get window type bool has_super(); WINDOW* win(); WINDOW *super(); // Get height of window int height(); int width(); int row(); int col(); void refresh(); void move(int r, int c); // Fill a window with numbers, for debugging // Will look like this: // 0 | 1 // ----- // 2 | 3 void fill_window(); void move_window(int r, int c); void erase(Mob &x); // Add a mob to the window void place_mob(Mob &x); void place_mob(Mob &x, int row_0, int col_0); // Center viewport around mob void center(Mob &x); void gen_Perlin(const unsigned int &seed); };