1#pragma once
2
3//********************************************************************************************
4//*
5//*    This file is part of Egoboo.
6//*
7//*    Egoboo is free software: you can redistribute it and/or modify it
8//*    under the terms of the GNU General Public License as published by
9//*    the Free Software Foundation, either version 3 of the License, or
10//*    (at your option) any later version.
11//*
12//*    Egoboo is distributed in the hope that it will be useful, but
13//*    WITHOUT ANY WARRANTY; without even the implied warranty of
14//*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15//*    General Public License for more details.
16//*
17//*    You should have received a copy of the GNU General Public License
18//*    along with Egoboo.  If not, see <http://www.gnu.org/licenses/>.
19//*
20//********************************************************************************************
21
22// This is a silly file so that we can keep tin internals of the egoboo_console_t hidden,
23// while allowing lua_console to "inherit" the egoboo_console_t structure
24
25#include "egoboo_console.h"
26#include "font_ttf.h"
27
28//--------------------------------------------------------------------------------------------
29//--------------------------------------------------------------------------------------------
30
31#define EGOBOO_CONSOLE_LINES   32
32#define EGOBOO_CONSOLE_LENGTH 256
33#define EGOBOO_CONSOLE_PROMPT '>'
34#define EGOBOO_CONSOLE_OUTPUT 4096
35
36#define EGOBOO_CONSOLE_WRITE_LEN 1024
37
38//--------------------------------------------------------------------------------------------
39//--------------------------------------------------------------------------------------------
40
41/// The encapsulation of the data necessary to run a generic Quake-like console in Egoboo
42struct s_egoboo_console
43{
44    egoboo_console_t           * pnext;
45
46    egoboo_console_callback_t    run_func;
47    void                       * run_data;
48
49    Font * pfont;
50
51    SDL_bool on;
52
53    SDL_Rect rect;
54
55    int    save_count;
56    int    save_index;
57    char   save_buffer[EGOBOO_CONSOLE_LINES][EGOBOO_CONSOLE_LENGTH];
58
59    size_t buffer_carat;
60    char   buffer[EGOBOO_CONSOLE_LENGTH];
61
62    size_t output_carat;
63    char   output_buffer[EGOBOO_CONSOLE_OUTPUT];
64};
65
66//--------------------------------------------------------------------------------------------
67//--------------------------------------------------------------------------------------------
68
69extern egoboo_console_t * egoboo_console_top;
70