libtcod
Loading...
Searching...
No Matches
wrappers.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 WRAPPERS_H
36#define WRAPPERS_H
37
38#include "console_printing.h"
39#include "console_types.h"
40#include "image.h"
41#include "mouse.h"
42#include "parser.h"
43#include "portability.h"
44
45/* wrappers to ease other languages integration */
46typedef unsigned int colornum_t;
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51#ifndef NO_SDL
52/* color module */
53TCODLIB_API bool TCOD_color_equals_wrapper(colornum_t c1, colornum_t c2);
54TCODLIB_API colornum_t TCOD_color_add_wrapper(colornum_t c1, colornum_t c2);
55TCODLIB_API colornum_t TCOD_color_subtract_wrapper(colornum_t c1, colornum_t c2);
56TCODLIB_API colornum_t TCOD_color_multiply_wrapper(colornum_t c1, colornum_t c2);
57TCODLIB_API colornum_t TCOD_color_multiply_scalar_wrapper(colornum_t c1, float value);
58TCODLIB_API colornum_t TCOD_color_lerp_wrapper(colornum_t c1, colornum_t c2, float coef);
59TCODLIB_API void TCOD_color_get_HSV_wrapper(colornum_t c, float* h, float* s, float* v);
60TCODLIB_API float TCOD_color_get_hue_wrapper(colornum_t c);
61TCODLIB_API float TCOD_color_get_saturation_wrapper(colornum_t c);
62TCODLIB_API float TCOD_color_get_value_wrapper(colornum_t c);
63
64/* console module */
65/* TCODLIB_API void TCOD_console_set_custom_font_wrapper(const char *fontFile,
66 int char_width, int char_height, int nb_char_horiz,
67 int nb_char_vertic, bool chars_by_row,
68 colornum_t key_color); */
69
70TCODLIB_API void TCOD_console_set_default_background_wrapper(TCOD_console_t con, colornum_t col);
71TCODLIB_API void TCOD_console_set_default_foreground_wrapper(TCOD_console_t con, colornum_t col);
72TCODLIB_API colornum_t TCOD_console_get_default_background_wrapper(TCOD_console_t con);
73TCODLIB_API colornum_t TCOD_console_get_default_foreground_wrapper(TCOD_console_t con);
74TCODLIB_API colornum_t TCOD_console_get_char_background_wrapper(TCOD_console_t con, int x, int y);
75TCODLIB_API void TCOD_console_set_char_background_wrapper(
76 TCOD_console_t con, int x, int y, colornum_t col, TCOD_bkgnd_flag_t flag);
77TCODLIB_API colornum_t TCOD_console_get_char_foreground_wrapper(TCOD_console_t con, int x, int y);
78TCODLIB_API void TCOD_console_set_char_foreground_wrapper(TCOD_console_t con, int x, int y, colornum_t col);
79TCODLIB_API void TCOD_console_put_char_ex_wrapper(
80 TCOD_console_t con, int x, int y, int c, colornum_t fore, colornum_t back);
81TCODLIB_API void TCOD_console_set_fade_wrapper(uint8_t val, colornum_t fade);
82TCODLIB_API colornum_t TCOD_console_get_fading_color_wrapper(void);
83TCODLIB_API void TCOD_console_set_color_control_wrapper(TCOD_colctrl_t con, colornum_t fore, colornum_t back);
84TCODLIB_API bool TCOD_console_check_for_keypress_wrapper(TCOD_key_t* holder, int flags);
85TCODLIB_API void TCOD_console_wait_for_keypress_wrapper(TCOD_key_t* holder, bool flush);
86TCODLIB_API void TCOD_console_fill_background(TCOD_console_t con, int* r, int* g, int* b);
87TCODLIB_API void TCOD_console_fill_foreground(TCOD_console_t con, int* r, int* g, int* b);
88TCODLIB_API void TCOD_console_fill_char(TCOD_console_t con, int* arr);
89
90TCODLIB_API void TCOD_console_double_hline(TCOD_console_t con, int x, int y, int l, TCOD_bkgnd_flag_t flag);
91TCODLIB_API void TCOD_console_double_vline(TCOD_console_t con, int x, int y, int l, TCOD_bkgnd_flag_t flag);
92TCODLIB_API void TCOD_console_print_double_frame(
93 TCOD_console_t con, int x, int y, int w, int h, bool empty, TCOD_bkgnd_flag_t flag, const char* fmt, ...);
94
95TCODLIB_API char* TCOD_console_print_return_string(
96 TCOD_console_t con,
97 int x,
98 int y,
99 int rw,
100 int rh,
102 TCOD_alignment_t align,
103 char* msg,
104 bool can_split,
105 bool count_only);
106TCODLIB_API void TCOD_console_set_key_color_wrapper(TCOD_console_t con, colornum_t c);
107
108/* image module */
109
110TCODLIB_API void TCOD_image_clear_wrapper(TCOD_image_t image, colornum_t color);
111TCODLIB_API colornum_t TCOD_image_get_pixel_wrapper(TCOD_image_t image, int x, int y);
112TCODLIB_API colornum_t TCOD_image_get_mipmap_pixel_wrapper(TCOD_image_t image, float x0, float y0, float x1, float y1);
113TCODLIB_API void TCOD_image_put_pixel_wrapper(TCOD_image_t image, int x, int y, colornum_t col);
114TCODLIB_API void TCOD_image_set_key_color_wrapper(TCOD_image_t image, colornum_t key_color);
115
116/* mouse module */
117TCODLIB_API void TCOD_mouse_get_status_wrapper(TCOD_mouse_t* holder);
118
119/* parser module */
120TCODLIB_API colornum_t TCOD_parser_get_color_property_wrapper(TCOD_parser_t parser, const char* name);
121
122/* namegen module */
123TCODLIB_API int TCOD_namegen_get_nb_sets_wrapper(void);
124TCODLIB_API void TCOD_namegen_get_sets_wrapper(char** sets);
125
126/* sys module */
127TCODLIB_API int TCOD_sys_get_current_resolution_x(void);
128TCODLIB_API int TCOD_sys_get_current_resolution_y(void);
129#endif // NO_SDL
130#ifdef __cplusplus
131} // extern "C"
132#endif
133#endif /* WRAPPERS_H */
Console string printing module.
C types for console functions.
TCOD_alignment_t
Print justification options.
Definition console.h:81
TCOD_bkgnd_flag_t
Background color blend modes.
Definition console.h:60
Image handling module.
Deprecated mouse functions.
Libtcod config parser.
Miscellaneous tools needed across platforms.
Libtcod key event data, as a keycode or text character.
Definition console_types.h:207
Mouse state provided by the libtcod event system.
Definition mouse_types.h:50