1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/*
* =====================================================================================
*
* 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 <ncurses.h>
#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);
};
|