libtcod
Loading...
Searching...
No Matches
console_init.h
Go to the documentation of this file.
1/* BSD 3-Clause License
2 *
3 * Copyright © 2008-2025, Jice and the libtcod contributors.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 *
16 * 3. Neither the name of the copyright holder nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
34#pragma once
35#ifndef LIBTCOD_CONSOLE_INIT_H_
36#define LIBTCOD_CONSOLE_INIT_H_
37
38#include "config.h"
39#include "console.h"
40#include "console_types.h"
41#include "context.h"
42#include "error.h"
43#include "tileset.h"
44
45#ifdef __cplusplus
46extern "C" {
47#endif // __cplusplus
48struct SDL_Rect;
49struct SDL_Window;
50struct SDL_Renderer;
51#ifndef NO_SDL
90TCOD_DEPRECATED(
91 "This way of initializing libtcod is deprecated. See the documentation for how to use TCOD_context_new.")
92TCOD_PUBLIC TCOD_NODISCARD TCOD_Error
93TCOD_console_init_root(int w, int h, const char* title, bool fullscreen, TCOD_renderer_t renderer);
94TCOD_DEPRECATED(
95 "This way of initializing libtcod is deprecated. See the documentation for how to use TCOD_context_new.")
96TCOD_PUBLIC TCOD_NODISCARD TCOD_Error
97TCOD_console_init_root_(int w, int h, const char* title, bool fullscreen, TCOD_renderer_t renderer, bool vsync);
103TCOD_DEPRECATED("This function is not compatible with contexts. Use SDL_SetWindowTitle to change the window title.")
104TCOD_PUBLIC void TCOD_console_set_window_title(const char* title);
110TCOD_DEPRECATED(
111 "This function is not compatible with contexts. Use SDL_SetWindowFullscreen to set the fullscreen state.")
112TCOD_PUBLIC void TCOD_console_set_fullscreen(bool fullscreen);
116TCOD_DEPRECATED("This function is not compatible with contexts. Use SDL_GetWindowFlags to check this.")
117TCOD_PUBLIC bool TCOD_console_is_fullscreen(void);
121TCOD_DEPRECATED("This function is not compatible with contexts. Use SDL_GetWindowFlags to check this.")
122TCOD_PUBLIC bool TCOD_console_has_mouse_focus(void);
132TCOD_DEPRECATED("This function is not compatible with contexts. Use SDL_GetWindowFlags to check this.")
133TCOD_PUBLIC bool TCOD_console_is_active(void);
137TCOD_DEPRECATED("This function is not compatible with contexts. Use SDL for events and check for SDL_QUIT.")
138TCOD_PUBLIC bool TCOD_console_is_window_closed(void);
145TCOD_DEPRECATED("This function is not compatible with contexts.")
146TCOD_PUBLIC struct SDL_Window* TCOD_sys_get_sdl_window(void);
153TCOD_DEPRECATED("This function is not compatible with contexts.")
154TCOD_PUBLIC struct SDL_Renderer* TCOD_sys_get_sdl_renderer(void);
175#endif // NO_SDL
176TCOD_DEPRECATED("This function is not compatible with contexts.")
177TCOD_PUBLIC int TCOD_sys_accumulate_console(const TCOD_Console* console);
178TCOD_DEPRECATED("This function is not compatible with contexts.")
179TCOD_PUBLIC int TCOD_sys_accumulate_console_(const TCOD_Console* console, const struct SDL_Rect* viewport);
180
191
203
210TCOD_PUBLIC void TCOD_quit(void);
211#ifdef __cplusplus
212} // extern "C"
213namespace tcod {
214namespace console {
215[[deprecated(
216 "This way of initializing libtcod is deprecated. See the documentation for how to use "
217 "tcod::new_context.")]] TCOD_PUBLIC void
218init_root(int w, int h, const std::string& title, bool fullscreen, TCOD_renderer_t renderer);
219[[deprecated(
220 "This way of initializing libtcod is deprecated. See the documentation for how to use "
221 "tcod::new_context.")]] TCOD_PUBLIC void
222init_root(int w, int h, const std::string& title, bool fullscreen, TCOD_renderer_t renderer, bool vsync);
223} // namespace console
224} // namespace tcod
225#endif // __cplusplus
226#endif // LIBTCOD_CONSOLE_INIT_H_
Libtcod config header.
Various console functions.
void TCOD_console_set_window_title(const char *title)
Change the title string of the active window.
TCOD_Context * TCOD_sys_get_internal_context(void)
Return the context being used internally by the old API.
struct SDL_Renderer * TCOD_sys_get_sdl_renderer(void)
Return an SDL_Renderer pointer if one is in use, returns NULL otherwise.
TCOD_Console * TCOD_sys_get_internal_console(void)
Return a pointer to the "root console" used internally by the old API.
bool TCOD_console_is_active(void)
Return true if the window has keyboard focus.
void TCOD_console_set_fullscreen(bool fullscreen)
Set the display to be full-screen or windowed.
void TCOD_quit(void)
Shutdown libtcod.
bool TCOD_console_is_fullscreen(void)
Return true if the display is full-screen.
struct SDL_Window * TCOD_sys_get_sdl_window(void)
Return an SDL_Window pointer if one is in use, returns NULL otherwise.
bool TCOD_console_is_window_closed(void)
Return true if the window is closing.
bool TCOD_console_has_mouse_focus(void)
Return true if the window has mouse focus.
TCOD_Error TCOD_console_init_root(int w, int h, const char *title, bool fullscreen, TCOD_renderer_t renderer)
Initialize the libtcod graphical engine.
int TCOD_sys_accumulate_console(const TCOD_Console *console)
Render a console over the display.
C types for console functions.
TCOD_renderer_t
Libtcod rendering modes.
Definition console_types.h:491
Libtcod display management context.
Error handling module.
TCOD_Error
An enum of libtcod error codes.
Definition error.h:48
The libtcod namespace.
Definition bresenham.hpp:157
A libtcod console containing a grid of tiles with {ch, fg, bg} information.
Definition console.h:125
A rendering context for libtcod.
Definition context.h:340
Tileset module.