forked from WartyMN/F256-FileManager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomm_buffer.h
105 lines (74 loc) · 3.44 KB
/
comm_buffer.h
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* comm_buffer.h
*
* Created on: Oct 21, 2022
* Author: micahbly
*/
// originally for Lich King, adapted for FileManager on Jan 18, 2023
#ifndef COMM_BUFFER_H_
#define COMM_BUFFER_H_
/* about this class: Buffer
*
* This incorporates the overall game world
*
*** things this class needs to be able to do
*
* manage a N row comms buffer
* clear buffer
* refresh buffer (after full screen was used, etc.)
*
*
*** things objects of this class have
*
* char buffers
*
*/
/*****************************************************************************/
/* Includes */
/*****************************************************************************/
// project includes
#include "app.h"
// C includes
#include <stdbool.h>
// cc65 includes
/*****************************************************************************/
/* Macro Definitions */
/*****************************************************************************/
#define COMM_BUFFER_MAX_STRING_LEN 192 // we only allow for one line at a time, but keep a 192b buffer available for overruns?
#define COMM_BUFFER_NUM_COLS (80 - 2) // account for box draw chars
#define COMM_BUFFER_NUM_ROWS 7
#define COMM_BUFFER_FIRST_COL 1 // allow for 1 col of box draw chars
#define COMM_BUFFER_FIRST_ROW 52
#define COMM_BUFFER_LAST_COL (COMM_BUFFER_NUM_COLS - 0)
#define COMM_BUFFER_LAST_ROW 58
#define COMM_BUFF_SIZE (COMM_BUFFER_NUM_ROWS * (COMM_BUFFER_NUM_COLS + 1))
// comms buffer box
#define COMM_BUFFER_BOX_NUM_COLS (COMM_BUFFER_NUM_COLS + 2) // with box draw chars
#define COMM_BUFFER_BOX_NUM_ROWS (COMM_BUFFER_NUM_ROWS + 2) // with box draw chars
#define COMM_BUFFER_BOX_FIRST_COL (COMM_BUFFER_FIRST_COL - 1)
#define COMM_BUFFER_BOX_LAST_COL (COMM_BUFFER_LAST_COL + 1)
#define COMM_BUFFER_BOX_FIRST_ROW (COMM_BUFFER_FIRST_ROW - 1)
#define COMM_BUFFER_BOX_LAST_ROW (COMM_BUFFER_LAST_ROW + 1)
/*****************************************************************************/
/* Enumerations */
/*****************************************************************************/
/*****************************************************************************/
/* Structs */
/*****************************************************************************/
/*****************************************************************************/
/* Global Variables */
/*****************************************************************************/
/*****************************************************************************/
/* Public Function Prototypes */
/*****************************************************************************/
// Draw the status and message area framework
void Buffer_DrawCommunicationArea(void);
// fake allocs the buffer memory area. does not change screen display
void Buffer_Initialize(void);
// resets the buffer memory area to spaces, and pushes that change to the screen display
void Buffer_Clear(void);
// transfers all buffer lines to the screen display
void Buffer_RefreshDisplay(void);
// accepts a message as the bottom most row and displays it, scrolling other lines up
void Buffer_NewMessage(char* the_message);
#endif /* COMM_BUFFER_H_ */